[英]User login not working unknown error
i don't know what's wrong with my login script. 我不知道我的登录脚本出了什么问题。 It keeps saying invalid username or password. 它一直说无效的用户名或密码。 But in my eyes, everything is set as it should be. 但是在我看来,一切都已经设置好了。
PHP5: PHP5:
<?php require ('../lib/config.php'); ?>
<?php
ob_start();
$tbl_name='users';
$user_name='Username';
$pass_name='Password';
$salt='';
mysql_connect("$cchost", "$ccuser", "$ccpass")or die("cannot connect");
mysql_select_db("$ccname")or die("cannot select DB");
$username=str_replace(' ','_', $myusername);
$myusername=$_POST['username'];
$mypassword=$_POST['password'];
$password=hash('whirlpool', $mypassword);
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM $tbl_name WHERE $user_name='$username' and $pass_name='$password'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$donator=$row['donator'];
$player=$row['player'];
$count=mysql_num_rows($result);
if ($donator == '1') {
session_register("donator");
}
if ($player == '1') {
session_register("player");
}
if($count==1){
session_register("username");
header("Location: index_ucp.php");
}
else {
header("Location: login_ucp.php?err=1");
}
ob_end_flush();
?>
HTML Form: HTML表单:
<div class="login">
<form method="post" name="frmLogin" class="well form-inline" action="dologin.php">
<input name="username" type="text" class="input-medium" placeholder="Username">
<input name="password" type="password" class="input-medium" placeholder="Password">
<button name="btnLogin" type="submit" class="btn">Sign in</button>
</form>
</div>
I'm trying for hours and hours to fix it, but i can't. 我试图解决它的时间和时间都在不断增加,但是我不能。 You all are my last hope. 你们都是我的最后希望。 Thanks in advance! 提前致谢!
You appear to have these two lines in the wrong order: 您似乎以错误的顺序显示了这两行:
$username=str_replace(' ','_', $myusername);
$myusername=$_POST['username'];
Later code will be using $username
which won't have been initialised properly 更高版本的代码将使用$username
,但尚未正确初始化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.