Revision: 44460
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 12, 2011 06:27 by Haddman
Initial Code
function login( $user, $pass ) { if ( isset( $_POST['login'] ) ) { $user = escape( $user ); $pass = escape( $pass ); if ( empty( $user ) ) { $error = "Username field is empty!"; } else if ( empty( $pass ) ) { $error = "Password field is empty!"; } else { $pass = md5( $pass ); $fetch = mysql_query( "SELECT * FROM `user` WHERE `user` = '".$user."' AND `pass` = '".$pass."' LIMIT 1" ) or die ( mysql_error() ); if ( mysql_num_rows( $fetch ) != 1 ) { $error = "Username or password is incorrect!"; } else { $got = mysql_fetch_array( $fetch ); session_start(); $_SESSION['id'] = $got['id']; header( "Location: home.php" ); } } } }
Initial URL
Initial Description
Initial Title
Simple Login Function
Initial Tags
Initial Language
PHP