/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function login( $user, $pass ) { { $user = escape( $user ); $pass = escape( $pass ); { $error = "Username field is empty!"; } { $error = "Password field is empty!"; } else { $fetch = mysql_query( "SELECT * FROM `user` WHERE `user` = '".$user."' AND `pass` = '".$pass."' LIMIT 1" ) or die ( mysql_error() ); { $error = "Username or password is incorrect!"; } else { $_SESSION['id'] = $got['id']; } } } }