PHP sessions without cookies

visus

New Member
i'm a little lost working without cookies.I want to create a session passing the SID through the url, but i don't know how to pass and get data from another page.I've googled a lot but 90% of the examples are with cookies.Here is what i have.index.php\[code\]<?php ini_set("session.use_cookies",0); ini_set("session.use_only_cookies",0); ini_set("session.use_trans_sid",1); session_start();?><html><head> <title>Index</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="STYLESHEET" type="text/css" href="http://stackoverflow.com/questions/14034933/style.css"></head><body> <a href="http://stackoverflow.com/questions/14034933/index.php?" class="navactive">Index</a> <a href="http://stackoverflow.com/questions/14034933/second.php?">Second</a> <form action="access.php" method="POST"> User: <input type="text" name="user" size="15"/><br> Pass: <input type="password" name="pass" size="15"/><br> <button type="submit"/>Ok</button> <button type="reset"/>Reset</button> </form> Logged as: <?php print $_SESSION["name"]; ?> </body></html>\[/code\]access.php last part\[code\]................... if($count==1){ // Register $myusername and redirect to file "second.php" ini_set("session.use_cookies",0); ini_set("session.use_only_cookies",0); ini_set("session.use_trans_sid",1); session_name('test'); session_start(); $_SESSION['name'] = $myusername; header("location:second.php?".SID); exit;}else { echo "Wrong Username";}ob_end_flush();?>\[/code\]second.php\[code\]<?php ini_set("session.use_cookies",0); ini_set("session.use_only_cookies",0); ini_set("session.use_trans_sid",1); session_start();?><html><head> <title>Second</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="STYLESHEET" type="text/css" href="http://stackoverflow.com/questions/14034933/style.css"></head><body> <a href="http://stackoverflow.com/questions/14034933/index.php?">Index</a> <a href="http://stackoverflow.com/questions/14034933/second.php?" class="navactive">Second</a><br> <a href="http://stackoverflow.com/questions/14034933/logout.php">Logout</a><br> Logged as: <?php print $_SESSION["name"]; ?> </body></html>\[/code\]logout.php\[code\]<?php ini_set("session.use_cookies",0); ini_set("session.use_only_cookies",0); ini_set("session.use_trans_sid",1); session_start(); session_unset(); session_destroy(); header('Location: index.php'); exit;?>\[/code\]-What do i have to put in "Logged as:" ?. "print $_SESSION["name"];" shows nothing.-When i log in, i'm redirected to second.php, then i click on any link and the actual logged session dies and SID changes.thx!
 
Back
Top