luvlemonade Posted May 11, 2007 Share Posted May 11, 2007 i have never used md5 password for user register before. i juz made it and it worked, but im having problem in login script here is the code: <?php session_start(); # get value that was sent from the form $username = $_POST['username']; $pwd = md5($_POST['password']); # username and password may not be empty if (empty($username) or empty($pwd)) { echo "username or password may not be empty"; die ("<a href='login.php'>Login Ulang</a>"); } # login prosses $valid = check_user($username,$pwd); if ($valid == true) { check_valid_user($username,$pwd); header("location:index.php"); } else { header("location:errLogin.php"); } #################### Definition of function ######################### function check_user($username, $pwd) { include('connect/configdb.php'); $sql="select count(*) from member where username = '$username' and password = '$pwd'"; $result = mysql_query($sql); $rows=mysql_fetch_row($hasil); if ($rows[0] > 0) return true; else return false; } function cek_valid_user($username,$pwd) { include('connect/configdb.php'); $sql="select * from member where username='$username' and password='$pwd'"; $result=mysql_query($sql); $rec=mysql_fetch_assoc($result); $_SESSION['username']=$rec['username']; $_SESSION['logged_in']=TRUE; header("location:index.php"); } ?> duhhh can anyone please show where the error is Quote Link to comment https://forums.phpfreaks.com/topic/50906-login-script-with-md5-password/ Share on other sites More sharing options...
chronister Posted May 11, 2007 Share Posted May 11, 2007 A little more description would be helpful. What error message are you getting? What is the script doing? What are you expecting it to do? function cek_valid_user($username,$pwd) check_valid_user($username,$pwd); See the problem? If this don't solve it, then go with what I started off with and give more details. Nate Quote Link to comment https://forums.phpfreaks.com/topic/50906-login-script-with-md5-password/#findComment-250393 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.