blufish Posted May 31, 2008 Author Share Posted May 31, 2008 shouldn't it be $_POST['name']? Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554008 Share on other sites More sharing options...
blufish Posted May 31, 2008 Author Share Posted May 31, 2008 I don't understand what's happening, Why won't it read what I put in the session variables? can sessions be passed through different pages? Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554009 Share on other sites More sharing options...
darkfreaks Posted May 31, 2008 Share Posted May 31, 2008 just do $_SESSION['name']; its much easier than have it trying to equal a post variable. Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554015 Share on other sites More sharing options...
blufish Posted May 31, 2008 Author Share Posted May 31, 2008 I need to put something in there so people can sign in. Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554017 Share on other sites More sharing options...
darkfreaks Posted May 31, 2008 Share Posted May 31, 2008 Code: <html> <head> <?php ini_set('error_reporting',E_ALL); //error reporting if ($_GET['where']=='jokes/blond') { echo "<TITLE>Frozenoven :: Jokes :: Dumb Blonde Jokes</TITLE>"; } if ($_GET['where']=='home') { echo "<TITLE>Frozenoven :: Home</TITLE>"; } if ($_GET['where']=='customize') { echo "<TITLE>Frozenoven :: Customization</TITLE>"; } if ($_GET['where']=='jokes/yourmother') { echo "<TITLE>Frozenoven :: Jokes :: Your Mother Jokes</TITLE>"; } if ($_GET['where']=='jokes/6yroldbacktalk') { echo "<TITLE>Frozenoven :: Jokes :: 6-Year-Old-Back-Talk</TITLE>"; } if (isset($_SESSION['name'])) { echo '<link rel="stylesheet" type="text/css" href="'.$_SESSION['name'].'">'; } else { echo '<link rel="stylesheet" type="text/css" href="white.css">'; } ?> <script type="text/javascript"> function go(location) { parent.location = location } </script> </head> <body> <?php if (isset($_SESSION['name'])) { echo 'Hey "'.$_SESSION['name'].'"! <a href=logout.php>Logout</a>'; } else { echo "Hey Guest! <a href='http://www.frozenoven.com/index.php?where=make'>wanna customize?</a>"; } ?> <center> <table> <tr> <td align=center> <img src="http://www.frozenoven.com/images/logo.gif" width="500" height="53.7" alt="www.frozenoven.com"> </td></tr> <tr> <td><table><tr> <td width=100 valign=top> <div class="side"><p class="option"><a href="http://www.frozenoven.com/index.php?where=account">Accounts</a></p></div> <div class="side"><p class="option"><a href="http://www.frozenoven.com/index.php?where=jokes/index">Jokes</a></p></div> </td><td valign=top> <div class="main"><p> <?php $mypage = $_GET['where']; $mypage = $mypage.".fzp"; if ($mypage==".fzp") { echo "<script type='text/javascript'>parent.location='http://www.frozenoven.com/index.php?where=home';</script>"; } if (file_exists($mypage)) { echo file_get_contents($mypage); } if (!file_exists($mypage)) { echo "<h1 align=center>404 File not Found!</h1><p>Either the file you are looking for does not exist or you typed the url wrong.</p><p align=center><a href='http://www.frozenoven.com'>Home</a>"; } ?></p></div> </td> </tr> </table> </td> </tr> </table> <table> <tr> <td> <div class="ad"> <script type="text/javascript"><!-- google_ad_client = "pub-2142734016668784"; /* 728x90, created 5/30/08 */ google_ad_slot = "1701812294"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </td> </tr> </table> </center> </body> </html> code part 2: <?php ini_set("error_reporting",E_ALL); session_start(); ?> <?php $name = strip_tags($_POST['name']); if (file_exists($name)) { echo "<h1 align=center>Account name already in use!</h1>"; } if (!file_exists($name)) { $layout = $_POST['layout'].".css"; $time = time()+3600*24*365; $_SESSION['name']; $nc = strtolower($name); $pass = strtolower($_POST['pass']); $pass = str_replace("a","[1]",$pass); $pass = str_replace("b","[2]",$pass); $pass = str_replace("c","[3]",$pass); $pass = str_replace("d","[4]",$pass); $pass = str_replace("e","[5]",$pass); $pass = str_replace("f","[6]",$pass); $pass = str_replace("g","[7]",$pass); $pass = str_replace("h","[8]",$pass); $pass = str_replace("i","[9]",$pass); $pass = str_replace("j","[10]",$pass); $pass = str_replace("k","[11]",$pass); $pass = str_replace("l","[12]",$pass); $pass = str_replace("m","[13]",$pass); $pass = str_replace("n","[14]",$pass); $pass = str_replace("o","[15]",$pass); $pass = str_replace("p","[16]",$pass); $pass = str_replace("q","[17]",$pass); $pass = str_replace("r","[18]",$pass); $pass = str_replace("s","[19]",$pass); $pass = str_replace("t","[20]",$pass); $pass = str_replace("u","[21]",$pass); $pass = str_replace("v","[22]",$pass); $pass = str_replace("w","[23]",$pass); $pass = str_replace("x","[24]",$pass); $pass = str_replace("y","[25]",$pass); $pass = str_replace("z","[26]",$pass); fopen($pass."+%+".$nc,"x"); fopen("check".$nc,"x"); file_put_contents("check".$nc,$name); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554024 Share on other sites More sharing options...
blufish Posted May 31, 2008 Author Share Posted May 31, 2008 I got these errors: Notice: A session had already been started - ignoring session_start() in /home/blufish/public_html/accounts/login.php on line 6 Notice: Undefined index: layout in /home/blufish/public_html/accounts/login.php on line 16 Notice: Undefined index: name in /home/blufish/public_html/accounts/login.php on line 18 Warning: fopen([16][15][15][16]+%+mark) [function.fopen]: failed to open stream: File exists in /home/blufish/public_html/accounts/login.php on line 47 Warning: fopen(checkmark) [function.fopen]: failed to open stream: File exists in /home/blufish/public_html/accounts/login.php on line 48 Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554026 Share on other sites More sharing options...
blufish Posted May 31, 2008 Author Share Posted May 31, 2008 okay, I fixed the errors but it still won't login, when I return to the home page, it doesn't say I've logged in! Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554028 Share on other sites More sharing options...
beboo002 Posted May 31, 2008 Share Posted May 31, 2008 moved this topic http://www.phpfreaks.com/forums/index.php/topic,199719.0.html Quote Link to comment https://forums.phpfreaks.com/topic/108078-solved-cookie-problem/page/2/#findComment-554059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.