php-general Digest 2 Mar 2004 11:41:41 -0000 Issue 2622

Topics (messages 179195 through 179225):

IE6 with latest hotfixes breaks forms ...
        179195 by: Marc G. Fournier
        179196 by: Chris Shiflett
        179198 by: Marc G. Fournier
        179199 by: Chris Shiflett
        179201 by: Beau Hartshorne
        179202 by: Marc G. Fournier
        179209 by: Chris Shiflett
        179210 by: Richard Davey
        179217 by: Ford, Mike               [LSS]

Re: FTP alternative to copy() ?
        179197 by: Raditha Dissanayake
        179212 by: raisinlove
        179213 by: raisinlove

Re: timer in php-cli
        179200 by: Aidan Lister

Adverse performance of undefined variables and indexes?
        179203 by: Rob Paxon
        179205 by: Robert Cummings
        179207 by: Rob Paxon
        179211 by: Richard Davey

Credit Card validation
        179204 by: Binay
        179219 by: Nadim Attari

openssl - extracting public key
        179206 by: Tony Carter

Re: Stumped on a totally wierd problem
        179208 by: Phillip Jackson

Re: php newsgroup portal?
        179214 by: Zhang Weiwu

Re: check if a variable is declared as private
        179215 by: Vivian Steller

re-raise the question: best usenet gateway
        179216 by: Zhang Weiwu
        179218 by: Zhang Weiwu

Sessions, sessions and... sessions
        179220 by: Puiu Hrenciuc
        179221 by: Richard Davey
        179222 by: electroteque
        179223 by: Puiu Hrenciuc
        179225 by: Puiu Hrenciuc

Session and MS-IE6
        179224 by: Pance

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
We're having a weird problem with some of our PHP forms, where, when a
client uses IE6 with the latest hotfixes, they are reporting that have to
re-submit a couple of times for it to "take" ... as if somehow the data
isn't being passed down properly to the FORM/ACTION ...

We're using sessions to pass the data around, and it seems to work with
every other browser we've used, including IE6 previous to the latest
hotfixes ... but, could it be something that *we* aren't doing right, or
is there a known bug with sessions + IE6?  Some sort of work around?

Thanks ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]           Yahoo!: yscrappy              ICQ: 7615664

--- End Message ---
--- Begin Message ---
--- "Marc G. Fournier" <[EMAIL PROTECTED]> wrote:
> We're having a weird problem with some of our PHP forms, where, when a
> client uses IE6 with the latest hotfixes, they are reporting that have
> to re-submit a couple of times for it to "take" ... as if somehow the
> data isn't being passed down properly to the FORM/ACTION ...

I have heard from numerous sources that the latest patch for IE 6
(released a week or two ago) has a bug that causes it to have trouble
sending a proper POST request.

I don't have access to a Windows machine to test this myself, but it would
be very nice if someone could help pinpoint what circumstances cause this
behavior (surely it's not all POST requests). Capturing the raw request
from a failed transaction would be a good first step, and you can send me
this for interpretation if you like. I'm happy to help.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
On Mon, 1 Mar 2004, Chris Shiflett wrote:

> --- "Marc G. Fournier" <[EMAIL PROTECTED]> wrote:
> > We're having a weird problem with some of our PHP forms, where, when a
> > client uses IE6 with the latest hotfixes, they are reporting that have
> > to re-submit a couple of times for it to "take" ... as if somehow the
> > data isn't being passed down properly to the FORM/ACTION ...
>
> I have heard from numerous sources that the latest patch for IE 6
> (released a week or two ago) has a bug that causes it to have trouble
> sending a proper POST request.
>
> I don't have access to a Windows machine to test this myself, but it would
> be very nice if someone could help pinpoint what circumstances cause this
> behavior (surely it's not all POST requests). Capturing the raw request
> from a failed transaction would be a good first step, and you can send me
> this for interpretation if you like. I'm happy to help.

k, I have access to at leaset one box running the latest IE6 ...
instructions on how to 'capture the raw request'?  Don't mind doing the
work, just need to know what work needs to be done ...



----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]           Yahoo!: yscrappy              ICQ: 7615664

--- End Message ---
--- Begin Message ---
--- "Marc G. Fournier" <[EMAIL PROTECTED]> wrote:
> I have access to at leaset one box running the latest IE6 ...
> instructions on how to 'capture the raw request'?

It's not easy if you've never used it, but I think the best bet for
Windows is Ethereal (http://www.ethereal.com/download.html). You want to
capture the HTTP traffic for a request/response scenario that fails. By
inspecting the request and identifying the flaw in IE, we might be able to
recommend a workaround for people.

Also, pinpointing the specific circumstances in which IE fails would be
very helpful.

Thanks for helping.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
Marc:

This could be related to the problem I described in detail a few days
ago. Here was my solution:

http://marc.theaimsgroup.com/?l=php-general&m=107751892631059&w=2

Please let us know if this helps!

Beau

> We're having a weird problem with some of our PHP forms, 
> where, when a client uses IE6 with the latest hotfixes, they 
> are reporting that have to re-submit a couple of times for it 
> to "take" ... as if somehow the data isn't being passed down 
> properly to the FORM/ACTION ...
> 
> We're using sessions to pass the data around, and it seems to 
> work with every other browser we've used, including IE6 
> previous to the latest hotfixes ... but, could it be 
> something that *we* aren't doing right, or is there a known 
> bug with sessions + IE6?  Some sort of work around?

--- End Message ---
--- Begin Message ---
Chris, you said you could recreate it ... can you check Beau's solution
here to see if it solves the problem we are seeing?  Beau's problem
appears to have been with 5 and 5.5 also, which I didn't think were
causing us problems, but it could also be that nobody reported them also
...


On Mon, 1 Mar 2004, Beau Hartshorne wrote:

> Marc:
>
> This could be related to the problem I described in detail a few days
> ago. Here was my solution:
>
> http://marc.theaimsgroup.com/?l=php-general&m=107751892631059&w=2
>
> Please let us know if this helps!
>
> Beau
>
> > We're having a weird problem with some of our PHP forms,
> > where, when a client uses IE6 with the latest hotfixes, they
> > are reporting that have to re-submit a couple of times for it
> > to "take" ... as if somehow the data isn't being passed down
> > properly to the FORM/ACTION ...
> >
> > We're using sessions to pass the data around, and it seems to
> > work with every other browser we've used, including IE6
> > previous to the latest hotfixes ... but, could it be
> > something that *we* aren't doing right, or is there a known
> > bug with sessions + IE6?  Some sort of work around?
>
>
>

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]           Yahoo!: yscrappy              ICQ: 7615664

--- End Message ---
--- Begin Message ---
--- "Marc G. Fournier" <[EMAIL PROTECTED]> wrote:
> Chris, you said you could recreate it ... can you check Beau's solution
> here to see if it solves the problem we are seeing?

I'm confused. You're the one having this problem, right? Why don't *you*
try his solution and tell us if it solves your problem. :-)

I don't have a Windows box, so no, I never said I could recreate it. If I
could, I'd try to solve the problem instead of asking for HTTP dumps. :-)

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

--- End Message ---
--- Begin Message ---
Hello Chris,

Tuesday, March 2, 2004, 12:31:18 AM, you wrote:

CS> I have heard from numerous sources that the latest patch for IE 6
CS> (released a week or two ago) has a bug that causes it to have trouble
CS> sending a proper POST request.

CS> I don't have access to a Windows machine to test this myself, but it would
CS> be very nice if someone could help pinpoint what circumstances cause this
CS> behavior (surely it's not all POST requests). Capturing the raw request
CS> from a failed transaction would be a good first step, and you can send me
CS> this for interpretation if you like. I'm happy to help.

I don't believe there are any consistent causes of this problem -
sometimes it just happens. Refreshing the exact same form will, 9
times out of 10, cure it.

However Chris - this might help in your debugging because when IE does
fail, it fails by sending an http header of 0 bytes in size. It's not
just the post form data that is lost, everything is. So trap that and
you should, theoretically, with a little browser detection mojo be
able to at least error gracefully.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
On 02 March 2004 00:04, Marc G. Fournier wrote:

> We're having a weird problem with some of our PHP forms, where, when a
> client uses IE6 with the latest hotfixes, they are reporting
> that have to
> re-submit a couple of times for it to "take" ... as if
> somehow the data
> isn't being passed down properly to the FORM/ACTION ...
> 
> We're using sessions to pass the data around, and it seems to
> work with
> every other browser we've used, including IE6 previous to the latest
> hotfixes ... but, could it be something that *we* aren't
> doing right, or
> is there a known bug with sessions + IE6?  Some sort of work around?

Yes, there are known issues of this sort with the 6-Feb-2004 security
update, and there is a fix posted on the MS Web site -- see
http://support.microsoft.com/default.aspx?scid=kb;en-us;831167&Product=ie600
for more info.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
then use
`cp source destination`

that should work.


raisinlove wrote:


Raditha Dissanayake wrote:

Hi,
Are you trying to copy from the FTP to the web server or are you trying to pass it through to the end user? if you are on the same network other options include RCP (insecure) and SCP (secure)


Actually, it's much simpler than that but it might be overkill.
My overall script is for creating directories on the same server, and I'd like to copy the main index file to each new directory that is created. So my intention is exactly the same as copy() since it's on the same server.
I'm exploring other alternatives because I cant see to get copy() working as I intend.


-s



--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

--- End Message ---
--- Begin Message --- Raditha Dissanayake wrote:
then use
`cp source destination`

In my php script? This must be executed automaticaly by the script. I probably have no other choice than copy() then.

-s
--- End Message ---
--- Begin Message --- Raisinlove wrote:
Raditha Dissanayake wrote:
then use
`cp source destination`
In my php script? This must be executed automaticaly by the script.
I probably have no other choice than copy() then.
-s

Ok, I found the solution! ftp_rename() was what I was looking for.
Funny no one mentioned it! I smaked my forhead for not having thought of it myself.

--- End Message ---
--- Begin Message ---
A simple timer:

<?
$length = 10;
$timestart = time();

for (;;)
{

if (time() = $timestart + 10)
{
    // go
}
}
?>

Also, you should look at the PEAR::Net_SmartIRC framework (it has timers
already). It's a fantastic framework, and there's really no point in
re-writing the textbook.

http://pear.php.net/package/Net_SmartIRC


-- aidan

"Nobody" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I'm writing a php irc bot. I've come up to the situation where I need a
> timer for  processing different data in a "special" way. I've searched the
> archive of the list but I didn't found nothing helpful (I can't use
> JavaScript here, neither cron).
> If I use for(;;) or sleep(); the whole script stops (php is not
> multithread:(). Eventually I've come up with some ideas about ticks, but
> didn't get to finished it my head. So, any ideas?
>
> And is php5 going to be multithreaded? If not, when?:)
>
> --
> best wishes,
> Strahil Minev,
> http://sourceforge.net/users/phuncky/

--- End Message ---
--- Begin Message --- Howdy Fellow PHPers,
I am currently recoding the bulk of my web site network. One major change is that I finally made a proper error handling system. To get right down to it, when you use a custom error handler, PHP ignores the error_reporting level you use. Because of this, all those little "undefined variable" and "undefined index" notices I never, well, noticed, will call my handler. Of course my handler is currently set to ignore them but it raises a burning question in my mind:


Is it more efficient from a performance standpoint to:
a.) Not use a custom error handler and let PHP do nothing with the notice errors other than notice them.
b.) User my custom error handler and have it ignore notices.
c.) Work empty() and isset() into my scripts ever-so gingerly.


?

I wish I knew more about the internals of the Zend Engine, but I assume that in order for PHP to designate something as a notice error, it has to call an internal function. Then it has to check the error handling rules and follow them. In cases a and b this would be routine, along with the added function of my error_handler being called in case b. Case c obviously involves lots of added function calls, as I've mentioned empty and isset, along with many new If statements. In some of my scripts, this could amount to lots of new function calls, however that also means that in cases a and b that means a lot of unnoticed errors.

I plan on doing some benchmark tests to see myself, but I'm not particularly good at that stuff. I'm hoping someone here can share any benchmarking they've done or even some theory to this. I'd be particularly delighted if someone with knowledge of the internals could set this straight.

I appreciate the help and I realize it is better practice to do case c, but as this code is for my eyes only (and I'm the one who has to redo everything should a 'better practice' become mandatory), I am only concerned with the performance, not the sound practice.

- Rob Paxon

P.S. (offtopic)
Speaking of benchmarking, in case anyone is interested I did some testing on the three string syntaxes (single, double, and hereto) with lots of variables and it seemed to me that using single string quotations is more efficient than the other two.
$string = 'Blah blah ' . $blah . ' blah blah'; as opposed to $string = "Blah blah $blah blah blah";
I'd like to dig deeper into this in the future, with varying amounts of variables per string.

--- End Message ---
--- Begin Message ---
On Tue, 2004-03-02 at 00:19, Rob Paxon wrote:
> Howdy Fellow PHPers,
> I am currently recoding the bulk of my web site network.  One major 
> change is that I finally made a proper error handling system.  To get 
> right down to it, when you use a custom error handler, PHP ignores the 
> error_reporting level you use.  Because of this, all those little 
> "undefined variable" and "undefined index" notices I never, well, 
> noticed, will call my handler.  Of course my handler is currently set to 
> ignore them but it raises a burning question in my mind: 
> 
> Is it more efficient from a performance standpoint to:
> a.) Not use a custom error handler and let PHP do nothing with the 
> notice errors other than notice them.
> b.) User my custom error handler and have it ignore notices.
> c.) Work empty() and isset() into my scripts ever-so gingerly.

It's more efficient not to have a custom error handler... when your code
fires notices and warnings etc. Well written code won't fire any errors
or warnings. Well maintained code won't fire notices. So if you have
well written and well maintained code... the overhead is negligible
since your error handler will never be used except for the odd
notice/warning that you'll be sure to fix if your code is well
maintained :) Personally I like to run with E_ALL enabled.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message --- Robert Cummings wrote:

It's more efficient not to have a custom error handler... when your code
fires notices and warnings etc. Well written code won't fire any errors
or warnings. Well maintained code won't fire notices. So if you have
well written and well maintained code... the overhead is negligible
since your error handler will never be used except for the odd
notice/warning that you'll be sure to fix if your code is well
maintained :) Personally I like to run with E_ALL enabled.

Cheers,
Rob.


Thanks for the response, but my main question is whether or not it is more efficient to leave the notices or to add the extra functions required to not produce them. Let's say, with the default error handler, would it take more overhead for PHP to evaluate all the extra isset() calls and if statements required to eliminate notices or for all the checking it has to do with the notices there. If it isn't considerably more efficient to leave the notices in, then I'd lean towards the side of good practice and code out possible notice errors as I've already begun doing.

Again, thanks for the input.
--- End Message ---
--- Begin Message ---
Hello Rob,

Tuesday, March 2, 2004, 6:31:28 AM, you wrote:

RP> Let's say, with the default error handler, would it take more
RP> overhead for PHP to evaluate all the extra isset() calls and if
RP> statements required to eliminate notices or for all the checking
RP> it has to do with the notices there. If it isn't considerably more
RP> efficient to leave the notices in, then I'd lean towards the side
RP> of good practice and code out possible notice errors as I've
RP> already begun doing.

Don't think of it from a raw speed level - this of it like this: a PHP
Notice is a friendly way of PHP telling you that basically your code
isn't as good as it should be. You can choose to ignore those nuggets
of advice and hide them away in your own error handler, or you can fix
your code so they don't happen in the first place.

I, and I'm sure many others here code with E_ALL on. If you're
concerned about the potential stability of your application, you
should too.

To directly answer your question though - I see no logical reason why
PHP parsing script A that's say 50% longer than script B but contains
no errors would be slower than parsing script B just because it's
smaller in size. PHP must be using memory to keep track of those
errors and notices and bring them to your attention, it must be having
to store all of this information internally before finally deciding
what to output to the browser. If there are no errors, it won't need
to do this. It will be pretty hard to find a script lengthy enough to
give this a solid bench test, but I would honestly be amazed if B
outperformed A.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
Hi,

I need to validate credit cards on my web site. So i m looking for information as in 
what all i need to do / have to implement the card validation .

I m running ..

Php 4.3.3
Apache 1.3.29
Red Hat Linux 9.0

Any advices are most welcome...

Thanks in advance 

Binay

--- End Message ---
--- Begin Message ---
http://www.zend.com/codex.php?CID=22

Hope it helps...

Nadim Attari

--- End Message ---
--- Begin Message --- Hello,
I'm trying to use the openssl function and seem to be having a problem extracting the public key from the keypair generated by openssl_pkey_new. Is there a function to do this in PHP?


Here is the sample code.

<?php

$pubkey = "";
$privkey = "";
$keypair = "";
$privkeyout ="";
$pubkeyout = "";

// Generate a new private (and public) key pair
$keypair = openssl_pkey_new();

//openssl_get_publickey expects a mixed certificate parameter

// begin problem area
$pubkey =  openssl_get_publickey($keypair);
//end problem area

//openssl_get_publickey expects a  mixed key
$privkey = openssl_get_privatekey($keypair);

openssl_pkey_export($privkey, $privkeyout);
openssl_pkey_export($pubkey, $pubkeyout);

echo "Private Key<br>";
 var_dump($privkeyout);
echo "<br>Public Key<br>";
 var_dump($pubkeyout);

openssl_free_key($keypair);
?>

Thanks,
Tony


--- End Message ---
--- Begin Message ---
When you solve your own problem it is best to post a short synopsis of the
solution so that people who search the group later can learn from your
mistake.

~phillip jackson


"Brian V Bonini" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> nevermind I got it.
>
>
> << snip >>
> I have something really wierd going on with a form that let's a user
> add/edit/delete data from a mysql database.
>
> It's like I can not edit any data that was not recently added or if it
> was added by another user.
>
> If I log into mysql directly under the same user I'm using form the php
> script and run the same query it's fine. But if I run it form the form
> it behave like everything is ok but the data is not updated. AND only on
> old data or data someone else added. If add some data I can for a while
> edit it all I want from the php script but after a while (like the next
> day) I can no longer edit it. Goes through all the motions, no error
> messages, but no updates in the db. Yest, as I said, at the same time I
> can still edit "fresh" data so the queries must be fine AND I can edit
> the data directly.
>
> I've never encountered this before so any suggestions.... It's like the
> data is tied to a certain session or something.
>
> I hope that makes sense.

--- End Message ---
--- Begin Message --- Shane Nelson wrote:
To read this list I use thunderbird:

http://www.mozilla.org/projects/thunderbird/

It's an email client instead of a newsgroup reader. Just filter the php-general messages into a separate folder and sort it by thread. Super easy to use and a very nice piece of software.

I think you misunderstood me. I'm not setting up a newsgroup client for my personal use (actually look into my original's mail header you see it is sent from Mozilla to news:php.general). I'm trying to setup a newsgroup portal for my working group to use. Some of them are quite unfamiliar with newsgroup and have no time to learn to use a mail agent.

--- End Message ---
--- Begin Message ---
Hello,

is it possible to check if a variable declared as "private"?
I do not want to use reflection api in this case...

<?php
        class MyClass {
                private $var = "something";
        }

        $obj = new MyClass();
        
        // something like this would be nice...
        $isPrivate = isPrivate($obj, "var");
?>

best regards,
vivi

--- End Message ---
--- Begin Message --- Hello. I am looking for a good usenet gateway written in php. I have been looking for a good opensourced one, but none satisfied me.

There is a very charming project "mynewsgroup" at mynewsgroup.sf.net, particularly it has beautiful looking. But that project seems no longer under development.

php.net itself is using a seperate project as web-gateway. I don't know if it has a homepage / downloadable somewhere.

I read a short review on hostscript on this topic:
http://www.hotscripts.com/PHP/Scripts_and_Programs/Usenet_Gateway/
There are many projects but none seems mutual.

What do you use for web-based usenet gateway?
--- End Message ---
--- Begin Message --- Zhang Weiwu wrote:

There is a very charming project "mynewsgroup" at mynewsgroup.sf.net, particularly it has beautiful looking. But that project seems no longer under development.

Just to correct myself: I'm sorry I'm obviously wrong. I contacted a developer, the development of mynewsgroups is still going on.

--- End Message ---
--- Begin Message ---
Hello,

I am a little desperate right now since I have tried to solve this problem
for 3-4 days now.
I have developed a site that uses sessions for user authentication and data
storage between page access.
The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25

The site is working just fine on the development server, but when uploading
on release
server it keeps losing session data and the users are logged out of their
account in a
randomly manner. I can't reproduce the behaviour since it is all randomly,
for eg.
the session may expire immediately but it can also last 30-40 min. It does
not expire
on same page every time. I have tried to see if it is a browser related
issue so I have loaded
the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
thought that it
could be a process on the release server that deletes files on /tmp so I
have changed the
session_save_path to another dir, same problem. Now I have made some
functions
and keep the sessions in a MySQL database. It works fine on the development
server,
but... , BUT... , it has the same behaviour on the release server. Using
MySQL storage
I have discovered the PHP changes SIDs randomly ( at least so it seems ) so
the session's
data is not lost ( the MySQL record is there, and the data field is ok, all
variables are there
kindly waiting to be read by PHP :) ), but new sessions are created for same
connection
so I think this is PHP or Cookies related.
If you would like to see the phpinfo() snapshots:
Development server : http://www.pur.ro/devphpinfo.htm
Release server : http://www.pur.ro/relphpinfo.htm

Can someone please help me, coz' my hair is turning white and I'm too young
to die :)

Thanks,
Puiu Hrenciuc.

--- End Message ---
--- Begin Message ---
Hello Puiu,

Tuesday, March 2, 2004, 11:13:07 AM, you wrote:

PH> The site is working just fine on the development server, but when
PH> uploading on release server it keeps losing session data and the
PH> users are logged out of their account in a

Some things to try/think about:

1. Are your sessions/cookies set to expire after a certain time? If
so, is the server in a different time zone to your development server?

2. Are you 100% sure you call session_start() on every page that needs
it before doing any work with the session variables?

3. Does your site cross domains? Sessions will not propagate (unless
you make them).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
all i can think of here, you could be calling start_session twice in the
same page ? also init set the session timeout to an hour or so

-----Original Message-----
From: Puiu Hrenciuc [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 10:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sessions, sessions and... sessions


Hello,

I am a little desperate right now since I have tried to solve this problem
for 3-4 days now.
I have developed a site that uses sessions for user authentication and data
storage between page access.
The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25

The site is working just fine on the development server, but when uploading
on release
server it keeps losing session data and the users are logged out of their
account in a
randomly manner. I can't reproduce the behaviour since it is all randomly,
for eg.
the session may expire immediately but it can also last 30-40 min. It does
not expire
on same page every time. I have tried to see if it is a browser related
issue so I have loaded
the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
thought that it
could be a process on the release server that deletes files on /tmp so I
have changed the
session_save_path to another dir, same problem. Now I have made some
functions
and keep the sessions in a MySQL database. It works fine on the development
server,
but... , BUT... , it has the same behaviour on the release server. Using
MySQL storage
I have discovered the PHP changes SIDs randomly ( at least so it seems ) so
the session's
data is not lost ( the MySQL record is there, and the data field is ok, all
variables are there
kindly waiting to be read by PHP :) ), but new sessions are created for same
connection
so I think this is PHP or Cookies related.
If you would like to see the phpinfo() snapshots:
Development server : http://www.pur.ro/devphpinfo.htm
Release server : http://www.pur.ro/relphpinfo.htm

Can someone please help me, coz' my hair is turning white and I'm too young
to die :)

Thanks,
Puiu Hrenciuc.

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

--- End Message ---
--- Begin Message ---
1. No. If that would be the problem i think that sessions would expire
     after the same period of time and not randomly , right ?
2. The site consists in a single page (index.php) that includes
     the subpages as needed. The session_start() is at the begining of the
file.
     If this would be the problem the sessions would expire on the same
page, right ?
3. No, it is not cross domains. It is on a virtual server thought .


"Richard Davey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Puiu,
>
> Tuesday, March 2, 2004, 11:13:07 AM, you wrote:
>
> PH> The site is working just fine on the development server, but when
> PH> uploading on release server it keeps losing session data and the
> PH> users are logged out of their account in a
>
> Some things to try/think about:
>
> 1. Are your sessions/cookies set to expire after a certain time? If
> so, is the server in a different time zone to your development server?
>
> 2. Are you 100% sure you call session_start() on every page that needs
> it before doing any work with the session variables?
>
> 3. Does your site cross domains? Sessions will not propagate (unless
> you make them).
>
> --
> Best regards,
>  Richard Davey
>  http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
the session_start() is in a file that is require_once in every page,
so it can't get called more than one time. If this would be the problem,
I would also have problems on the development server, don't you think ?

"Electroteque" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> all i can think of here, you could be calling start_session twice in the
> same page ? also init set the session timeout to an hour or so
>
> -----Original Message-----
> From: Puiu Hrenciuc [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 02, 2004 10:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Sessions, sessions and... sessions
>
>
> Hello,
>
> I am a little desperate right now since I have tried to solve this problem
> for 3-4 days now.
> I have developed a site that uses sessions for user authentication and
data
> storage between page access.
> The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
> The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25
>
> The site is working just fine on the development server, but when
uploading
> on release
> server it keeps losing session data and the users are logged out of their
> account in a
> randomly manner. I can't reproduce the behaviour since it is all randomly,
> for eg.
> the session may expire immediately but it can also last 30-40 min. It does
> not expire
> on same page every time. I have tried to see if it is a browser related
> issue so I have loaded
> the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
> thought that it
> could be a process on the release server that deletes files on /tmp so I
> have changed the
> session_save_path to another dir, same problem. Now I have made some
> functions
> and keep the sessions in a MySQL database. It works fine on the
development
> server,
> but... , BUT... , it has the same behaviour on the release server. Using
> MySQL storage
> I have discovered the PHP changes SIDs randomly ( at least so it seems )
so
> the session's
> data is not lost ( the MySQL record is there, and the data field is ok,
all
> variables are there
> kindly waiting to be read by PHP :) ), but new sessions are created for
same
> connection
> so I think this is PHP or Cookies related.
> If you would like to see the phpinfo() snapshots:
> Development server : http://www.pur.ro/devphpinfo.htm
> Release server : http://www.pur.ro/relphpinfo.htm
>
> Can someone please help me, coz' my hair is turning white and I'm too
young
> to die :)
>
> Thanks,
> Puiu Hrenciuc.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I verify users to my website with sessions. It's been working fine for the
past couple of years, but recently I started having some problems using
sessions for example:
       session_register("user_id");
       if (!(user_id)){ ....

and then I read the PHP manual and it suggested this instead:
      session_start();
      if (!$_SESSION['user_id']){ ....

which worked on my machine (Win98 and MS-IE5.5). But today I tried to login
to my page from the client's computer using MS-IE 6 and I got the error:
undefined index 'user-id'....

Does anybody know what's going on? Is there a bug with MS-IE6 when using
sessions? I've read some of the other comments here about IE6 but they apply
to forms, not sessions.

Pance.

--- End Message ---

Reply via email to