469,625 Members | 1,911 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

ajax session php

hey gaiz plz I want to cerate log in system in ajax i do it but i have
one problem

AFTER I start thes session then press refresh key the session gone !!!
in other words , after the user type hid username and password I send
this information by XMLrequest to php file which verify the user name
and the password if trure open the sesstion and get it name 'user' its
become like this

$_SESSION['user']=$user;

actually after i open the sesstion_start();

BUT THE PROBLEM IS WHN I PRESS F5 "refresh the page the sesssion is
gone
ANY WAY OUT PLZ :)

alot of htanx in advance

Mar 9 '07 #1
3 2731
Rik
Beshoo <ba*********@gmail.comwrote:
hey gaiz plz I want to cerate log in system in ajax i do it but i have
one problem

AFTER I start thes session then press refresh key the session gone !!!
in other words , after the user type hid username and password I send
this information by XMLrequest to php file which verify the user name
and the password if trure open the sesstion and get it name 'user' its
become like this

$_SESSION['user']=$user;

actually after i open the sesstion_start();

BUT THE PROBLEM IS WHN I PRESS F5 "refresh the page the sesssion is
gone
ANY WAY OUT PLZ :)

alot of htanx in advance

So, you were in a hurry in typing, weren't you?
When using this kind of thing to login, first consider wether or not this
breaks your total page becomes useless without javascript. Create a nice
fallback.

Now, the way you use it, only cookies can be used to hold the session_id,
PHP is not there for you to rewrite GET or POST variables (or you have to
do it with javscript... messy). I think it might be a security issue,
where the cookie received by a javascript call is not set/denied by the
browser. Try to:
- check with javascript wether or not the cookie is set after your request.
- print the session_id to screen
- check the headers that are sent on refresh

--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Mar 9 '07 #2
On Mar 9, 8:55 am, "Beshoo" <basheerm...@gmail.comwrote:
hey gaiz plz I want to cerate log in system in ajax i do it but i have
one problem

AFTER I start thes session then press refresh key the session gone !!!
in other words , after the user type hid username and password I send
this information by XMLrequest to php file which verify the user name
and the password if trure open the sesstion and get it name 'user' its
become like this

$_SESSION['user']=$user;

actually after i open the sesstion_start();

BUT THE PROBLEM IS WHN I PRESS F5 "refresh the page the sesssion is
gone

ANY WAY OUT PLZ :)

alot of htanx in advance
Make sure session_start() is at the top of every file.
Try setting the php ini setting to use cookies for sessions, and make
the session lifetime greater.
should work.

Mar 9 '07 #3
On Mar 9, 1:19 pm, dschr...@gmail.com wrote:
On Mar 9, 8:55 am, "Beshoo" <basheerm...@gmail.comwrote:
hey gaiz plz I want to cerate log in system in ajax i do it but i have
one problem
AFTER I start thes session then press refresh key the session gone !!!
in other words , after the user type hid username and password I send
this information by XMLrequest to php file which verify the user name
and the password if trure open the sesstion and get it name 'user' its
become like this
$_SESSION['user']=$user;
actually after i open the sesstion_start();
BUT THE PROBLEM IS WHN I PRESS F5 "refresh the page the sesssion is
gone
ANY WAY OUT PLZ :)
alot of htanx in advance

Make sure session_start() is at the top of every file.
Try setting the php ini setting to use cookies for sessions, and make
the session lifetime greater.
should work.
I assume it is not session but the page refresh in Ajax.
When you refresh a page in ajax all data is be lost.
For this you should use login without Ajax. After login you can use
Ajax for another things.
And remember at the first page also from where you are using ajax, use
session_start();
Mar 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by melledge | last post: by
1 post views Thread by Jim | last post: by
6 posts views Thread by =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post: by
16 posts views Thread by deostroll | last post: by
4 posts views Thread by KDawg44 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.