[PHP] Date class

2005-04-19 Thread Devraj Mukherjee
Everyone,
Do you know of any decent Date/Time handling classes? We require the 
following functionality

1. Date's prior to 1970 handled (not reliant on the PHP date)
2. add/subtract days to/from a date
3. subtract two dates returning number of days
Any pointers are welcome. Thanks for your time in advance.
Devraj
--
Devraj Mukherjee ([EMAIL PROTECTED])
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ldap_connect error

2005-04-19 Thread Steve Turnbull
Richard Lynch wrote:

 On Mon, April 18, 2005 2:43 am, Steve Turnbull said:
 I am running a LAMP setup consisting of Debian (testing), PHP4, Apache2,
 and
 MySQL 4.

 When I installed php, I used apt-get, and included in the list of modules
 was libapache2_mod_php4 php4 php4-ldap ...

 PHP works fine, and a test phpinfo() brings up all of the expected
 parameters (at least I think it does).

 The one thing that doesn't work is ldap. I have enabled the ldap modules
 - a2enmod ldap - and this doesn't throw an error, it just prompts for the
 apache restart which in turn restarts fine.

 BUT if I run a very simple ldap_connect (see script) I get this error;

 Fatal error: Call to undefined function: ldap_connect()
 in /www/stevedev/vhtdocs/ldap/index.php on line 27

 So it appears that the ldap hasn't got itself running with php.

 The very simple test script I used was;

 $ds = ldap_connect('ldap.our server.net');
 if ($ds) {
 ldap_bind($ds);
 echo 'connected';
 } else {
 echo 'not connected';
 }

 Has any one got any ideas of why this error get thrown?
 
 Sounds to me like you've installed:
 LDAP
 PHP
 but you have *not* installed the PHP-LDAP module.
 
 Search in your apt-get thingie for something like php_ldap or phpldap
 which will be the PHP extension that lets PHP actually use LDAP, as
 opposed to just happening to have both LDAP and PHP installed on the same
 machine.
 

Thanks for the reply.

I actually sussed it last night - when I installed the packages, It didn't
have 'extension=ldap.so' in the php.ini file.

Regards
Steve

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Apache - IIS Migration

2005-04-19 Thread Prathaban Mookiah
Are there any external libraries that you used to compile PHP? Including 
support for certain functions may have to be done differently in Windows for 
e.g Cybercash. Else it shouldn't be a problem. You can even safely upgrade to 
PHP = 5.0.

Prathap


-- Original Message ---
From: Pablo D Marotta [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Mon, 18 Apr 2005 18:08:51 -0300
Subject: [PHP] Apache - IIS Migration

 Hi there..
 
 Im using Apace 1.3.31 and PHP 4.3.8 in a Windows 2000 enviroment.
 
 Ill have to migrate the whole site to Windows 2003 enviroment,
  using IIS 6.0.. Should there be any problem about that, or not?
 
 I mean, should it all go fine, or is it possible for the code to 
 fail in some parts? Just in case you need to know, Im using 
 register globals on, and Im also using some Pear functions 
 (Excel_Spreadsheet).
 
 The people Ive asked about this yet, have told me that it should go 
 fine as long as I keep the same PHP version.
 (I should install PHP in the IIS, configure it to recognize the php 
 files, and then copy the php files)
 
 Thank you all!
 Pablo
 
 American Express made the following
  annotations on 04/18/05 14:09:05
 
--
 
**
 
 This message and any attachments are solely for the intended 
 recipient and may contain confidential or privileged information. If 
 you are not the intended recipient, any disclosure, copying, use, or 
 distribution of the information included in this message and any 
 attachments is prohibited. If you have received this communication 
 in error, please notify us by reply e-mail and immediately and 
 permanently delete this message and any attachments. Thank you.
 
 
**
 
==
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Date class

2005-04-19 Thread Mattias Thorslund
Devraj Mukherjee wrote:
Everyone,
Do you know of any decent Date/Time handling classes? We require the 
following functionality

1. Date's prior to 1970 handled (not reliant on the PHP date)
2. add/subtract days to/from a date
3. subtract two dates returning number of days
Any pointers are welcome. Thanks for your time in advance.
Devraj

Have you looked at the PEAR Date class?
http://pear.php.net/package/Date
/Mattias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] RHES 3 - PHP 5.0.x - freetype

2005-04-19 Thread Sasha Dolgy
sorry.  does not generate text.  doesn't generate any errors either. 
when i compile the freetype source with a simple ./configure;make;make
install then compile php it works fine and displays text Omega...

Was more curious to see if anyone had encountered this problem with
building on RHES and how they got around it, if they did, without
having to compile freetype --- instead using the rpm's that are
provided by redhat network (rhn).

thanks.
-sd

ps.  no fires yet.  try and try i will...

On 4/19/05, Richard Lynch [EMAIL PROTECTED] wrote:
 You may want to define does not work a bit more fully.
 
 Does it crash PHP?
 
 Generate error messages?
 
 Not display the text?
 
 Catch your computer on fire?
 
 Post back to the list only -- I probably won't know the answer.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Localhost not working with cookies

2005-04-19 Thread Joseph L. Mueller
Richard Lynch wrote:
On Sun, April 17, 2005 1:05 pm, Proudly Pinoy said:
I've read from php.net/setcookie and codecomments.com that using localhost
won't work with cookies and neither are IP addresses. So how do I test
cookies on local system?

Works for me.
Maybe doesn't work with specific broken browsers or something, but you
just need it to work for development, where you pick the browser, no?
You'd have to do QA on a non-localhost for those browsers so badly broken
as to not do Cookies for localhost, but that should not be too onerous.
What I did when I had that same problem was to add the following record 
in the HOSTS file in c:\windows\system32\drivers\etc
127.0.0.1   my.local.com localhost

--
Joseph L. Mueller
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php4 can't find tnsnames.ora oracle9 but can connect if description hardcoded

2005-04-19 Thread neil smith
Hello,
I have test script that can connect to the oracle database. It doesn't 
require tnsnames.ora because I define the database alias in the script 
itself. It looks like this:


echo TWO_TASK=.getenv(TWO_TASK).br;
echo LD_LIBRARY_PATH=.getenv(LD_LIBRARY_PATH).br;
echo ORACLE_BASE=.getenv(ORACLE_BASE).BR;
echo ORACLE_HOME=.getenv(ORACLE_HOME).BR;
echo TNS_ADMIN=.getenv(TNS_ADMIN).BR;
echo NLS_LANG=.getenv(NLS_LANG)..br;
# this allows a successful connection
$db =   (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521))
 (CONNECT_DATA= (SID = testdb))
 );
// these don't work.. php can't seem to find tnsnames.ora
# $db = testdb.boo.com;
//$db = testdb.boo.com;
# $db = testdb;
//echo $testdb;
$odbc = OCILogon(test/test,test,$db);
if ($odbc == false){
  $msg = OCIError($odbc).BR;
} else {
echo success!!!br;
}

My problem is is that when I try to use the database alias in tnsnames.ora I 
get an ora-12154 error. I get this despite the facts that oracle_home, 
tns_admin and everything else is defined in the script and the tnsnames.ora 
contains exactly the same alias as I use in the hardcoded version (see the 
uncommented $db above).
sqlnet.ora contains a value name_domain that apparently is appended to the 
alias in tnsnames.ora but accounting for this still doesn't let me connect 
to oracle . It's as if tnsnames.ora cannot be found. I've changed the 
permissions to 777 for the whole directory structure and I can successfully 
use tnsnames.ora with sqlplus or tnsping.

Does anybody have any ideas what is going wrong? Is this a bug?
thanks,
neil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] upload automatic execute

2005-04-19 Thread Sejati Opreker
Hi,
I'm planning to make and ftp server and using php to
upload it's files, this file for upload will be
execute to insert into myslq databases, my problem is
how do I make php to check if there is new file been
upload and automaticly insert into mysql.

Txh

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php output fills apache buffer for clients with slow internet connections

2005-04-19 Thread Martin Mandl
Dear Ladies and Gentlemen,
the last couple of days I browsed the internet for the answer of a 
questions which seems to be a common problem ... but found now real 
solution:

I would like to serve large files (100MB) to my clients using php:
while (moreDataAvailable()) {
  printChunk(getChunk());
  flush();
  waitToReduceBandwidth();
}
Normally that works fine. However when the client has a slower internet 
connection than I set using waitToReduceBandwidth() the output of the 
php script builds up in the buffer of Apache. ... and the Apache process 
reaches a couple of hundred MBytes ...

A solution would be to reduce the bandwidth so that is even lower than 
the slowest connection ... but then clients with faster connections 
would complain ...

Therefore (finally) here come the questions:
Is there a way to control the output speed of the php script according 
to the actual download speed between the browser and the server?
Or is there a way to monitor the memory usage of the apache process (to 
slow down the data output when it increases)?
Or is writing my own socket to act as web server a solution (is it 
possible to monitor the connection speed this way)?
Or what should I do else?

Any hints are welcome, cheers
  Martin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Links exchange with http://php-faq.com.

2005-04-19 Thread Ann Clark

Hello,

 
  We would like to exchange links between your site http://php-faq.com and our 
new exciting casino web site.
Our site do NOT offer online gambling, it have information about different 
aspects of gambling and so it's very good and informative from our point of 
view.
We require that our link to you is reciprocated. So please add our link to your 
site and send us it location, we will reply within 72 hours.


Information about our site is next:

URL: http://www.1-all-best-online-casinos.com/about.html
Link Title: Online Casinos
Description: All Best Online Casino Games are here!
 


Best regards, Ann Clark.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] upload automatic execute

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 12:01, Sejati Opreker wrote:
 Hi,
 I'm planning to make and ftp server and using php to
 upload it's files, this file for upload will be
 execute to insert into myslq databases, my problem is
 how do I make php to check if there is new file been
 upload and automaticly insert into mysql.

Use cronjobs if you're using *nix-based OS.


 Txh

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpZ4br4NruJu.pgp
Description: PGP signature


[PHP] email through PHP

2005-04-19 Thread Balwant Singh
hi,

I am using FEDORA 3 and PHP. I want to send email to outside by my above
mentioned linux machine through PHP. For this i want to use my SMTP
sever, which is on a WINDOWS machine

Please inform what setting to be done in php.ini or any other file to
send the email. 

with best wishes
balwant

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php output fills apache buffer for clients with slow internet connections

2005-04-19 Thread Marek Kilimajer
Martin Mandl wrote:
Dear Ladies and Gentlemen,
the last couple of days I browsed the internet for the answer of a 
questions which seems to be a common problem ... but found now real 
solution:

I would like to serve large files (100MB) to my clients using php:
while (moreDataAvailable()) {
  printChunk(getChunk());
  flush();
  waitToReduceBandwidth();
}
Normally that works fine. However when the client has a slower internet 
connection than I set using waitToReduceBandwidth() the output of the 
php script builds up in the buffer of Apache. ... and the Apache process 
reaches a couple of hundred MBytes ...

A solution would be to reduce the bandwidth so that is even lower than 
the slowest connection ... but then clients with faster connections 
would complain ...

Therefore (finally) here come the questions:
Is there a way to control the output speed of the php script according 
to the actual download speed between the browser and the server?
Or is there a way to monitor the memory usage of the apache process (to 
slow down the data output when it increases)?
Or is writing my own socket to act as web server a solution (is it 
possible to monitor the connection speed this way)?
Or what should I do else?

Any hints are welcome, cheers
  Martin
Try apaches' SendBufferSize config directive
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Links exchange with http://php-faq.com. OT - SPAM

2005-04-19 Thread Mattias Thorslund
Ann Clark wrote:
Hello,
 We would like to exchange links between your site http://php-faq.com and 
our new exciting casino web site.
Our site do NOT offer online gambling, it have information about different 
aspects of gambling and so it's very good and informative from our point of 
view.
We require that our link to you is reciprocated. So please add our link to your 
site and send us it location, we will reply within 72 hours.
Information about our site is next:
 

[snipped link]
Link Title: Online Casinos
Description: All Best Online Casino Games are here!

Best regards, Ann Clark.
 

It would be nice if the above piece of blatant spam were removed from 
the archives, since the spammer's objective most likely is to improve 
their Google rank...

Possible?
/Mattias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php output fills apache buffer for clients with slow internet

2005-04-19 Thread Martin Mandl
Try apaches' SendBufferSize config directive
SendBufferSize sets the size of the TCP send buffer. Increasing the size 
would help only within high-speed networks to speed up the connection. 
However the 'slow-connection' clients are not in the same network. Thus 
increasing the TCP send buffer could even result in an increased number 
of tropped TCP packages ...

Thanks (I was not aware of that directive)
  Martin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] email through PHP

2005-04-19 Thread Ken
On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote:
 hi,
 
 I am using FEDORA 3 and PHP. I want to send email to outside by my above
 mentioned linux machine through PHP. For this i want to use my SMTP
 sever, which is on a WINDOWS machine
 
 Please inform what setting to be done in php.ini or any other file to
 send the email.
 
 with best wishes
 balwant
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

erm, isn't it easier to have the smtp on your fedora box instead...?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] email through PHP

2005-04-19 Thread Balwant Singh
i want to use the SMTP server which is already exists.  
pls. give more details..

with best wishes
balwant

On Tue, 2005-04-19 at 15:59, Ken wrote:
 On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote:
  hi,
  
  I am using FEDORA 3 and PHP. I want to send email to outside by my above
  mentioned linux machine through PHP. For this i want to use my SMTP
  sever, which is on a WINDOWS machine
  
  Please inform what setting to be done in php.ini or any other file to
  send the email.
  
  with best wishes
  balwant
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 erm, isn't it easier to have the smtp on your fedora box instead...?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Single SQL-statement in PHP to order...

2005-04-19 Thread Jared Williams
  Hi there!
 
  I guess this is off-topic? but I want to know if this is 
 possible. (If 
  there's anyone out there that have a solution, I would appreciate it
  though)
 
  I want to know if there is anyway of showing tables in PHP 
 in an order 
  like this in a single SQL-statement...
 
  Table is like this:
  IDCategory
  7
  15
  4
  3
 
  I want to order the table like this: First everything that is 
  IDCategory 4, then the rest of the posts (doesn't matter 
 which order)
 

SELECT *, 1 AS sequence FROM Table WHERE IDCategory = 4
UNION
SELECT *, 2 AS sequence FROM Table WHERE IDCategory != 4 
ORDER BY sequence ASC

Jared

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] .htaccess

2005-04-19 Thread pete M
I'm trying to figure out out to put a directive in .htaccess to make the 
session timeout in 4 hours ..

tried
php_flag session.cookie_lifetime 240
and a few others
can someone help !
tia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] .htaccess

2005-04-19 Thread Mario de Frutos Dieguez
pete M escribió:
I'm trying to figure out out to put a directive in .htaccess to make 
the session timeout in 4 hours ..

tried
php_flag session.cookie_lifetime 240
and a few others
can someone help !
tia
Try ini_set(session.gc_maxlifetime,2400);
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] email through PHP

2005-04-19 Thread Angelo Zanetti
why dont you read the manual, thats what its for.
I know you can specify your smtp server setttings in your php.ini file.
so just set your smtp to the windows server address
from PHP.ini
[mail function]
; For Win32 only.
SMTP = smtp.myserver.com ; for Win32 only
; For Win32 only.
sendmail_from = [EMAIL PROTECTED]; for Win32 only
; For Unix only.  You may supply arguments as well (default: sendmail 
-t -i).
;sendmail_path =

hope this helps
Angelo Zanetti
Z Logic
[c] +27 72 441 3355
[t] +27 21 464 1363
[f] +27 21 464 1371
www.zlogic.co.za

Balwant Singh wrote:
i want to use the SMTP server which is already exists.  
pls. give more details..

with best wishes
balwant
On Tue, 2005-04-19 at 15:59, Ken wrote:
 

On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote:
   

hi,
I am using FEDORA 3 and PHP. I want to send email to outside by my above
mentioned linux machine through PHP. For this i want to use my SMTP
sever, which is on a WINDOWS machine
Please inform what setting to be done in php.ini or any other file to
send the email.
with best wishes
balwant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 

erm, isn't it easier to have the smtp on your fedora box instead...?
   

 



[PHP] Convert gif to jpg

2005-04-19 Thread Roman Duriancik
Hello,
Is it possible to convert pictures in gif format to jpg format in php 
script ?
Thank you for yours responses.
Roman

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Convert gif to jpg

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 14:40, Roman Duriancik wrote:
 Hello,
 Is it possible to convert pictures in gif format to jpg format in php
 script ?

Yes,

Check http://www.php.net/manual/en/ref.image.php

 Thank you for yours responses.
 Roman

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpBMYSQBr3WH.pgp
Description: PGP signature


RE: [PHP] mysql blob datatype for documents

2005-04-19 Thread Mark Rees
It depends to some extent on who has access to the machine where you
wish to store the documents, and how sensitive the documents are. When
you are storing very sensitive documents with severe access restrictions
it can make sense to use the DB for storage. You have to be careful when
writing the data in and reading it out, but it can be done. I recall
implementing a document storage system in SQL Server a few years ago  -
you will see a lot of advice both ways but actually the filesystem and
the db are both suitable for this. It really depends on what your
requirements are.

Mark

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 19 April 2005 03:27
To: Bosky, Dave
Cc: php-general@lists.php.net
Subject: Re: [PHP] mysql blob datatype for documents


On Mon, April 18, 2005 5:40 am, Bosky, Dave said:
 Would it be better to store uploaded pdf, word, or excel documents in 
 a MySql blob field rather than keeping them in a directory?

 I really want to secure the documents and limit document access to 
 specific users.

It shouldn't be significantly easier to limit access with BLOBs than
with actual files if your Security Model and Design is any good.

And the penalties for using BLOBs to store these are legion.

There is a custom super-fast souped up database storage software package
specifically optimized for large chunks of data like this that you
should be using.

It's call the file system :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

EOE

**
**


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] email through PHP

2005-04-19 Thread pete M
check out phpmailer
http://phpmailer.sourceforge.net/
use it all the time - its brilliant !!!
Balwant Singh wrote:
hi,
I am using FEDORA 3 and PHP. I want to send email to outside by my above
mentioned linux machine through PHP. For this i want to use my SMTP
sever, which is on a WINDOWS machine
Please inform what setting to be done in php.ini or any other file to
send the email. 

with best wishes
balwant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] email through PHP

2005-04-19 Thread Balwant Singh
thanks for your email,

i read the manual and already tried  the setting as told by you but its
not working.  

i would like to again inform that i want to send email through PHP which
is on a linux machine and our Company SMTP sever is on Windows Machine. 
i am certain the somebody has already tested it and can give me
solution.  pls help.

 

with best wishes
balwant


On Tue, 2005-04-19 at 17:20, Angelo Zanetti wrote:
 why dont you read the manual, thats what its for. 
 I know you can specify your smtp server setttings in your php.ini
 file.
 so just set your smtp to the windows server address
 
 from PHP.ini
 
 [mail function]
 ; For Win32 only.
 SMTP = smtp.myserver.com ; for Win32 only
 
 ; For Win32 only.
 sendmail_from = [EMAIL PROTECTED]; for Win32 only
 
 ; For Unix only.  You may supply arguments as well (default: sendmail
 -t -i).
 ;sendmail_path =
 
 hope this helps
 
 Angelo Zanetti
 Z Logic
 [c] +27 72 441 3355
 [t] +27 21 464 1363
 [f] +27 21 464 1371
 www.zlogic.co.za
 
 Balwant Singh wrote: 
  i want to use the SMTP server which is already exists.  
  pls. give more details..
  
  with best wishes
  balwant
  
  On Tue, 2005-04-19 at 15:59, Ken wrote:

   On 19 Apr 2005 15:04:08 +0530, Balwant Singh [EMAIL PROTECTED] wrote:
   
hi,

I am using FEDORA 3 and PHP. I want to send email to outside by my above
mentioned linux machine through PHP. For this i want to use my SMTP
sever, which is on a WINDOWS machine

Please inform what setting to be done in php.ini or any other file to
send the email.

with best wishes
balwant

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  
   
   erm, isn't it easier to have the smtp on your fedora box instead...?
   
  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] .htaccess

2005-04-19 Thread Martin Mandl
4 hours = 60 * 60 * 4 = 14400
Mario de Frutos Dieguez wrote:
pete M escribió:
I'm trying to figure out out to put a directive in .htaccess to make 
the session timeout in 4 hours ..

tried
php_flag session.cookie_lifetime 240
and a few others
can someone help !
tia
Try ini_set(session.gc_maxlifetime,2400);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] .htaccess

2005-04-19 Thread Martin Mandl
and try php_value instead of php flag:
php_value session.cookie_lifetime 14400
Martin Mandl wrote:
4 hours = 60 * 60 * 4 = 14400
Mario de Frutos Dieguez wrote:
pete M escribió:
I'm trying to figure out out to put a directive in .htaccess to make 
the session timeout in 4 hours ..

tried
php_flag session.cookie_lifetime 240
and a few others
can someone help !
tia
Try ini_set(session.gc_maxlifetime,2400);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] email through PHP

2005-04-19 Thread pete M
http://phpmailer.sourceforge.net/extending.html
Balwant Singh wrote:
hi,
I am using FEDORA 3 and PHP. I want to send email to outside by my above
mentioned linux machine through PHP. For this i want to use my SMTP
sever, which is on a WINDOWS machine
Please inform what setting to be done in php.ini or any other file to
send the email. 

with best wishes
balwant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Last visitors

2005-04-19 Thread Ryan A
Hey,
Am a bit puzzled as to how to do this, I am modifying a profiles/dating
site, the site works like this:
if you are a guest you can see only limited details of a profile, if you
have logged in, you see many more details.

On the profile page there should be last 10 visitors, it will not register
the guests, but if someone had logged in and visited your profile, it should
show their usernameif there are 10 enteries in the db and when the 11th
person comes...then the first person who came should be bumped off and the
11th person takes his place and so on

I hope i have explained it well, I dont think many of you even needed that
long explanation as you might have already seen this on many sites and knew
what i was talking about by the second line, but better more infomation than
less right?

Any ideas, links,code or classes on how i can implement this?

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A [EMAIL PROTECTED] wrote:
 Hey,
 Am a bit puzzled as to how to do this, I am modifying a profiles/dating
 site, the site works like this:
 if you are a guest you can see only limited details of a profile, if you
 have logged in, you see many more details.
 
 On the profile page there should be last 10 visitors, it will not register
 the guests, but if someone had logged in and visited your profile, it should
 show their usernameif there are 10 enteries in the db and when the 11th
 person comes...then the first person who came should be bumped off and the
 11th person takes his place and so on
 
 I hope i have explained it well, I dont think many of you even needed that
 long explanation as you might have already seen this on many sites and knew
 what i was talking about by the second line, but better more infomation than
 less right?
 
 Any ideas, links,code or classes on how i can implement this?
 
 Thanks,
 Ryan
 
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Instead of having a seperate table to see the latest people logged on,
isn't it better to query an existing user table based on the last
login time?

SELECT username from users ORDER BY login_time DESC LIMIT 10?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
clip
 the site works like this:
  if you are a guest you can see only limited details of a profile, if
 you
  have logged in, you see many more details.
  On the profile page there should be last 10 visitors, it will not
 register
  the guests, but if someone had logged in and visited your profile, it
 should
  show their usernameif there are 10 enteries in the db and when the
 11th

  person comes...then the first person who came should be bumped off and
 the
  11th person takes his place and so on
/clip


Instead of having a seperate table to see the latest people logged on,
isn't it better to query an existing user table based on the last
login time?

SELECT username from users ORDER BY login_time DESC LIMIT 10?


I am not checking for the last people logged in, I want to see the last
people who have viewed the profile...
each profile will have its own last 10 people visited

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 15:57, Ryan A wrote:
 Hey,
 Am a bit puzzled as to how to do this, I am modifying a profiles/dating
 site, the site works like this:
 if you are a guest you can see only limited details of a profile, if you
 have logged in, you see many more details.

 On the profile page there should be last 10 visitors, it will not
 register the guests, but if someone had logged in and visited your profile,
 it should show their usernameif there are 10 enteries in the db and
 when the 11th person comes...then the first person who came should be
 bumped off and the 11th person takes his place and so on

 I hope i have explained it well, I dont think many of you even needed that
 long explanation as you might have already seen this on many sites and knew
 what i was talking about by the second line, but better more infomation
 than less right?

Just store the login time of each identified user and you can filter/sort by 
it.


 Any ideas, links,code or classes on how i can implement this?

 Thanks,
 Ryan




 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpVS4cLnOE2t.pgp
Description: PGP signature


[PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A [EMAIL PROTECTED] wrote:
 clip
  the site works like this:
   if you are a guest you can see only limited details of a profile, if
  you
   have logged in, you see many more details.
   On the profile page there should be last 10 visitors, it will not
  register
   the guests, but if someone had logged in and visited your profile, it
  should
   show their usernameif there are 10 enteries in the db and when the
  11th
 
   person comes...then the first person who came should be bumped off and
  the
   11th person takes his place and so on
 /clip

 
 Instead of having a seperate table to see the latest people logged on,
 isn't it better to query an existing user table based on the last
 login time?

 SELECT username from users ORDER BY login_time DESC LIMIT 10?
 

 I am not checking for the last people logged in, I want to see the last
 people who have viewed the profile...
 each profile will have its own last 10 people visited

 Thanks,
 Ryan

 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005



ah! i see. sorry for misunderstanding you.
perhaps on the script for the profiles page, the logic should be like:

profile for user: adam

if the browsing user is logged in: (for example the browsing user is ben)
  insert into the database that ben has seen adam's profile
end if

and your table in the database can be:

user   visitor  time_of_visit
adam  ben 1290122141 (unix timestamp)

then you can query it on the database for each user.

SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
DESC LIMIT 10

As for cleaning up... that's the bit that I can't figure out myself :(.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Ryan A
 I am not checking for the last people logged in, I want to see the last
 people who have viewed the profile...
 each profile will have its own last 10 people visited

/*
ah! i see. sorry for misunderstanding you.
perhaps on the script for the profiles page, the logic should be like:

profile for user: adam

if the browsing user is logged in: (for example the browsing user is ben)
  insert into the database that ben has seen adam's profile
end if

and your table in the database can be:

user   visitor  time_of_visit
adam  ben 1290122141 (unix timestamp)

then you can query it on the database for each user.

SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
DESC LIMIT 10
As for cleaning up... that's the bit that I can't figure out myself :(.
*/

Hey,
Thanks for replying.

 ah! i see. sorry for misunderstanding you.

No problem, I guess i didnt explain it well enough, and you dont have to
help me but you are trying, so thank you.

 As for cleaning up... that's the bit that I can't figure out myself :(.

exactly, I came to the same part as youbut then i would have a LOT of
wasted records without the cleanup... just cant figure it out.

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



FW: [PHP] Last visitors

2005-04-19 Thread Mark Rees
Couple of options: a CRON job/scheduled job which invokes a SQL command
deleting all but the 10 most recent records, or do the same every time
you insert a record. 

As to exactly how you decide which are the most recent 10 records to do
this deletion, that is a little more complex. 

Something like 
DELETE FROM profile_visits
WHERE user='billy'
AND time_of_visit NOT IN (
Select time_of_visit
FROM
profile_visits 
WHERE user='billy' 
ORDER by time_of_visit DESC LIMIT 10
)

Should give you an idea.

Mark

-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: 19 April 2005 14:27
To: [EMAIL PROTECTED]
Cc: php
Subject: Re: [PHP] Last visitors


 I am not checking for the last people logged in, I want to see the
 last people who have viewed the profile... each profile will have its 
 own last 10 people visited

/*
ah! i see. sorry for misunderstanding you.
perhaps on the script for the profiles page, the logic should be like:

profile for user: adam

if the browsing user is logged in: (for example the browsing user is
ben)
  insert into the database that ben has seen adam's profile end
if

and your table in the database can be:

user   visitor  time_of_visit
adam  ben 1290122141 (unix timestamp)

then you can query it on the database for each user.

SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
DESC LIMIT 10 As for cleaning up... that's the bit that I can't figure
out myself :(. */

Hey,
Thanks for replying.

 ah! i see. sorry for misunderstanding you.

No problem, I guess i didnt explain it well enough, and you dont have to
help me but you are trying, so thank you.

 As for cleaning up... that's the bit that I can't figure out myself
 :(.

exactly, I came to the same part as youbut then i would have a LOT
of wasted records without the cleanup... just cant figure it out.

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

EOE

**
**

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Duncan Hill
On Tuesday 19 April 2005 14:27, Ryan A typed:

 SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
 DESC LIMIT 10
 As for cleaning up... that's the bit that I can't figure out myself :(.
 */

 Hey,
 Thanks for replying.

  ah! i see. sorry for misunderstanding you.

 No problem, I guess i didnt explain it well enough, and you dont have to
 help me but you are trying, so thank you.

  As for cleaning up... that's the bit that I can't figure out myself :(.

 exactly, I came to the same part as youbut then i would have a LOT of
 wasted records without the cleanup... just cant figure it out.

Create a cron job that gets a list of profiles, and selects the # of records 
associated with that profile.  If the number is  10, identify the 10th 
record and delete records older than that record.

Once a week, optimize your tables to reclaim the space.

-- 
My mind not only wanders, it sometimes leaves completely.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Last visitors

2005-04-19 Thread Ryan A
Hey,

 As to exactly how you decide which are the most recent 10 records to do

 this deletion, that is a little more complex.

Yep, for sure


 Something like

 DELETE FROM profile_visits

 WHERE user='billy'

 AND time_of_visit NOT IN (

 Select time_of_visit

 FROM

 profile_visits

 WHERE user='billy'

 ORDER by time_of_visit DESC LIMIT 10

 )



 Should give you an idea.


Yep, gets me thinking in a few other directions...

I am also toying with the idea of having a txt file for each profile
(instead of using the DB) and fetch/record/delete/update the last 10
there... what do you think? easier?

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Ken
On 4/19/05, Ryan A [EMAIL PROTECTED] wrote:
  I am not checking for the last people logged in, I want to see the last
  people who have viewed the profile...
  each profile will have its own last 10 people visited
 
 /*
 ah! i see. sorry for misunderstanding you.
 perhaps on the script for the profiles page, the logic should be like:
 
 profile for user: adam
 
 if the browsing user is logged in: (for example the browsing user is ben)
   insert into the database that ben has seen adam's profile
 end if
 
 and your table in the database can be:
 
 user   visitor  time_of_visit
 adam  ben 1290122141 (unix timestamp)
 
 then you can query it on the database for each user.
 
 SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
 DESC LIMIT 10
 As for cleaning up... that's the bit that I can't figure out myself :(.
 */
 
 Hey,
 Thanks for replying.
 
  ah! i see. sorry for misunderstanding you.
 
 No problem, I guess i didnt explain it well enough, and you dont have to
 help me but you are trying, so thank you.
 
  As for cleaning up... that's the bit that I can't figure out myself :(.
 
 exactly, I came to the same part as youbut then i would have a LOT of
 wasted records without the cleanup... just cant figure it out.
 
 Thanks,
 Ryan
 
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005
 
 

Well... I had a thought...
you can do a count query

SELECT user, count(visitor) as visitor_count FROM profile_visit GROUP BY user;
then you have a recordset like...

user count(visitor)
adam   9
ben 12

grab the recordset in php

while($object= mysql_fetch_object($result))
{
   if($object-visitor_count  10)
   {
  //SELECT the least recent visit_time
  $query = SELECT visit_time FROM profile_visit WHERE user=' 
.$object-user.  ' LIMIT 9,10;
  $result = mysql_query($query);
  list($visit_time) = mysql_fetch_row($result);
  
  //DELETE anything that is less recent than $visit_time, the
visit time for anything before the 10th most recent visit.
  $query = DELETE FROM profile_visit WHERE  user=' 
.$object-user. AND visit_time  '$visit_time';
   }
}

it's probably not very streamlined, but it should work.
Try posting on devshed as well. They are very quick and good with this
kind of stuff
forums.devshed.com

HTH

Ken

execute this in cron, once a day or something like that...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Last visitors

2005-04-19 Thread Ryan A
Hey,

 Couple of options: a CRON job/scheduled job which invokes a SQL command
 deleting all but the 10 most recent records,
**I dont think this would be very effective, as there might be thousands of
profiles and each gets their last 10 visitors, some would be more popular
than others


or do the same every time you insert a record.
**I think this is the better option.

correct me if I am wrong though...I'm learning from this.

Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Ken
what if you have something like 1000 users on your system.
you'd have 1000 txt files! :(
the DB seems to be a better idea as it's probably more expandable...
you can do other queries to it and stuff... whereas 1000 txt files
will be a pain in the butt to keep track of.

On 4/19/05, Ryan A [EMAIL PROTECTED] wrote:
 Hey,
 
  As to exactly how you decide which are the most recent 10 records to do
 
  this deletion, that is a little more complex.
 
 Yep, for sure
 
 
  Something like
 
  DELETE FROM profile_visits
 
  WHERE user='billy'
 
  AND time_of_visit NOT IN (
 
  Select time_of_visit
 
  FROM
 
  profile_visits
 
  WHERE user='billy'
 
  ORDER by time_of_visit DESC LIMIT 10
 
  )
 
 
 
  Should give you an idea.
 
 Yep, gets me thinking in a few other directions...
 
 I am also toying with the idea of having a txt file for each profile
 (instead of using the DB) and fetch/record/delete/update the last 10
 there... what do you think? easier?
 
 Thanks,
 Ryan
 
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mcrypt_generic_init(): Iv size incorrect

2005-04-19 Thread Mike Hummel
So this solution does work, however it doesn't answer the question as to 
why this is occurring in the first place.
Rather then finding a work around for it, I'd like to know why PHP / 
mcrypt is throwing the error.  Is it an issue in the library itself?

Tom Rogers wrote:
Hi,
Saturday, April 9, 2005, 3:35:21 AM, you wrote:
MH I have an odd php issue with mcrypt.
MH I'm getting a lot of this type of error, but only sometimes:
MH mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 32
MH (note, the supplied length: 0 is not always the same.  sometimes it is
MH 1, 16, etc).
MH It doesn't seem to affect the decoding of the file, but it is throwing a
MH notice in to my error log. I've tried doing this:
MH @mcrypt_generic_init($this-td, $key, $iv)
MH but that doesn't stop it from throwing an error.
MH The only thing I can think is that I have
MH mcrypt_module_close($this-td) 
MH commented out because my code was dying with it...

MH System:
MH Linux w/ Apache 1.3.31
MH PHP Version 4.3.4
MH libmcrypt version 2.5.7
MH Suggestions?
I do this to set a zero iv
$td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors

2005-04-19 Thread Ryan A

 what if you have something like 1000 users on your system.
 
 you'd have 1000 txt files! :(
 the DB seems to be a better idea as it's
 probably more expandable...
 
 you can do other queries to it and stuff... whereas 1000 txt files
 
 will be a pain in the butt to keep track of.


Too true :-(


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 16:27, Ryan A wrote:
  I am not checking for the last people logged in, I want to see the last
  people who have viewed the profile...
  each profile will have its own last 10 people visited

 /*
 ah! i see. sorry for misunderstanding you.
 perhaps on the script for the profiles page, the logic should be like:

 profile for user: adam

 if the browsing user is logged in: (for example the browsing user is ben)
   insert into the database that ben has seen adam's profile
 end if

 and your table in the database can be:

 user   visitor  time_of_visit
 adam  ben 1290122141 (unix timestamp)

 then you can query it on the database for each user.

 SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
 DESC LIMIT 10
 As for cleaning up... that's the bit that I can't figure out myself :(.
 */

 Hey,
 Thanks for replying.

  ah! i see. sorry for misunderstanding you.

 No problem, I guess i didnt explain it well enough, and you dont have to
 help me but you are trying, so thank you.

  As for cleaning up... that's the bit that I can't figure out myself :(.

 exactly, I came to the same part as youbut then i would have a LOT of
 wasted records without the cleanup... just cant figure it out.

You can store only 10 records for each user by using the following logic:

mysql show create table profile_log\G
*** 1. row ***
   Table: profile_log
Create Table: CREATE TABLE `profile_log` (
  `profile_id` int(10) default NULL,
  `user_id` int(10) default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update 
CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

When you create a profile you fill 10 blank records with timestamp -00-00 
00:00:00.

Then if a user sees a profile:

PSEUDO SQL:

$SQL = UPDATE profile_log SET user_id=.$userId. WHERE profile_id=.
$profileId. ORDER BY timestamp ASC LIMIT 1;

This way you:
1. automatically get the new timestamp
2. have no more than 10 records per user.


 Thanks,
 Ryan




 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpHCU1PRwk7f.pgp
Description: PGP signature


Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Ryan A
Hey!
I think I solved this:

select 11 latest visitors
count to see if it returned 11 records,

if (count == 11){
get the oldest (of the 11) visitors time
delete everything from that record and older than that
}
else{}

Pros: max 2 queries

If i am missing anything or you see any problem in my logic, please point it
out.

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:03, Ryan A wrote:
 Hey!
 I think I solved this:

 select 11 latest visitors
 count to see if it returned 11 records,

 if (count == 11){
 get the oldest (of the 11) visitors time
 delete everything from that record and older than that
 }
 else{}

 Pros: max 2 queries

Cons: 
0. there are 3 queries: select, insert/update, delete
1. you're using more than 1 query
2. your logic is tough ;-)
3. you've mixed the php and mysql logic together.

Check my reply.


 If i am missing anything or you see any problem in my logic, please point
 it out.

 Thanks,
 Ryan



 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp3WRVppS0aV.pgp
Description: PGP signature


Re: [PHP] explode a string

2005-04-19 Thread Jochem Maas
Richard Lynch wrote:
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';

$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
  list($id, $cat) = explode(':', $idcat);
  echo \$id = $idbr /\n;
  echo \$cat = $catbr /\n;
}
The 'other' guy mentioned that while() is faster than foreach,
is this true?
I read a few days ago somewhere on php.net that foreach() is the
recommended (by php devs) way of iterating over arrays
also, compare these 2 lines:
while (list(, $idcat) = each($idcats)){ /* ... */ }
foreach ($idcats as $idcat){ /* ... */ }
now its seems to me that the foreach version is 'up' 2 function calls
on the while loop, all else being equal the foreach loop has to be faster
(given that calling functions is relatively very expensive)...
or is foreach() _really_ heavy when compared to while()?
not that I care too much, I find foreach() more pleasing to the eye and there is
less to type (in the given example).
:-)
rgds,
Jochem

what is the best way to explode then loop this string after its taken
apart.
output should be something like:
$id = 4
$cat = gaming
etc..
im just looking for the best/fastest way to do this. the string can grow
to
200 or so bytes, maybe more.

200 bytes is chump-change.
It really doesn't matter how you do this, within reason.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] explode a string

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:03, Jochem Maas wrote:
 Richard Lynch wrote:
  On Mon, April 18, 2005 4:34 am, Sebastian said:
 $string = '4:gaming,5:hardware,3:software,8:security';
 
  $idcats = explode(',', $string);
  while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':', $idcat);
echo \$id = $idbr /\n;
echo \$cat = $catbr /\n;
  }

 The 'other' guy mentioned that while() is faster than foreach,
 is this true?

http://www.sitepoint.com/article/php5-standard-library

Note that the crude benchmarks I've performed suggest that calling the 
methods directly is faster than using foreach, because the latter introduces 
another layer of redirection that must be resolved at runtime by PHP.


 I read a few days ago somewhere on php.net that foreach() is the
 recommended (by php devs) way of iterating over arrays

 also, compare these 2 lines:

 while (list(, $idcat) = each($idcats)){ /* ... */ }
 foreach ($idcats as $idcat){ /* ... */ }

 now its seems to me that the foreach version is 'up' 2 function calls
 on the while loop, all else being equal the foreach loop has to be faster
 (given that calling functions is relatively very expensive)...
 or is foreach() _really_ heavy when compared to while()?

 not that I care too much, I find foreach() more pleasing to the eye and
 there is less to type (in the given example).

 :-)

 rgds,
 Jochem

 what is the best way to explode then loop this string after its taken
 apart.
 
 output should be something like:
 
 $id = 4
 $cat = gaming
 
 etc..
 
 im just looking for the best/fastest way to do this. the string can grow
 to
 200 or so bytes, maybe more.
 
  200 bytes is chump-change.
 
  It really doesn't matter how you do this, within reason.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpFE7VCEyn7m.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread John Nichel
Petar Nedyalkov wrote:
snip
You can store only 10 records for each user by using the following logic:
mysql show create table profile_log\G
*** 1. row ***
   Table: profile_log
Create Table: CREATE TABLE `profile_log` (
  `profile_id` int(10) default NULL,
  `user_id` int(10) default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update 
CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

When you create a profile you fill 10 blank records with timestamp -00-00 
00:00:00.

Then if a user sees a profile:
PSEUDO SQL:
$SQL = UPDATE profile_log SET user_id=.$userId. WHERE profile_id=.
$profileId. ORDER BY timestamp ASC LIMIT 1;
This way you:
1. automatically get the new timestamp
2. have no more than 10 records per user.
What version of MySQL does that work in?  I tried pasting that create 
table directly into MySQL and get an error...

#1064 - You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP
) ENGINE=MyISA

Query used :
 CREATE TABLE `profile_log` (
`profile_id` int( 10 ) default NULL ,
`user_id` int( 10 ) default NULL ,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP
) ENGINE = MYISAM DEFAULT CHARSET = utf8

I can't find a reference to this on MySQL's site...would you have a link 
to the documentation?  Thanks.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:08, John Nichel wrote:
 Petar Nedyalkov wrote:
 snip

  You can store only 10 records for each user by using the following logic:
 
  mysql show create table profile_log\G
  *** 1. row ***
 Table: profile_log
  Create Table: CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  1 row in set (0.00 sec)
 
  When you create a profile you fill 10 blank records with timestamp
  -00-00 00:00:00.
 
  Then if a user sees a profile:
 
  PSEUDO SQL:
 
  $SQL = UPDATE profile_log SET user_id=.$userId. WHERE profile_id=.
  $profileId. ORDER BY timestamp ASC LIMIT 1;
 
  This way you:
  1. automatically get the new timestamp
  2. have no more than 10 records per user.

 What version of MySQL does that work in?  I tried pasting that create
 table directly into MySQL and get an error...

MySQL 4.1.8


 #1064 - You have an error in your SQL syntax.  Check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near 'CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP
 ) ENGINE=MyISA

 Query used :

   CREATE TABLE `profile_log` (
 `profile_id` int( 10 ) default NULL ,
 `user_id` int( 10 ) default NULL ,
 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE
 CURRENT_TIMESTAMP
 ) ENGINE = MYISAM DEFAULT CHARSET = utf8

 I can't find a reference to this on MySQL's site...would you have a link
 to the documentation?  Thanks.

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpyeprQHJ4Sy.pgp
Description: PGP signature


Re: [PHP] Last visitors

2005-04-19 Thread John Nichel
Petar Nedyalkov wrote:
snip
MySQL 4.1.8
snip
Damn, too bad.  We're still using 4.0.x and aren't going to be upgrading 
anytime in the near future.  Thanks for the info on that though...it's 
an interesting feature, and one more thing I can add to the list of 
reasons why we need to upgrade.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Mike Hummel
just do a select limit 11
display up to 11... if less then 11, you might want to display them anyways.
you should be able to deal with up to a million + records, so select 
will stay quick, esp if you make the right fields indexed.

you can take care of purging via crons...
you might find you want the history in the end...
-m
Ryan A wrote:
Hey!
I think I solved this:
select 11 latest visitors
count to see if it returned 11 records,
if (count == 11){
get the oldest (of the 11) visitors time
delete everything from that record and older than that
}
else{}
Pros: max 2 queries
If i am missing anything or you see any problem in my logic, please point it
out.
Thanks,
Ryan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Ryan A
Hey,
Thanks for replying.

 Check my reply.

I did, the problem is the client is on a box with mySql 3.23.x or 4.0.x, he
is deciding to upgrade to a dedicated box but then the host he is looking at
says they will charge him if they are to upgrade to mysql 4.1 (hence i cant
even use sub-selects)
(Sorry I didnt mention the MySql version before...didnt think it was
important till now)


 Cons:
 0. there are 3 queries: select, insert/update, delete

True

 1. you're using more than 1 query

Giving the fact that i am on a low version of MySqlI dont see much
choice here

 2. your logic is tough ;-)

Thats pretty cryptic...care to explain please?

 3. you've mixed the php and mysql logic together.

again...what other choices do i have given the low version of MySql


Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mailing lists

2005-04-19 Thread Clive Zagno
Hi
does anyone use any cool php mailing list software.
clive
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Images - Converting TIFF Format?

2005-04-19 Thread The Disguised Jedi
Is there a quick way to convert a TIFF format picture to a GIF quickly? I 
can only find support for GIFs in PHP, but maybe I'm missing something. I 
have a client running a photography business, and I have designed an image 
watermark and resizing engine, and a server to check the request, serve the 
file, and then delete it. I mainly made this to help him run the site 
himself, since he isn't very good with Photoshop, and can't watermark the 
images (I shouldn't say that...he probably could, but not very fastbut 
anyway...).
 This is all working fine and dandy, but the system will only accept GIF 
format. His images are all raw scans in TIFF format. This means that he has 
to open the image in Photoshop, resize it, and convert it to a GIF. I think 
he can do this himself, but I'd like to make it even simpler, which is why 
I'm writing.
 I need a quick way, preferably in PHP, but it doesn't have to be, to 
convert large batches of TIFF format images to GIF. Does anyone know of a 
way to do this?
 Thanks for reading, and for your responses in advance...

-- 
The Disguised Jedi
[EMAIL PROTECTED]

Now you have my $0.02. Or .01 Pounds, .014 Euros, or $0.025 CAN. I'm 
world-wide BABY!
PHP rocks!
Knowledge is Power. Power Corrupts. Go to school, become evil

Disclaimer: Any disclaimer attached to this message may be ignored. However, 
I must say that the ENTIRE contents of this message are subject to other's 
criticism, corrections, and speculations.

This message is Certified Virus Free


Re: [PHP] mailing lists

2005-04-19 Thread John Nichel
Clive Zagno wrote:
snip
Please turn of your request for read receipts when sending to a mailing 
list.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors

2005-04-19 Thread Tom Crimmins

On Tuesday, April 19, 2005 09:09, John Nichel wrote:

 Petar Nedyalkov wrote:
 snip
 You can store only 10 records for each user by using the following
 logic: 
 
 mysql show create table profile_log\G
 *** 1. row ***  
 Table: profile_log Create Table: CREATE TABLE `profile_log` (
   `profile_id` int(10) default NULL,
   `user_id` int(10) default NULL,
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8
 1 row in set (0.00 sec)
 
 When you create a profile you fill 10 blank records with timestamp
 -00-00 00:00:00. 
 
 Then if a user sees a profile:
 
 PSEUDO SQL:
 
 $SQL = UPDATE profile_log SET user_id=.$userId. WHERE
 profile_id=. $profileId. ORDER BY timestamp ASC LIMIT 1;
 
 This way you:
 1. automatically get the new timestamp
 2. have no more than 10 records per user.
 
 What version of MySQL does that work in?  I tried pasting that create
 table directly into MySQL and get an error...
 
 #1064 - You have an error in your SQL syntax.  Check the manual that
 corresponds to your MySQL server version for the right syntax to use
 near 'CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP
 ) ENGINE=MyISA
 
 Query used :
 
   CREATE TABLE `profile_log` (
 `profile_id` int( 10 ) default NULL ,
 `user_id` int( 10 ) default NULL ,
 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE
 CURRENT_TIMESTAMP
 ) ENGINE = MYISAM DEFAULT CHARSET = utf8
 
 I can't find a reference to this on MySQL's site...would you have a
 link to the documentation?  Thanks.

Try:

CREATE TABLE `profile_log` (
   `profile_id` int(10) default NULL,
   `user_id` int(10) default NULL,
   `timestamp` timestamp NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8

You do not need to specify the default clause on the timestamp column since 
this is already the default behavior, and as you has seen this isn't valid 
before 4.1 anyway. Also I wouldn't use the name 'timestamp' for a column
name. 
It is generally not a good idea to use reserved words for column names.

-- 
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: mailing lists

2005-04-19 Thread Mike Hummel
Sonic Mail Pro is very usable, and very easy to setup.
I have some very non-technical clients using it effectively.
http://www.sensationdesigns.com/products/scripts/smpro/index.php

Clive Zagno wrote:
Hi
does anyone use any cool php mailing list software.
clive
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Images - Converting TIFF Format?

2005-04-19 Thread Mike Hummel
http://www.imagemagick.org/script/index.php
The Disguised Jedi wrote:
Is there a quick way to convert a TIFF format picture to a GIF quickly? I 
can only find support for GIFs in PHP, but maybe I'm missing something. I 
have a client running a photography business, and I have designed an image 
watermark and resizing engine, and a server to check the request, serve the 
file, and then delete it. I mainly made this to help him run the site 
himself, since he isn't very good with Photoshop, and can't watermark the 
images (I shouldn't say that...he probably could, but not very fastbut 
anyway...).
 This is all working fine and dandy, but the system will only accept GIF 
format. His images are all raw scans in TIFF format. This means that he has 
to open the image in Photoshop, resize it, and convert it to a GIF. I think 
he can do this himself, but I'd like to make it even simpler, which is why 
I'm writing.
 I need a quick way, preferably in PHP, but it doesn't have to be, to 
convert large batches of TIFF format images to GIF. Does anyone know of a 
way to do this?
 Thanks for reading, and for your responses in advance...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Last visitors

2005-04-19 Thread Petar Nedyalkov
On Tuesday 19 April 2005 17:42, Tom Crimmins wrote:
 On Tuesday, April 19, 2005 09:09, John Nichel wrote:
  Petar Nedyalkov wrote:
  snip
 
  You can store only 10 records for each user by using the following
  logic:
 
  mysql show create table profile_log\G
  *** 1. row ***
  Table: profile_log Create Table: CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  1 row in set (0.00 sec)
 
  When you create a profile you fill 10 blank records with timestamp
  -00-00 00:00:00.
 
  Then if a user sees a profile:
 
  PSEUDO SQL:
 
  $SQL = UPDATE profile_log SET user_id=.$userId. WHERE
  profile_id=. $profileId. ORDER BY timestamp ASC LIMIT 1;
 
  This way you:
  1. automatically get the new timestamp
  2. have no more than 10 records per user.
 
  What version of MySQL does that work in?  I tried pasting that create
  table directly into MySQL and get an error...
 
  #1064 - You have an error in your SQL syntax.  Check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'CURRENT_TIMESTAMP on update
  CURRENT_TIMESTAMP
  ) ENGINE=MyISA
 
  Query used :
 
CREATE TABLE `profile_log` (
  `profile_id` int( 10 ) default NULL ,
  `user_id` int( 10 ) default NULL ,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE
  CURRENT_TIMESTAMP
  ) ENGINE = MYISAM DEFAULT CHARSET = utf8
 
  I can't find a reference to this on MySQL's site...would you have a
  link to the documentation?  Thanks.

 Try:

 CREATE TABLE `profile_log` (
`profile_id` int(10) default NULL,
`user_id` int(10) default NULL,
`timestamp` timestamp NOT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8

 You do not need to specify the default clause on the timestamp column since
 this is already the default behavior, and as you has seen this isn't valid
 before 4.1 anyway. Also I wouldn't use the name 'timestamp' for a column
 name.

I just demonstrated a concept. The guy has to do this the best way he can ;-)
It's not a do-my-work-while-i'm-taking-a-rest mailing-list ;-)

 It is generally not a good idea to use reserved words for column names.

 --
 Tom Crimmins
 Interface Specialist
 Pottawattamie County, Iowa

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpny01c5V0WE.pgp
Description: PGP signature


Re: [PHP] Re: mailing lists

2005-04-19 Thread Clive Zagno
Hi
i should of added, that it shoud preferable be free and opensource.
I found these guys http://www.webinsta.com  seem to be what i want, 
unless anyones got some comments.

clive
Mike Hummel wrote:
Sonic Mail Pro is very usable, and very easy to setup.
I have some very non-technical clients using it effectively.
http://www.sensationdesigns.com/products/scripts/smpro/index.php

Clive Zagno wrote:
Hi
does anyone use any cool php mailing list software.
clive

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] foreach sorting

2005-04-19 Thread Sebastian
when the if statement is true how do i make it appear as the last record in
the loop?

$tabarray = array('/games' = 'Games', '/news' = 'News');

 foreach ($tabarray AS $loc = $item)
 {
  if(strpos($loc, $_SERVER['REQUEST_URI']) !== false)
  {
   $tabmenulist .= 'td class=tabsela href='.$loc.''.$item.'/a/td
  }
  else
  {
   $tabmenulist .= 'td class=tabdela href='.$loc.''.$item.'/a/td
  }
 }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] get_parent_class-certification

2005-04-19 Thread blackwater dev
Hello,

Running this code in Zend studio returns string(3) mom;

class grandparent{
};
class mom extends grandparent{
};
class son extends mom{
};

echo var_dump(get_parent_class(son));

However, the Zend certification book has a question like this and says
it should return grandparent...which is correct?

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: mailing lists

2005-04-19 Thread pete M
check out
hotscripts.com
Clive Zagno wrote:
Hi
does anyone use any cool php mailing list software.
clive
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] foreach sorting

2005-04-19 Thread Philip Hallstrom
when the if statement is true how do i make it appear as the last record in
the loop?
$tabarray = array('/games' = 'Games', '/news' = 'News');
foreach ($tabarray AS $loc = $item)
{
 if(strpos($loc, $_SERVER['REQUEST_URI']) !== false)
 {
  $tabmenulist .= 'td class=tabsela href='.$loc.''.$item.'/a/td
 }
 else
 {
  $tabmenulist .= 'td class=tabdela href='.$loc.''.$item.'/a/td
 }
}
this should work if I understand you correctly...
$tabarray = array('/games' = 'Games', '/news' = 'News');
foreach ($tabarray AS $loc = $item)
{
 if(strpos($loc, $_SERVER['REQUEST_URI']) !== false)
 {
  $last_tabmenulist = 'td class=tabsela href='.$loc.''.$item.'/a/td
 }
 else
 {
  $tabmenulist .= 'td class=tabdela href='.$loc.''.$item.'/a/td
 }
}
$tabmenulist .= $last_tabmenulist;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Sessions - going back in browser

2005-04-19 Thread Craig Donnelly
Hello,

I had an issue that I needed to be able to go back in the browser while in a
session without getting page has expired, I was reading through the manual
and came across a comment about adding the following to the sessions page to
allow users to traverse back:

header(Cache-control: private);
(http://www.php.net/manual/en/function.session-start.php)

This works fine on a Win32 dev box running Apache 1.3.x and PHP 5.0.3, but
then I loaded the pages onto a RedHat box running PHP 5.0.3 on Apache
1.3.27.  This box is running these pages through SSl (https)

Anyone any ideas?

Regards,
Craig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re:^^

2005-04-19 Thread Craig Donnelly

So now the page expires

Any help appreciated.

Craig Donnelly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I had an issue that I needed to be able to go back in the browser while in
a
 session without getting page has expired, I was reading through the
manual
 and came across a comment about adding the following to the sessions page
to
 allow users to traverse back:

 header(Cache-control: private);
 (http://www.php.net/manual/en/function.session-start.php)

 This works fine on a Win32 dev box running Apache 1.3.x and PHP 5.0.3, but
 then I loaded the pages onto a RedHat box running PHP 5.0.3 on Apache
 1.3.27.  This box is running these pages through SSl (https)

 Anyone any ideas?

 Regards,
 Craig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sessions - going back in browser

2005-04-19 Thread Greg Donald
On 4/19/05, Craig Donnelly [EMAIL PROTECTED] wrote:
 I had an issue that I needed to be able to go back in the browser while in a
 session without getting page has expired, I was reading through the manual
 and came across a comment about adding the following to the sessions page to
 allow users to traverse back:

The browser back button doesn't make PHP sessions expire.  It's more
likely your session id is simply being lost when you go back to the
page where you just did a form post.

You might try transparent sessions so you no longer have to pass a
session id around:

ini_set( 'session.use_trans_sid', 1 );

This works great until you get to where you need multiple load
balanced web servers.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] post redirect

2005-04-19 Thread jem777
If I submit a post and then, serverside, I redirect the request to another
page, do the post variables still live in the new page?

Thanks,
Jem777

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] post redirect

2005-04-19 Thread John Nichel
jem777 wrote:
If I submit a post and then, serverside, I redirect the request to another
page, do the post variables still live in the new page?
Thanks,
Jem777
Try it.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] post redirect

2005-04-19 Thread jem777
Thanks, but I need to know the php behaviour indipendently from my web
server.

John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 jem777 wrote:
  If I submit a post and then, serverside, I redirect the request to
another
  page, do the post variables still live in the new page?
 
  Thanks,
  Jem777
 

 Try it.

 -- 
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Last visitors (SOLVED?)

2005-04-19 Thread Christopher Fulton
 I did, the problem is the client is on a box with mySql 3.23.x or 4.0.x, he
 is deciding to upgrade to a dedicated box but then the host he is looking at
 says they will charge him if they are to upgrade to mysql 4.1 (hence i cant
 even use sub-selects)
 (Sorry I didnt mention the MySql version before...didnt think it was
 important till now)

The MySQL version should not matter for what he was saying (you don't
need subqueries).  I think he was saying that every time you insert a
user, also insert 10 records into the users profile_viewed_log. with
an empty timestamp.  Then, every time someone views the profile,
update the profile_viewed_log, instead of inserting into it.  (which
can be done with a simple query...)
$SQL = UPDATE profile_log SET user_id=.$userId.,
date_entered='1113931530' WHERE profile_id=.
$profileId. ORDER BY date_entered ASC LIMIT 1;

(the date i have is a unix timestamp, but you can use whatever format
you wish).

I havn't tested that query, but it should work with no problem. 
Basically, it just updates the first record with the smallest
timestamp.

Then, when you want to show the user the views for his/her profile, 
you just exclude the one's with an empty timestamp.

Your other option, which also would work well, would be to do the cron
job, with a limit value on the query.  IMHO this is better than 3
queries every time someone views a profile.  Also, you can set the
cron job to run at 3AM, when there are not likely to be many users.

Hope this helps some.

-Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] post redirect

2005-04-19 Thread Jay Blanchard
[snip]
If I submit a post and then, serverside, I redirect the request to
another
page, do the post variables still live in the new page?
[/snip]

Nope.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] set cookie function problem

2005-04-19 Thread Ospinto
Hi,
Can someone help me with this problem?
setcookie('myCookie',blah);
works fine. but when i try to set it with an expiry time, it doesn't.
setcookie('myCookie',blah,time()+3600);

I have cookies enabled on my browser of course. And the way I know the
second statement is not working is cos I'm doing a var_dump of $_COOKIES.
Thanks for your help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] set cookie function problem

2005-04-19 Thread Marek Kilimajer
Ospinto wrote:
Hi,
Can someone help me with this problem?
setcookie('myCookie',blah);
works fine. but when i try to set it with an expiry time, it doesn't.
setcookie('myCookie',blah,time()+3600);
I have cookies enabled on my browser of course. And the way I know the
second statement is not working is cos I'm doing a var_dump of $_COOKIES.
Thanks for your help.
Fix the timezone on your computer. It's 20:25 here and your message 
will arrive in my mailbox at 23:20.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] set cookie function problem

2005-04-19 Thread Ospinto
ok...what does that have to do with my problem?

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Ospinto wrote:
  Hi,
  Can someone help me with this problem?
  setcookie('myCookie',blah);
  works fine. but when i try to set it with an expiry time, it doesn't.
  setcookie('myCookie',blah,time()+3600);
 
  I have cookies enabled on my browser of course. And the way I know the
  second statement is not working is cos I'm doing a var_dump of
$_COOKIES.
  Thanks for your help.
 

 Fix the timezone on your computer. It's 20:25 here and your message
 will arrive in my mailbox at 23:20.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] set cookie function problem

2005-04-19 Thread Stephen Johnson
Nothing -- 

However - try adding a path to your cookie statement.  It may not be the
problem - but it has corrected this issue for me in the past.

I.e :
setcookie('myCookie',blah,time()+3600, /);

?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Ospinto [EMAIL PROTECTED]
 Date: Tue, 19 Apr 2005 17:33:07 -0400
 To: php-general@lists.php.net
 Subject: Re: [PHP] set cookie function problem
 
 ok...what does that have to do with my problem?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] set cookie function problem

2005-04-19 Thread Marek Kilimajer
Ospinto wrote:
ok...what does that have to do with my problem?
The time is send in GMT, and your computer is set to GMT -7. So the 
cookie is set to expire in the past.

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Ospinto wrote:
Hi,
Can someone help me with this problem?
setcookie('myCookie',blah);
works fine. but when i try to set it with an expiry time, it doesn't.
setcookie('myCookie',blah,time()+3600);
I have cookies enabled on my browser of course. And the way I know the
second statement is not working is cos I'm doing a var_dump of
$_COOKIES.
Thanks for your help.
Fix the timezone on your computer. It's 20:25 here and your message
will arrive in my mailbox at 23:20.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] explode a string

2005-04-19 Thread Jochem Maas
Petar Nedyalkov wrote:
On Tuesday 19 April 2005 17:03, Jochem Maas wrote:
Richard Lynch wrote:
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';
$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
 list($id, $cat) = explode(':', $idcat);
 echo \$id = $idbr /\n;
 echo \$cat = $catbr /\n;
}
The 'other' guy mentioned that while() is faster than foreach,
is this true?

sorry to call you the 'other' guy, Petar - I was being lazy.
http://www.sitepoint.com/article/php5-standard-library
Note that the crude benchmarks I've performed suggest that calling the 
methods directly is faster than using foreach, because the latter introduces 
another layer of redirection that must be resolved at runtime by PHP.
are we talking about iterating over an Iterator or an array()?
Harry Fuecks is talking about iterating over a php5 object..., your
question/example features a straight array.

I read a few days ago somewhere on php.net that foreach() is the
recommended (by php devs) way of iterating over arrays
also, compare these 2 lines:
while (list(, $idcat) = each($idcats)){ /* ... */ }
foreach ($idcats as $idcat){ /* ... */ }
now its seems to me that the foreach version is 'up' 2 function calls
on the while loop, all else being equal the foreach loop has to be faster
(given that calling functions is relatively very expensive)...
or is foreach() _really_ heavy when compared to while()?
not that I care too much, I find foreach() more pleasing to the eye and
there is less to type (in the given example).
:-)
rgds,
Jochem

what is the best way to explode then loop this string after its taken
apart.
output should be something like:
$id = 4
$cat = gaming
etc..
im just looking for the best/fastest way to do this. the string can grow
to
200 or so bytes, maybe more.
200 bytes is chump-change.
It really doesn't matter how you do this, within reason.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Sorting table columns dynamically on normalized MySQL tables

2005-04-19 Thread Leif Gregory
Hello php-general,

I've been wrestling with this one for a bit and wanted to see if
anyone had a nice magic bullet (yeah right) to do this.

Let's just keep it simple (my DB is a bit more complex).

We have a DB called Courses with three tables.

Instructors -
  id
  name

Locations
  id
  name

Course -
  id
  name
  instructorID - From Instructors table
  locationID - From Locations table


So let's put in some data

Instructors -

id   name
1Bill
2Dave
3Jessica


Locations -

id   name
1Middle School
2High School
3Elementary School


Course -

id   name instructorID   locationID
1Basket Weaving2 2
2Math  2 1
3Science   1 3
4Biology   3 1


Just in case, I'm actually dealing with three more tables, so I don't
think doing weird joins will work, but I'm trying to keep this simple.
Further, the instructors table actually has six fields, the Locations
table has four fields. Those extra fields are descriptive pieces for
each, i.e. phone numbers, e-mail address, office number, address etc
for each instructor.

Now, I want to display all the courses and have the names instead of
id numbers show up, so I'd select from Courses and output that.

course   instructor   location
Basket Weaving   Dave High School
Math Dave Middle School
Science  Bill Elementary School
Biology  Jessica  Middle School


I've done this by building arrays previous to doing the select on
Course and in the While loop to list the courses pull the name from
the instructors array and locations array based on the matching id.

It works fine. No problem. I then got a requirement that stated they
wanted to be able to sort alphabetically ascending on the following
columns: course, instructor, location

So I built in the ability to do that using a self referencing
hyperlink on the column name with a variable for the column name they
wanted to sort on, and then used that in my SELECT statement to ORDER
BY on the column they chose ASC.

This works just fine too. Here's where the problem is.

Since the DB is normalized, it's sorting by the ID number which has no
relation to being sorted alphabetically.

i.e. If they sort on Location, they get the records back like this

course   instructor   location
Math Dave Middle School
Biology  Jessica  Middle School
Basket Weaving   Dave High School
Science  Bill Elementary School

Because Middle is id 1, High is id 2, and Elementary is id 3.

That's not what they want obviously.

So far the only thing I've come up with is to build an array of course
records in which I replace the ids with the corresponding names, then
sort the array based on the sort order the user wants, then loop
through the array to show the courses to them.

I can do that, but is there a better way? How do you all handle
dynamic sorting of normalized DBs?

How I got into this mess was by trying to do the right thing and
normalize my DB. It wasn't until they threw the sorting deal at me
that I realized I probably should have used the instructor name and
location name in the Course.instructorID and Course.locationID fields.
It would have saved me some grief, but part of the problem is that the
location name can be something like this:

Rio Bravo Elementary School

and it didn't seem right to me at the time to use that as the id in
the Course table for Location.

At any rate, just looking for some ideas.


Thanks.


Tagline of the day:
Small town sign: Speed Limit 15 MPH: Our kids can't run any faster.



-- 
Leif Gregory
Development Supervisor
Licensing, Regulation and Small Projects Section
Application Development and Support Bureau
Information Technology Services Division
Runnels Building S3407
V: 505.827.2748
F: 505.827.2695

The Information Technology Services Division leads
the State of New Mexico in customer-focused IT services
as it supports the Department of Health in building
a healthy New Mexico.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sorting table columns dynamically on normalized MySQL tables

2005-04-19 Thread Chris Boget
 I can do that, but is there a better way? How do you all handle
 dynamic sorting of normalized DBs?

Firstly, what DB are you using?
Secondly, just select and sort on the columns.  An example query
would be:

SELECT
  course.name,
  location.name,
  instructor.name
FROM
  course
INNER JOIN location ON location.id = course.locationID
INNER JOIN instructor ON instructor.id = course.instroctorID
ORDER BY instructor.name

(or location.name or course.name).

It should be as simple as that...

thnx,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Sorting table columns dynamically on normalized MySQL tables

2005-04-19 Thread Jay Blanchard
[snip]
I can do that, but is there a better way? How do you all handle
dynamic sorting of normalized DBs?
[/snip]

Normalization has no effect on sort order where any DB is concerned.
Sort order is determined in the sort clause in the query. So if you want
to sort by location and you are using MySQL  your ORDER BY clause should
be location(regardless of joins)

SELECT foo
FROM bar
ORDER BY location

returns

course   instructor   location
Science  Bill Elementary School
Basket Weaving   Dave High School
Math Dave Middle School
Biology  Jessica  Middle School

The results with course as the sort qualifier

course   instructor   location
Basket Weaving   Dave High School
Biology  Jessica  Middle School
Math Dave Middle School
Science  Bill Elementary School

You have over-compicated a simple issue

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] can I join two mp3 files with php

2005-04-19 Thread QT
dear sir,

any idea how can I join two mp3 file with php

best regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] can I join two mp3 files with php

2005-04-19 Thread Jay Blanchard
[snip]
any idea how can I join two mp3 file with php
[/snip]

if(!function_exists('file_put_contents')) {
  function file_put_contents($filename, $data, $file_append = false) {
   $fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
   if(!$fp) {
 trigger_error('file_put_contents cannot write in file.',
E_USER_ERROR);
 return;
   }
   fputs($fp, $data);
   fclose($fp);
  }
} 

$bar = file_get_contents(2.mp3);
file_put_contents(1.mp3, $bar, true);

But I don't think that this will work the way that you would expect it
to.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Dasmeet Singh
Hi!
When i try to run the following line:
echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br 
Property Type- $ptypebrMin Price- $row[9] /div);

it gives an error..
Parse error: parse error, unexpected T_CLASS in 
/home/real/public_html/functions.php on line 162

Any idea..why? Probably any stupid mistake .. :(
-
Free Website Promotion - A Complete Guide
http://hostwindow.info/web-hosting/9/free-website-promotion/1/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Marek Kilimajer
Dasmeet Singh wrote:
Hi!
When i try to run the following line:
echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br 
Property Type- $ptypebrMin Price- $row[9] /div);
The above line is fine. Check the lines above.

it gives an error..
Parse error: parse error, unexpected T_CLASS in 
/home/real/public_html/functions.php on line 162

Any idea..why? Probably any stupid mistake .. :(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Jay Blanchard
[snip]
echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br 
Property Type- $ptypebrMin Price- $row[9] /div);

it gives an error..

Parse error: parse error, unexpected T_CLASS in 
/home/real/public_html/functions.php on line 162

Any idea..why? Probably any stupid mistake .. :(
[/snip]

Takes the parentheses out.

echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br 
Property Type- $ptypebrMin Price- $row[9] /div;

From http://www.php.net/echo echo() is not actually a function (it is a
language construct) so you are not required to use parentheses with it.
In fact, if you want to pass more than one parameter to echo, you must
not enclose the parameters within parentheses.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Dasmeet Singh
Jay Blanchard wrote:
 [snip]
 echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br
 Property Type- $ptypebrMin Price- $row[9] /div);

 it gives an error..

 Parse error: parse error, unexpected T_CLASS in
 /home/real/public_html/functions.php on line 162

 Any idea..why? Probably any stupid mistake .. :(
 [/snip]

 Takes the parentheses out.

 echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br
 Property Type- $ptypebrMin Price- $row[9] /div;

 From http://www.php.net/echo echo() is not actually a function (it is a
 language construct) so you are not required to use parentheses with it.
 In fact, if you want to pass more than one parameter to echo, you must
 not enclose the parameters within parentheses.
Removed the ()..still the same error :(.. am copying complete 
function..if its because of something else...

function showProperty($filter, $by, $value)
{
if($filter==true)
   {
   $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' 
ORDER BY DateAdded DESC;

   }
else
  {
   $query=SELECT * FROM `Property`ORDER BY DateAdded DESC;
  }
$result=db_query($query);
while($row=mysql_fetch_row($result))
  {
$ptype= getName('propertyTypes', 'id', $row[8] , 'Name');
echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br 
Property Type- $ptypebrMin Price- $row[9] /div;
}
}

-
Free Website Promotion - A Complete Guide
http://hostwindow.info/web-hosting/9/free-website-promotion/1/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Marek Kilimajer
Dasmeet Singh wrote:
Jay Blanchard wrote:
  [snip]
  echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br
  Property Type- $ptypebrMin Price- $row[9] /div);
 
  it gives an error..
 
  Parse error: parse error, unexpected T_CLASS in
  /home/real/public_html/functions.php on line 162
 
  Any idea..why? Probably any stupid mistake .. :(
  [/snip]
 
  Takes the parentheses out.
 
  echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br
  Property Type- $ptypebrMin Price- $row[9] /div;
 
  From http://www.php.net/echo echo() is not actually a function (it is a
  language construct) so you are not required to use parentheses with it.
  In fact, if you want to pass more than one parameter to echo, you must
  not enclose the parameters within parentheses.
Removed the ()..still the same error :(.. am copying complete 
function..if its because of something else...

function showProperty($filter, $by, $value)
{
if($filter==true)
   {
   $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' 
ORDER BY DateAdded DESC;

   }
else
  {
   $query=SELECT * FROM `Property`ORDER BY DateAdded DESC;
^
missing double quote.
Get some decent editor with syntax highlighting
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Dasmeet Singh
Marek Kilimajer wrote:
Dasmeet Singh wrote:
Jay Blanchard wrote:
  [snip]
  echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br
  Property Type- $ptypebrMin Price- $row[9] /div);
 
  it gives an error..
 
  Parse error: parse error, unexpected T_CLASS in
  /home/real/public_html/functions.php on line 162
 
  Any idea..why? Probably any stupid mistake .. :(
  [/snip]
 
  Takes the parentheses out.
 
  echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br
  Property Type- $ptypebrMin Price- $row[9] /div;
 
  From http://www.php.net/echo echo() is not actually a function (it 
is a
  language construct) so you are not required to use parentheses with 
it.
  In fact, if you want to pass more than one parameter to echo, you must
  not enclose the parameters within parentheses.

Removed the ()..still the same error :(.. am copying complete 
function..if its because of something else...

function showProperty($filter, $by, $value)
{
if($filter==true)
   {
   $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' 
ORDER BY DateAdded DESC;

   }
else
  {
   $query=SELECT * FROM `Property`ORDER BY DateAdded DESC;

^
missing double quote.
Get some decent editor with syntax highlighting
Thanks.. That was really silly..
BTW.. pls suggest some good editor.. I use notepad currently..
-
Free Website Promotion - A Complete Guide
http://hostwindow.info/web-hosting/9/free-website-promotion/1/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected T_CLASS

2005-04-19 Thread Jason Barnett
Dasmeet Singh wrote:
 Jay Blanchard wrote:
 [snip]
 echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br
 Property Type- $ptypebrMin Price- $row[9] /div);

 it gives an error..

 Parse error: parse error, unexpected T_CLASS in
 /home/real/public_html/functions.php on line 162

 Any idea..why? Probably any stupid mistake .. :(
 [/snip]

 Takes the parentheses out.

 echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br
 Property Type- $ptypebrMin Price- $row[9] /div;

 From http://www.php.net/echo echo() is not actually a function (it is a
 language construct) so you are not required to use parentheses with it.
 In fact, if you want to pass more than one parameter to echo, you must
 not enclose the parameters within parentheses.


 Removed the ()..still the same error :(.. am copying complete
 function..if its because of something else...

 function showProperty($filter, $by, $value)
 {
 if($filter==true)
{
$query=SELECT * FROM `Property` WHERE .$by. = '.$value.'
 ORDER BY DateAdded DESC;

}
 else
   {
$query=SELECT * FROM `Property`ORDER BY DateAdded DESC;

Missing the ending  above.  So this line would be:
$query=SELECT * FROM `Property`ORDER BY DateAdded DESC;

   }

 $result=db_query($query);
 while($row=mysql_fetch_row($result))
   {
 $ptype= getName('propertyTypes', 'id', $row[8] , 'Name');
 echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br

PHP thinks this is the ENDING  instead of the BEGINNING .  So when the
parser reaches the text that says div class it is trying to interpret
that instead of treating it like a string.  Fix the quote error above
and all should be fine.

 Property Type- $ptypebrMin Price- $row[9] /div;
 }
 }

 -
 Free Website Promotion - A Complete Guide
 http://hostwindow.info/web-hosting/9/free-website-promotion/1/


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] can I join two mp3 files with php

2005-04-19 Thread QT
hi,

is it easy like this, I tried and works good. Shouldn't I need to handle
something inside mp3? just easy to put each file together in the another
file?

Best Regards


Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
any idea how can I join two mp3 file with php
[/snip]

if(!function_exists('file_put_contents')) {
  function file_put_contents($filename, $data, $file_append = false) {
   $fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
   if(!$fp) {
 trigger_error('file_put_contents cannot write in file.',
E_USER_ERROR);
 return;
   }
   fputs($fp, $data);
   fclose($fp);
  }
}

$bar = file_get_contents(2.mp3);
file_put_contents(1.mp3, $bar, true);

But I don't think that this will work the way that you would expect it
to.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mp3 convert to amr

2005-04-19 Thread QT
dear sirs,

how can I convert mp3 to amr with php? any document source?

best regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can I join two mp3 files with php

2005-04-19 Thread QT
thank you very much

it works with mp3 good. But when I try with amr, it doenst work. I think
first amr files put some time limit and player stop at time limit. Now I am
looking to find how can I convert mp3 to amr. Because I need to have amr
file at the end

best regards
Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
any idea how can I join two mp3 file with php
[/snip]

if(!function_exists('file_put_contents')) {
  function file_put_contents($filename, $data, $file_append = false) {
   $fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
   if(!$fp) {
 trigger_error('file_put_contents cannot write in file.',
E_USER_ERROR);
 return;
   }
   fputs($fp, $data);
   fclose($fp);
  }
}

$bar = file_get_contents(2.mp3);
file_put_contents(1.mp3, $bar, true);

But I don't think that this will work the way that you would expect it
to.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mp3 convert to amr

2005-04-19 Thread Jay Blanchard
[snip]
how can I convert mp3 to amr with php? any document source?
[/snip]

You cannot with PHP, you will need to search for AMR converters on
google

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can I join two mp3 files with php

2005-04-19 Thread Marek Kilimajer
QT wrote:
thank you very much
it works with mp3 good. But when I try with amr, it doenst work. I think
first amr files put some time limit and player stop at time limit. Now I am
looking to find how can I convert mp3 to amr. Because I need to have amr
file at the end
The mp3 file is technicaly broken, but fortunately for you mp3 files are 
self-synchronizing streams

There is no php mp3 to amr converter, but search for something you can 
execute from php. google for mp3 to amr and wav to amr

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] post redirect

2005-04-19 Thread Marek Kilimajer
jem777 wrote:
Thanks, but I need to know the php behaviour indipendently from my web
server.
It's independent.
John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
jem777 wrote:
If I submit a post and then, serverside, I redirect the request to
another
page, do the post variables still live in the new page?
Thanks,
Jem777
Try it.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] can I join two mp3 files with php

2005-04-19 Thread QT
I found an exe file, can I run that ms-dos exe file on linux machine with
php?

I didn't try anything like this before

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 QT wrote:
  thank you very much
 
  it works with mp3 good. But when I try with amr, it doenst work. I think
  first amr files put some time limit and player stop at time limit. Now I
am
  looking to find how can I convert mp3 to amr. Because I need to have amr
  file at the end

 The mp3 file is technicaly broken, but fortunately for you mp3 files are
 self-synchronizing streams

 There is no php mp3 to amr converter, but search for something you can
 execute from php. google for mp3 to amr and wav to amr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Session variables are not stored when set in implicitly calledconstructor!??

2005-04-19 Thread Adam
Hallo again,
thank You for Your response.

 
  // singleton for request
  class Request {
  function __destructor() {
  $_SESSION[variable] = hallo;

 The __destructor() method is supposed to be about killing the class
 (Request).  It's probably bad practice to be changing $_SESSION vars
 inside of there even if that $_SESSION var affects your class.  Here,
 read this page and maybe it will make more sense to you:
 http://php.net/manual/en/language.oop5.decon.php

i agree that in *most* cases destructor should only clean up after object.
unfortunatly for request class there are few requirements:
1) must allow immidiate use w/o any explicit initialization or finalizaion.
e.g. at any file You can use only Request::getInstance()-isRefresh() /**
test if this request was caused by browser refresh */. this should be one
and only line (except for inclusion of request.php oc) referencing request
class -- no explicit call to Request::saveToSession() or anything ugly and
potentialy disastrous like that.
2) must provide mechanism for generating per session uniqe request
identiers. now implemented as md5($_SESSION[next_reqest_id]++) not very
effective but handy:-P
3) must be serializable (this is why i can not put that session manipulation
at __sleep function)

these requirements (1,3) cast out __destruct, __sleep and explicit call to
some saveToSession function. do You have any other idea when to store this
information , please?

 Heck, look at the user contributed notes since one of them will directly
 affect this idea of yours.

*doh* i don't know how could i coverlooke taht user reaction:-( thank You.

 If the reference count for $req is greater than 0 (i.e. there is a
 Singleton) then __destruct won't be called.  And why should it be
 called?  Because, again, __destruct is for cleaning up the class while
 the object is getting destroyed.

Isn't __destruct is called even if reference count is gr then zero as a part
of script finalization? imo yes -- i tried this with echoing something
within singletons destructor (no invoke with explicit delete:-) and it
worked.


BR
a3c


- Original Messages - 
 Hallo everybody,
 hope I am writing to correct mailinglist(^_^*)...

Absolutely!

 I have troubles with sessions and descructor in php5. Can not set session
 variable in destructor when it's called implicitly. Do You know solution
 please?
 I think problem is that session is stored before imlicit object
destruction
 *doh*

 example.php:
 ?php
 session_start();
 session_register(variable);

*Note* You don't need to use session_register() if you use $_SESSION.
In fact this probably isn't even doing what you think it is.  Using
$_SESSION indexes is the preferred way to go about using sessions.


 // singleton for request
 class Request {
 function __destructor() {
 $_SESSION[variable] = hallo;

The __destructor() method is supposed to be about killing the class
(Request).  It's probably bad practice to be changing $_SESSION vars
inside of there even if that $_SESSION var affects your class.  Here,
read this page and maybe it will make more sense to you:
http://php.net/manual/en/language.oop5.decon.php
Heck, look at the user contributed notes since one of them will directly
affect this idea of yours.

 }
 }

 $req = Request::getInstance();
 $req-doSomeThink();
 echo This should be hallo 2nd time:  . $_SESSION[variable];//
 unfortunatly this is not set
 echo  a href='example.php'Click and cry;-(/a;
 // implicit desturctor call

If the reference count for $req is greater than 0 (i.e. there is a
Singleton) then __destruct won't be called.  And why should it be
called?  Because, again, __destruct is for cleaning up the class while
the object is getting destroyed.

 ?


smime.p7s
Description: S/MIME cryptographic signature


Re: [PHP] can I join two mp3 files with php

2005-04-19 Thread Marek Kilimajer
QT wrote:
I found an exe file, can I run that ms-dos exe file on linux machine with
php?
I didn't try anything like this before
First, check if it's really for ms-dos. Command line does not mean 
ms-dos, it can be a WIN32 command line binary.

If it's really ms-dos executable, use dosemu. If it's WIN32 binary, try 
wine.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >