scarhand Posted October 18, 2007 Share Posted October 18, 2007 i have no clue why this isnt working if i dont put in the right password i get the error message, but if i do put in the right password it just takes me back to the login screen heres my code: <?php session_start(); include '../sbxr_connect.php'; include 'header.php'; $adminsql = mysql_query("SELECT * FROM admin") or die(mysql_error()); while($row = mysql_fetch_array($adminsql)) { $adminpassword = $row['adminpassword']; } function adminLogin() { global $notify; ?> <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"> <tr> <td width="100%" height="100%" align="center" valign="middle"> <table cellpadding="0" cellspacing="0" border="0" width="600" align="center"> <tr> <td width="100%" class="contentbox" align="center"> <font class="header2"> admin login </font> <br /> <br /> <?php echo "$notify"; ?> <br /> <br /> <form method="post"> <input name="passtry" type="password" maxlength="50" size="30"> <br /> <br /> <input name="login" type="submit" value="Login"> </form> </td> </tr> </table> <br /> <br /> </td> </tr> </table> <?php } function adminIndex() { ?> <table cellpadding="0" cellspacing="0" border="0" width="600" align="center"> <tr> <td width="100%" class="contentbox"> <center> <font class="header2"> Welcome, admin! </font> </center> <br /> Welcome to the admin control panel. From here you can change your admin password, configure general options, edit your shoutbox colors and style, edit shouts, ban IP's, add word censors, and more. <br /> <br /> Please use the menu at the top of this page in order to navigate through your control panel and administer. </td> </tr> </table> <?php } if (isset($_SESSION['adminpassword'])) { if ($_SESSION['adminpassword'] == $adminpassword) { $loggedin = true; } } if (isset($_POST['login'])) { if ($_POST['passtry'] == $adminpassword) { $_SESSION['adminpassword'] = $adminpassword; } else { $notify = "You have entered an invalid admin password, please try again"; } } else { $notify = "Please enter the admin password"; } if ($loggedin == true) { include 'admin_header.php'; switch($_GET['edit']) { case 'general': editGeneral(); break; case 'style': editStyle(); break; case 'shouts': editShouts(); break; case 'bans': editBans(); break; case 'censors': editCensors(); break; default: adminIndex(); } include 'admin_footer.php'; } else { adminLogin(); } include 'footer.php'; ?> i know it is successfully getting the password out of the database, but it isnt taking me to the adminIndex page when I've logged in......any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
trq Posted October 18, 2007 Share Posted October 18, 2007 Sorry, but your code is near impossible to read. What editor are you using? Fix your code so it is readble and you might get some more help. 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.