Hello..
I am having two php pages the 1st page is the registration and in the 2nd page i need to use the ID associated with registration (stored in databae)

I think we need to maintain sessions for this..
But I am not clear with its implementations..


Plz kindly help..

hi,

when you register in the database you add another field as id and assign that id as autoincrement and pass that id in session

for eg,
$fetch=mysql_fetch_array($exeusid);
$userid=$fetch;
$_SESSION=$userid;
$_SESSION=$email;
header("Location: homepage.php?email=$email&id=$id&Password=$pass");

try by the given above format if any doubt ask i will explain upto my knowledge

Hello..
I am having two php pages the 1st page is the registration and in the 2nd page i need to use the ID associated with registration (stored in databae)

I think we need to maintain sessions for this..
But I am not clear with its implementations..


Plz kindly help..

Thank You Sir...
but actuall i need 2 check in another page whether the session is already active or not...

Moreover if i copy a url n paste it to another address bar than the page gets executed, but i dont want even that.. If I execute the url of 2nd page w/o executing the 1st page than it should go to the 1st page itself..

Moreover sir as i am new to PHP i am not comfortble using the query string in it..

Thank U..

hi,

well for that u plz check first that the id that u have given in the session is passing to 2nd page r not by putting an echo .Then if u get means put an if condition for that session id like this for eg.if u put like this means if the session id is !=empty means the page will auomatically redirect to the first page.

if($_SESSION=="")
header("Location:second.php");
else
header("Location:first.php");

Hello..
I acually have go 1 doubt in the above..
If i give a value to the session variable in the 1st page than the session id == empty means i have to direct it to the 1st page...

but stil it wont solve my another problem-- "If i am at pesent on 2nd page and now if i copy this url and paste it into another address bar than the 2nd page wil be shown.."
This is bcoz the session is already active/registered..
How can i avoid that too??

If I am not mistaking, a session cookie gets destroyed once the original browser window gets closed. So until you close window 1 the session is active for all subsequent windows you have opened.

I am not sure if you can bypass this...

This article has been dead for over six months. Start a new discussion instead.