Jump to content

How to make a simple session?


nicx

Recommended Posts

Master! Plz help me to make a session for my page,coz i was try but that not perfect.

I have 2 page,they are page1.php and page2.php. I want to connect page1 and page2 with session. So,user who enter page2 he can't enter that page before,he through page1.php.

And if he enter page1.php he get session to enter page2.php.And that session expire in 20minutes,

 

How with session sintax?? And i wan't the url in page2.php become domain.com/page2.php?sid=xxxx because session i'm create can't show url like that. Plz help with the sintax.Thanks

Link to comment
https://forums.phpfreaks.com/topic/111052-how-to-make-a-simple-session/
Share on other sites

page1.php

<?php
session_start();
$_SESSION['Start'] = 1;
?>

page2.php

<?php
session_start();
if($_SESSION['Start'] != 1){
echo "You ain't suppose to be here";
}
else{
#display page
}
?>

bro,how to write the link to connect page2 with
<? echo "<a href=..."; ?  ?> 

what i must add behind the original url and is the url shown on address bar become http://domain.com/page2.php?sid=xxxx...?

Because i was make sid like that but that not show url like i want. How?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.