pjheliking Posted October 9, 2008 Share Posted October 9, 2008 any reason why this shouldnt work? <? session_start(); $username = $_POST['username']; $password = md5($_POST['password']); $url = $_SERVER['PHP_SELF']; $user = 'web177'; $pswd = 'asdsad'; $db = 'web177'; $conn = mysql_connect('192.168.1.6', $user, $pswd); mysql_select_db($db, $conn); $query = "SELECT * FROM login WHERE username = '$username' AND password = PASSWORD('$password')"; $result = mysql_query($query) or die("Unable to verify user because : " . mysql_error()); if(mysql_num_rows($result) == 1){ $_SESSION = true; session_register('username'); header("Location: divert.php?goto=".$url.""); }else{ header('Location: logfail.php') ; } ?> just it aint working and it has before its one i did earlier copied and pasted and changed the db details but thats not the problem hence i blocked that part out Quote Link to comment Share on other sites More sharing options...
revraz Posted October 9, 2008 Share Posted October 9, 2008 What isn't working? Is it not validating, is it not running, is it not redirecting on bad pw...? Chances are, it's not matching up the PW, if so then your DB isn't set like your other one. Check the field type and length of your PW field in the DB, since you use MD5 it should be VARCHAR and at least 40 length. Quote Link to comment Share on other sites More sharing options...
aebstract Posted October 9, 2008 Share Posted October 9, 2008 Are you getting any errors or problems? Throw ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); at the top and see if you get any errors Quote Link to comment Share on other sites More sharing options...
pjheliking Posted October 9, 2008 Author Share Posted October 9, 2008 i was just about to do the report all but i thought ill hash the pass elsewhere set the variable and put the variable in the password bit it worked and im up and running. i didnt hash on my other project thats why thanks yall Quote Link to comment 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.