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"); ?> 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 } } } 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
Archived
This topic is now archived and is closed to further replies.