gammaman Posted April 29, 2008 Share Posted April 29, 2008 I have a page that uses sessions received from a form on the previous page. If I enter an invalid user name and password it falls into the else as it should. However if I return to the log in page is indicated in the else clause, and I enter the valid user name and password, it still says it is invalid. I think I may need to unset the sessions when it falls into the else but I am not sure. Here is the code. <?php $Conn=mysql_connect("localhost","fierm","13183"); if(!$Conn){ echo "failed"; } else{ mysql_select_db("fierm"); session_start(); if (!isset($_SESSION['admin']['admins'])) { $_SESSION['admin']=$_POST; $_SESSION['admin']['admins']; $_SESSION['admin']['adminpass']; } if(($_SESSION['admin']['admins'] == "root") && ($_SESSION['admin']['adminpass']=="pwd123")){ echo "<a href=\"addCourse.php\">Add Courses</a>"; echo "<br />"; echo "<a href=\"addStudent.php\">Add Student</a>"; echo "<br />"; echo "<a href=\"addGrades.php\">Input Grades</a>"; } else{ echo "Invalid Password, Return To Login"; echo "<br/>"; echo "<a href=\"alog.php\">Login</a>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/103407-issue-with-sessions/ Share on other sites More sharing options...
gammaman Posted April 29, 2008 Author Share Posted April 29, 2008 OK the unset worked however if I enter one of the links once accpeted and still want to return to the login page, if I then enter an invalid password it accpets it. Link to comment https://forums.phpfreaks.com/topic/103407-issue-with-sessions/#findComment-529546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.