blesseld Posted August 26, 2009 Share Posted August 26, 2009 Hey, In my login script, If the user enters an invalid login the include works, also if they leave a field empty it works. But because there is a die() and it just says "you are now logged in, click here." The include is my middle content div, and footer. I can't figure out how to make this script load my include if its a successful login. Here is the login script <?php include_once 'tbnl-header.php'; echo "<h3>Member Log in</h3>"; $error = $user = $pass = ""; if (isset($_POST['user'])) { $user = sanitizeString($_POST['user']); $pass = sanitizeString($_POST['pass']); if ($user == "" || $pass == "") { $error = "Not all fields were entered<br />"; } else { $query = "SELECT user,pass FROM tbnlmembers WHERE user='$user' AND pass='$pass'"; if (mysql_num_rows(queryMysql($query)) == 0) { $error = "Username/Password invalid<br />"; } else { $_SESSION['user'] = $user; $_SESSION['pass'] = $pass; die("You are now logged in. Please <a href='tbnl-members.php?view=$user'>click here</a>.)"); } } } echo <<<_END <form method='post' action='tbnl-login.php'>$error Username <input type='text' maxlength='16' name='user' value='$user' /><br /> Password <input type='password' maxlength='16' name='pass' value='$pass' /><br /> <input type='submit' value='Login' /> </form> _END; include("../inc/page-bot.php"); ?> any ideas how I can get this to load include("../inc/page-bot.php"); after die("You are now logged in. Please <a href='tbnl-members.php?view=$user'>click here</a>.)"); Thanks in advance Quote Link to comment Share on other sites More sharing options...
merck_delmoro Posted August 26, 2009 Share Posted August 26, 2009 cant understand make it more clearly Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 26, 2009 Share Posted August 26, 2009 well spotted ... 10/10 man, if it the prob lol Quote Link to comment Share on other sites More sharing options...
blesseld Posted August 26, 2009 Author Share Posted August 26, 2009 Fatal error: Call to undefined function msql_query() in /home/tbaynigh/public_html/members/tbnl-login.php on line 17 Quote Link to comment Share on other sites More sharing options...
blesseld Posted August 26, 2009 Author Share Posted August 26, 2009 <?php include_once 'tbnl-header.php'; echo "<h3>Member Log in</h3>"; $error = $user = $pass = ""; if (isset($_POST['user'])) { $user = sanitizeString($_POST['user']); $pass = sanitizeString($_POST['pass']); if ($user == "" || $pass == "") { $error = "Not all fields were entered<br />"; } else { $query = "SELECT user,pass FROM tbnlmembers WHERE user='$user' AND pass='$pass'"; if (mysql_num_rows(msql_query($query)) == 0) { $error = "Username/Password invalid<br />"; } else { $_SESSION['user'] = $user; $_SESSION['pass'] = $pass; die("You are now logged in. Please <a href='tbnl-members.php?view=$user'>click here</a>.)"); } } } echo <<< _END <form method='post' action='tbnl-login.php'>$error Username <input type='text' maxlength='16' name='user' value='$user' /><br /> Password <input type='password' maxlength='16' name='pass' value='$pass' /><br /> <input type='submit' value='Login' /> </form> _END; include ("../inc/page-bot.php"); ?> If there is a successful login, my include "page-bot" will not load Quote Link to comment Share on other sites More sharing options...
merck_delmoro Posted August 26, 2009 Share Posted August 26, 2009 you should always place the include on the top of your code not on the bottom and "mysql_query" not "msql_query" Quote Link to comment Share on other sites More sharing options...
blesseld Posted August 26, 2009 Author Share Posted August 26, 2009 How else could i get my footer to load then on the successful login? 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.