isamarlow Posted February 27, 2007 Share Posted February 27, 2007 I am in need of a simple login & password script, but I am a total newbie to PHP - I need help. I found some scripts on this site, but I do now know how to use them, one example I found was http://www.phpfreaks.com/quickcode/Very-easy-login-page/663.php?higlight=login+password I copied the 'useage example' to a dreamweaver page, and it looks great but it logs in no matter what you put as your login and password. I'm assuming I need to put the top script somewhere, but where? Can anyone help? I don't have to use the suggested script any script that works will do. Thanks! Isadora Link to comment https://forums.phpfreaks.com/topic/40394-login-password-help/ Share on other sites More sharing options...
Daleeburg Posted February 27, 2007 Share Posted February 27, 2007 here is my favorite login script $query = "SELECT * FROM _members WHERE user = '".$_POST['user']."' "; $result = mysql_query($query) OR DIE("Error In DataBase"); $cuser = @mysql_result($result, 0, user); $cpass = @mysql_result($result, 0, pword); IF(strtolower($_POST['user']) == strtolower($cuser) AND $_POST['pass'] == $cpass AND strlen('user') > 0 AND strlen('pass') > 0){ $_SESSION['user'] = $cuser; ECHO 'You are logged on! One Moment for the Redirection. <a href=*******> Click here </a> If the page does not reload in 15 seconds <meta http-equiv="refresh" content="2; url=********** /> '; }ELSE{ ECHO 'Incorrect User and/or password. Password is case-sensitive.<br>'; }; This assumes your user has posted a user name and password, the password is case sensitive and the user name is not (if you want it to be just take out the strtolower) all my login scripts are of this flavor, you may want to put md5 on the password, but this works too. Link to comment https://forums.phpfreaks.com/topic/40394-login-password-help/#findComment-195474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.