I don't know much about your specific problem, but I thought I'd share
how I do AJAXified login. First I have a form with action set to the
login page so it will work without javascript. Then I hijack the form
with ajaxForm() from the form plugin. I have the ajax return JSON and
have a callback
I believe you aren't handling the session correctly, remember, AJAX
calls don't automatically attach the session ID to your URL variables,
so you have to do it manually (if it's not in the cookie), either by
directly attaching to the target url:
$.getJSON(target.php?sid=+session id,...,...);
or
Thanks to both of you for your responses,
I guess I'm still having a hard time wrapping my head
around what AJAX is doing with my session vars that
make it impossible to use in my existing PHP files. I
was under the impression that session vars are just
... around in the browser, so if they are
On 3/30/07, Kim Johnson [EMAIL PROTECTED] wrote:
Should I be recalling
session_start?
As a general rule, you should call session_start() in *every* PHP script
that accesses $_SESSION. Where you call it depends on whether you're using
output buffering or not[1], but it must *always* be
As a side note, if you (or anyone else, for that matter) are having problems
with Tredosoft's MultipleIEs (http://tredosoft.com/Multiple_IE) and PHP
sessions, be sure to upgrade to at least the version that was released on
07/11/2006 (November 11, 2006) as versions before that had issues with
I am indeed not using output buffering. I call
session_start as the first thing on every page, before
the headers are sent. I also call session_start on my
login page, first thing.
If I use output buffering, do you think that would fix
things? I could call session_start() again as a
callback
Question: is session_start() called on the page where this code is run?
var loggedin = ?=$_SESSION['loggedin']?;
if (loggedin == true)
{
$(div#login).hide();
$(div#logout).unhide();
}
else
{
$(div#login).unhide();
$(div#logout).hide();
}
On
On 3/30/07, Kim Johnson [EMAIL PROTECTED] wrote:
called via ajaxsubmit (async set to false).
You should *really* avoid doing this as it completely freezes the entire
browser until the request is complete (very bad!!). I highly recommend that
you check out Mike Alsup's blockUI plugin (
Ah, it's actually not... here's the breakdown of the
included files:
index.php (sample normal page which has the login
box in it)
(included at start of index.php)
-page_init.php
(included at start of page_init.php)
-dbconnect.php //connects database
-startsession.php //CALLS
If that code is not executed in the same request as code that calls
session_start(), then you will have problems (though that doesn't appear to
be the case).
Try adding a call to session_start() just before that code is run, see if
that helps at all.
Is there any chance that you could send me
10 matches
Mail list logo