dadamssg Posted April 7, 2009 Share Posted April 7, 2009 so i had a login script that worked how i wanted, but then i decided to capital the $_SESSION['logname'] via ucwords and it stopped working, so i went and deleted it but its still not working...if i enter the correct username and password it will log me in...but if i just press enter without anything in the fields or a correct username and a crap password it sends me to my homepage, ...which is nowhere in the script....anyone have a clue whats goin on here? <?php session_start(); # 9 include("caneck.inc"); #10 #13 $cxn = mysqli_connect($host, $user,$passwd,$dbname) or die ("Couldn't connect to server."); #15 $password = mysqli_real_escape_string($cxn, strip_tags($_POST['fpassword'])); $username = mysqli_real_escape_string($cxn, strip_tags($_POST['fusername'])); $sql = "SELECT loginName FROM Member WHERE loginName='$username'"; #18 $result = mysqli_query($cxn,$sql) or die(mysqli_error($cxn)); #20 $num = mysqli_num_rows($result); #21 if ($num > 0) // login name was found #22 { $sql = "SELECT loginName,active FROM Member WHERE loginName='$username' AND password=md5('$password')"; $result2 = mysqli_query($cxn,$sql) or die(mysqli_error($cxn)); $num2 = mysqli_num_rows($result2); $row = mysqli_fetch_assoc($result2); if ($num2 > 0) // password is correct #30 { if($row['active']=="8"){ $_SESSION['auth']="yes"; #32 $logname=$username; $_SESSION['logname'] = $logname; #34 header("Location: /test/project12.php"); } else{header("Location: /test/checkmail.php");} #40 } else // password is not correct #42 { header("Location: /test/register_form.php"); } } #49 elseif ($num == 0) // login name not found #50 { header("Location: /test/register_form.php"); } #56 ?> Link to comment https://forums.phpfreaks.com/topic/152928-login-script-decided-not-to-work/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.