Page 1 of 1

Can Cookies Prevent The Page From Loading?

Posted: Sat Oct 21, 2006 4:10 pm
by nickvd
I wrote a very quick "thought" messing system. The user registers and is able to post thoughts. After a thought is posted, they are presented with 3 options (set thought to private, set to private and email to recipients, or purchase a printed thought with a little angel coin).

Whenever the user selects "set to private and email", the browser sends the request, then just hangs. The email goes thru, but the page never re-loads with the success message. The only thing that I have changed since testing the site on the production server is to switch Swift's Connection class from smtp to sendmail ie:

Code: Select all

require_once('Swift.php');
   if ($_config['app']['mailer'] == 'smtp') {
      require_once('Swift/Connection/SMTP.php');
      $swift = $connection = new Swift_Connection_SMTP($_config['app']['smtpserver']);
   } else {
      require_once('Swift/Connection/Sendmail.php');
      $connection = new Swift_Connection_Sendmail;
   }
I have yet to try switching it back to smtp, but I can't believe for a second that using sendmail would cause the browser to have problems (it does the same thing in firefox OR ie...).

I've been able to narrow it down to the sending of the phpsessionid cookie. If I click the archive/email link, it hangs, but if i clear cookies and reload, the page loads fine (albeit no success message as the session has been cleared).

If anyone has any idea what the heck could be happening, I'd be in your debt. I can provide a demo account on the system if you want to see it for yourself.

Posted: Sat Oct 21, 2006 4:20 pm
by nickvd
Dumping the transactions and errors, I see what looks to be the full transaction log (the last entry is:

Code: Select all

0.10760900 1161465414
response	250 2.0.0 k9LLGrEH029705 Message accepted for delivery
)

That's where the browser hangs, it never finishes loading the page...

<edit>

If I comment out session_start() it loads... So it must (somehow) be session/cookie related... ARGGGHHH!!!

Posted: Sat Oct 21, 2006 4:34 pm
by akimm
Nickvd? Why not use sessions instead, they can redirect the user if they aren't supposed to view a given page, they're easy to use, and they have much functionallity in PHP.

Posted: Sat Oct 21, 2006 5:25 pm
by nickvd
akimm wrote:Nickvd? Why not use sessions instead, they can redirect the user if they aren't supposed to view a given page, they're easy to use, and they have much functionallity in PHP.
Thanks, but I am already using sessions...