iStriide Posted August 4, 2010 Share Posted August 4, 2010 i have already made the register page where their info goes into the database, and im not sure about the code that selects values from the database. mysql_connect('', '', ''); mysql_select_db(''); $user = $_POST['user']; $pass = $_POST['pass']; echo "<font color='white'>You Need To Login</font>"; if($user == Username && $pass == Password) echo "Welcome $user"; mysql_query("SELECT ('Username', 'Password') FROM login"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/209765-php-login-system-with-mysql-need-help/ Share on other sites More sharing options...
trq Posted August 4, 2010 Share Posted August 4, 2010 mysql_connect('', '', ''); mysql_select_db(''); if (isset($_POST['submit'])) { $user = mysql_real_escape_string($_POST['user']); $pass = mysql_real_escape_string($_POST['pass']); $sql = "SELECT id FROM login WHERE username = '$user' && `password` = MD5('$pass')"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // $user & $pass are valid } else { // $user || $pass invalid } } } Quote Link to comment https://forums.phpfreaks.com/topic/209765-php-login-system-with-mysql-need-help/#findComment-1095009 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.