Twist3d Posted March 16, 2010 Share Posted March 16, 2010 Hello again. Well, this is a little strange for me. I don't know if its my host or what. But I posted a topic on this same matter, and got it fixed quickly. Now since then I can't remember if I edited anything on the page, but its doing the same problem AGAIN. So I thought that if i edited something, I could goto the topic I made which had the correct code. http://www.phpfreaks.com/forums/index.php/topic,290920 So it is EXACTLY the way it is in the above ^ which worked great. But now, it doesn't. I'm confused, but you can get all of the code from that link, but the login2 (The one that creates the session) here: case 'login2': session_start(); $password = $_POST['password']; $sql = "SELECT * FROM passwords WHERE Admin='$password'"; $result = mysql_query($sql); $count = mysql_num_rows($result); if($count==1){ $_session['Admin'] = 'Admin'; echo "<center>Logged in as Administrator</center>"; ?> <meta http-equiv="REFRESH" content="0;url=index.php"></HEAD> <?php }else{ $sql2="SELECT * FROM passwords WHERE Moderator='$password'"; $result2 = mysql_query($sql2); $count2 = mysql_num_rows($result2); if($count2==1){ $_session['Mod'] = 'Mod'; echo "<center>Logged in as Moderator</center>"; ?> <meta http-equiv="REFRESH" content="0;url=index.php"></HEAD> <?php }else{ echo "<center>Wrong password!</center>"; } } break; Cheers. P.S IF YOUR WONDERING WHAT THE PROBLEM IS: Sorry I didn't post on this, but I'm trying to create a session so that I can get this: <?php session_start(); if (isset($_SESSION['Mod'])){ ?> <li><a href="index.php?action=logout">Logout (Mod)</a></li> <li><a href="control.php">Mod Panel</a></li> <?php }else{ if (isset($_SESSION['Admin'])){ ?> <li><a href="index.php?action=logout">Logout (Admin)</a></li> <li><a href="control.php">Admin Panel</a></li> <?php }else{ ?> <li><a href="index.php?action=login">Login ()</a></li> <?php } } ?> Working, But when I login, it refreshes me home but it still says "Login ()" and not "Logout (Mod/Admin)". Quote Link to comment Share on other sites More sharing options...
btherl Posted March 16, 2010 Share Posted March 16, 2010 What you've posted here is using $_session, not $_SESSION. That was the problem in the original topic you linked to. Only $_SESSION in uppercase will work. Quote Link to comment Share on other sites More sharing options...
Twist3d Posted March 16, 2010 Author Share Posted March 16, 2010 What you've posted here is using $_session, not $_SESSION. That was the problem in the original topic you linked to. Only $_SESSION in uppercase will work. The link I provided shows that I changed it to that and thanked the guy who showed me that was the problem. In other words, I have already done it. Sorry for not updating the code. Quote Link to comment Share on other sites More sharing options...
Twist3d Posted March 16, 2010 Author Share Posted March 16, 2010 Anyone have a solution please? Sorry for dp. Quote Link to comment Share on other sites More sharing options...
btherl Posted March 18, 2010 Share Posted March 18, 2010 Can you post your current code please. Quote Link to comment 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.