OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 19 Apr 2005 21:20:25 -0000 Issue 3407

php-general-digest-helplists.php.net
Date: Tue Apr 19 2005 - 16:20:25 CDT


php-general Digest 19 Apr 2005 21:20:25 -0000 Issue 3407

Topics (messages 213328 through 213426):

Links exchange with http://php-faq.com.
        213328 by: Ann Clark

Re: upload automatic execute
        213329 by: Petar Nedyalkov

email through PHP
        213330 by: Balwant Singh
        213334 by: Ken
        213335 by: Balwant Singh
        213339 by: Angelo Zanetti
        213343 by: pete M
        213344 by: Balwant Singh
        213347 by: pete M

Re: php output fills apache buffer for clients with slow internet connections
        213331 by: Marek Kilimajer

Re: Links exchange with http://php-faq.com. OT - SPAM
        213332 by: Mattias Thorslund

Re: php output fills apache buffer for clients with slow internet
        213333 by: Martin Mandl

Re: Single SQL-statement in PHP to order...
        213336 by: Jared Williams

.htaccess
        213337 by: pete M
        213338 by: Mario de Frutos Dieguez
        213345 by: Martin Mandl
        213346 by: Martin Mandl

Convert gif to jpg
        213340 by: Roman Duriancik
        213342 by: Petar Nedyalkov

Re: mysql blob datatype for documents
        213341 by: Mark Rees

Last visitors
        213348 by: Ryan A
        213349 by: Ken
        213350 by: Ryan A
        213351 by: Petar Nedyalkov
        213352 by: Ken
        213353 by: Ryan A
        213354 by: Mark Rees
        213355 by: Duncan Hill
        213356 by: Ryan A
        213357 by: Ken
        213358 by: Ryan A
        213359 by: Ken
        213362 by: Ryan A
        213363 by: Petar Nedyalkov
        213368 by: John Nichel
        213369 by: Petar Nedyalkov
        213370 by: John Nichel
        213377 by: Tom Crimmins
        213382 by: Petar Nedyalkov

Re: Iv size incorrect
        213360 by: Mike Hummel
        213361 by: Mike Hummel

Re: Last visitors (SOLVED?)
        213364 by: Ryan A
        213365 by: Petar Nedyalkov
        213371 by: Mike Hummel
        213372 by: Ryan A
        213373 by: Mike Hummel
        213394 by: Christopher Fulton

Re: explode a string
        213366 by: Jochem Maas
        213367 by: Petar Nedyalkov
        213401 by: Jochem Maas

mailing lists
        213374 by: Clive Zagno
        213376 by: John Nichel
        213378 by: Mike Hummel
        213379 by: Mike Hummel
        213383 by: Clive Zagno
        213386 by: pete M

Images - Converting TIFF Format?
        213375 by: The Disguised Jedi
        213380 by: Mike Hummel
        213381 by: Mike Hummel

foreach sorting
        213384 by: Sebastian
        213387 by: Philip Hallstrom

get_parent_class-certification
        213385 by: blackwater dev

Sessions - going back in browser
        213388 by: Craig Donnelly
        213390 by: Greg Donald

Re:^^
        213389 by: Craig Donnelly

post & redirect
        213391 by: jem777
        213392 by: John Nichel
        213393 by: jem777
        213395 by: Jay Blanchard
        213422 by: Marek Kilimajer

set cookie function problem
        213396 by: Ospinto
        213397 by: Marek Kilimajer
        213398 by: Ospinto
        213399 by: Stephen Johnson
        213400 by: Marek Kilimajer

Sorting table columns dynamically on normalized MySQL tables
        213402 by: Leif Gregory
        213403 by: Chris Boget
        213404 by: Jay Blanchard

can I join two mp3 files with php
        213405 by: QT
        213406 by: Jay Blanchard
        213417 by: QT
        213419 by: QT
        213421 by: Marek Kilimajer
        213423 by: QT
        213425 by: Marek Kilimajer
        213426 by: QT

parse error, unexpected T_CLASS
        213407 by: Dasmeet Singh
        213408 by: Marek Kilimajer
        213409 by: Jay Blanchard
        213410 by: Dasmeet Singh
        213411 by: Dasmeet Singh
        213412 by: Marek Kilimajer
        213413 by: Dasmeet Singh
        213414 by: Jason Barnett
        213415 by: Jason Barnett

[OT] Editor
        213416 by: Jason Barnett

mp3 convert to amr
        213418 by: QT
        213420 by: Jay Blanchard

Re: Session variables are not stored when set in implicitly calledconstructor!??
        213424 by: Adam

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


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.

attached mail follows:


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZM/ZLT98C3rkVDYRAk9bAJ9+OU1uLqNfZkrdBCrANC5q49fSkwCgiOwq
+ZQgGn6dAfJOP9yxu6/fE8g=
=6r8H
-----END PGP SIGNATURE-----

attached mail follows:


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

attached mail follows:


On 19 Apr 2005 15:04:08 +0530, Balwant Singh <balwantsinghindoasian.com> 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...?

attached mail follows:


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 <balwantsinghindoasian.com> 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...?

attached mail follows:


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 = memyserver.com; 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 <balwantsinghindoasian.com> 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...?
>>
>>
>
>
>

attached mail follows:


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

attached mail follows:


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 = memyserver.com; 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 <balwantsinghindoasian.com> 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...?
> > >
> >
> >

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


> 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

attached mail follows:


> > 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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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");
>

attached mail follows:


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");
>>

attached mail follows:


Hello,
Is it possible to convert pictures in gif format to jpg format in php
script ?
Thank you for yours responses.
Roman

attached mail follows:


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZO9BLT98C3rkVDYRAu5JAKCilY2c/xRZ5zrv9d7fM+TxGK3XJACeKH5G
I4WJJs0tN1N0CQt3lTf9+PA=
=u2KZ
-----END PGP SIGNATURE-----

attached mail follows:


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:ceol-i-e.com] Sent: 19 April 2005 03:27 To: Bosky, Dave Cc: php-generallists.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 E&OE ********************************************************************** **********************************************************************

attached mail follows:


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 username....if 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

attached mail follows:


On 4/19/05, Ryan A <ryancoinpass.com> 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 username....if 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?

attached mail follows:


<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 username....if 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

attached mail follows:


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 username....if 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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZP/ILT98C3rkVDYRAq7aAJ49O7phJcIalMz6naYqGhqZeUBnRACcCDJm
EB8+pi9DTXEPQaF550Ea55c=
=PYXo
-----END PGP SIGNATURE-----

attached mail follows:


On 4/19/05, Ryan A <ryancoinpass.com> 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 username....if 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 :(.

attached mail follows:


> 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 you....but 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

attached mail follows:


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:ryancoinpass.com] Sent: 19 April 2005 14:27 To: kenkamgmail.com 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 you....but 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 E&OE ********************************************************************** **********************************************************************

attached mail follows:


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 you....but 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.

attached mail follows:


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

attached mail follows:


On 4/19/05, Ryan A <ryancoinpass.com> 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 you....but 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...

attached mail follows:


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

attached mail follows:


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 <ryancoinpass.com> 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
>
>

attached mail follows:


> 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

attached mail follows:


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 you....but 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 0000-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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZQspLT98C3rkVDYRAkLhAJ4gd+nJIH2XKVngj2vSZWCfLDW0GQCdF7ex
yzyp8Fey+C01PSGmOyvQV00=
=KuIZ
-----END PGP SIGNATURE-----

attached mail follows:


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 0000-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
johnkegworks.com

attached mail follows:


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
> > 0000-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
> johnkegworks.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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZRMfLT98C3rkVDYRAvqSAJwNqEHaHz28MZVh8I5AGRtly5gv9ACeJOHW
DrCfIWxad0AeBiDP8BDURxU=
=Bt9M
-----END PGP SIGNATURE-----

attached mail follows:


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
johnkegworks.com

attached mail follows:


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
>> 0000-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

attached mail follows:


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
> >> 0000-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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZR9zLT98C3rkVDYRAjyaAJ4hdDAYRSeLpsEHSuQmk0WyYD2NxACgpgWq
8lOl1ngFviTWk0Ql1465GUc=
=HFgt
-----END PGP SIGNATURE-----

attached mail follows:


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);
>

attached mail follows:


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);
>

attached mail follows:


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

attached mail follows:


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZQ8sLT98C3rkVDYRAkgRAJ9t5w7c0nMnta5g1j42qeTy9g0LiwCfeEps
GrLVQNh+7ivM7St3GORuA+0=
=6kAo
-----END PGP SIGNATURE-----

attached mail follows:


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
>
>
>

attached mail follows:


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 MySql....I 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

attached mail follows:


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
>
>
>

attached mail follows:


> 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

attached mail follows:


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 = $id<br />\n";
> echo "\$cat = $cat<br />\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.
>

attached mail follows:


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 = $id<br />\n";
> > echo "\$cat = $cat<br />\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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCZREWLT98C3rkVDYRAjAIAJoD+xO+mDVAUoqebIDRAjmFPNV+kwCbBlnv
rwdgIAPi1d8XdeETMOiI3JA=
=Ma4c
-----END PGP SIGNATURE-----

attached mail follows:


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 = $id<br />\n";
>>> echo "\$cat = $cat<br />\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.
>
>

attached mail follows:


Hi

does anyone use any cool php mailing list software.

clive

attached mail follows:


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
johnkegworks.com

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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
>
>

attached mail follows:


check out
hotscripts.com

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

attached mail follows:


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 fast....but
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
disguised.jedigmail.com

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

attached mail follows:


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 fast....but
> 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...
>

attached mail follows:


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 fast....but
> 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...
>

attached mail follows:


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="tabsel"><a href="'.$loc.'">'.$item.'</a></td>
  }
  else
  {
   $tabmenulist .= '<td class="tabdel"><a href="'.$loc.'">'.$item.'</a></td>
  }
 }

attached mail follows:


> 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="tabsel"><a href="'.$loc.'">'.$item.'</a></td>
> }
> else
> {
> $tabmenulist .= '<td class="tabdel"><a 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="tabsel"><a href="'.$loc.'">'.$item.'</a></td>
  }
  else
  {
   $tabmenulist .= '<td class="tabdel"><a href="'.$loc.'">'.$item.'</a></td>
  }
}

$tabmenulist .= $last_tabmenulist;

attached mail follows:


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!

attached mail follows:


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

attached mail follows:


On 4/19/05, Craig Donnelly <craigdeconstructor.net> 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/

attached mail follows:


So now the page "expires"

Any help appreciated.

"Craig Donnelly" <craigdeconstructor.net> wrote in message
news:20050419162627.98943.qmaillists.php.net...
> 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

attached mail follows:


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

attached mail follows:


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
johnkegworks.com

attached mail follows:


Thanks, but I need to know the php behaviour indipendently from my web
server.

"John Nichel" <johnkegworks.com> wrote in message
news:42653C1B.1000101kegworks.com...
> 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
> johnkegworks.com

attached mail follows:


[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.

attached mail follows:


jem777 wrote:
> Thanks, but I need to know the php behaviour indipendently from my web
> server.

It's independent.

>
> "John Nichel" <johnkegworks.com> wrote in message
> news:42653C1B.1000101kegworks.com...
>
>>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
>>johnkegworks.com
>
>

attached mail follows:


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.

attached mail follows:


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.

attached mail follows:


o....k.......what does that have to do with my problem?

"Marek Kilimajer" <listskilimajer.net> wrote in message
news:42654D30.30500kilimajer.net...
> 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.

attached mail follows:


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
stephenthelonecoder.com

562.924.4454 (office)
562.924.4075 (fax)

continuing the struggle against bad code

*/
?>

> From: "Ospinto" <ospintohotmail.com>
> Date: Tue, 19 Apr 2005 17:33:07 -0400
> To: php-generallists.php.net
> Subject: Re: [PHP] set cookie function problem
>
> o....k.......what does that have to do with my problem?

attached mail follows:


Ospinto wrote:
> o....k.......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" <listskilimajer.net> wrote in message
> news:42654D30.30500kilimajer.net...
>
>>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.
>
>

attached mail follows:


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
1 Bill
2 Dave
3 Jessica

Locations -

id name
1 Middle School
2 High School
3 Elementary School

Course -

id name instructorID locationID
1 Basket Weaving 2 2
2 Math 2 1
3 Science 1 3
4 Biology 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.

attached mail follows:


> 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

attached mail follows:


[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

attached mail follows:


dear sir,

any idea how can I join two mp3 file with php

best regards

attached mail follows:


[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.

attached mail follows:


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" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B0430C7F3nemesis...
[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.

attached mail follows:


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" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B0430C7F3nemesis...
[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.

attached mail follows:


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"

attached mail follows:


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" <listskilimajer.net> wrote in message
news:42656CB7.6000204kilimajer.net...
> 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"

attached mail follows:


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.

attached mail follows:


thank you very much I will try

"Marek Kilimajer" <listskilimajer.net> wrote in message
news:42657302.8030400kilimajer.net...
> 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.

attached mail follows:


Hi!
When i try to run the following line:

echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
Property Type- $ptype<br>Min 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/

attached mail follows:


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- $ptype<br>Min 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 .. :(

attached mail follows:


[snip]
echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
Property Type- $ptype<br>Min 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- $ptype<br>Min 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."

attached mail follows:


Jay Blanchard wrote:
> [snip]
> echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
> Property Type- $ptype<br>Min 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- $ptype<br>Min 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- $ptype<br>Min Price- $row[9] </div>";
}
}

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

attached mail follows:


Jay Blanchard wrote:
> [snip]
> echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
> Property Type- $ptype<br>Min 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- $ptype<br>Min 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- $ptype<br>Min Price- $row[9] </div>";
}
}

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

attached mail follows:


Dasmeet Singh wrote:
> Jay Blanchard wrote:
> > [snip]
> > echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
> > Property Type- $ptype<br>Min 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- $ptype<br>Min 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

attached mail follows:


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- $ptype<br>Min 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- $ptype<br>Min 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/

attached mail follows:


Dasmeet Singh wrote:
> Jay Blanchard wrote:
>> [snip]
>> echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
>> Property Type- $ptype<br>Min 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- $ptype<br>Min 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- $ptype<br>Min 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-general&w=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=PHP&submitform=Find+search+plugins

attached mail follows:


Dasmeet Singh wrote:
> Jay Blanchard wrote:
>> [snip]
>> echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
>> Property Type- $ptype<br>Min 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- $ptype<br>Min 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- $ptype<br>Min 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-general&w=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=PHP&submitform=Find+search+plugins

attached mail follows:


Dasmeet Singh wrote:
...
>>
>> 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/

vim has a high learning curve, but it's free and quite good. It is also
available for Windows if that's an issue for you.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=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=PHP&submitform=Find+search+plugins

attached mail follows:


dear sirs,

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

best regards

attached mail follows:


[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

attached mail follows:


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.

> ?>