我得到这些错误:警告:mysql_real_escape_string()是什么意思?
警告:mysql_real_escape_string()[function.mysql实时逃逸字符串]:拒绝访问用户 'a2955851' @ 'localhost' 的(使用密码:NO)在/ home /a2955851/public_html/register.php on line 25
警告:mysql_real_escape_string()[function.mysql-real-escape-string]:访问拒绝用户'a2955851'@'localhost'(使用密码:NO) /home/a2955851/public_html/register.php on line 26
我得到这些错误:
警告:mysql_real_escape_string()[function.mysql实时的逃逸字符串]:到服务器的链接不能在/home/a2955851/public_html/register.php在线25上建立
警告:mysql_real_escape_string()[function.mysql实时逃逸字符串]:到服务器的连接不能在/home/a2955851/public_html/register.php在线成立26
有我的代码:
<!doctype html>
<html lang"fi">
<head>
<link rel="icon" type='image/png' href='images/logo.png'>
<title> ASD</title>
<link href="css/styles.css" type="text/css" rel="stylesheet">
</head>
<body>
<!--reg alkaa-->
<form action="register.php" method="post">
<p><input type="text" name="username" placeholder="Username">
<p><input type="email" name="email" placeholder="Email">
<p><input type="password" name="pass" placeholder="Password">
<p><input type="password" name="pass1" placeholder="Password">
<p><input type="submit" name="submit" value="Register">
</form>
<?php
if (isset($_POST['submit'])) {
$username = mysql_real_escape_string($_POST['username']);
$pass = mysql_real_escape_string($_POST['pass']);
$pass1 = mysql_real_escape_string($_POST['pass1']);
$email = mysql_real_escape_string($_POST['email']);
if ($username && $pass && $pass1 && $email) {
if ($pass==$pass1) {
$connect = mysql_connect("mysql13.000webhost.com","a2955851_SW","********");
mysql_select_db("a2955851_SW");
$query = mysql_query("INSERT INTO users VALUES('$username','$pass','$email');");
echo "You have been registered.";
} else {
echo "Password must match.";
}
} else {
echo "All fields are required.";
}
}
?>
<!--reg loppuu-->
<Center>
<a href="index.php">
<h1> ASD </h1>
</center>
</a>
<div id="main">
<h3>
<div class="menu"> <a href="index.php">Etusivu</a> •
<a href="https://www.google.fi/">Kaikkee</a> •
<a href="https://www.mediafire.com/">Lataukset</a> </div>
</h3>
</div>
<div class="jonne"> </div>
<script src="javascript/jquery.js"></script>
</body>
</html>
我做错了什么?我使用000webhost,我是noob。我的英语能力很差,对不起。
你需要连接“第一个”,然后才能使用mysql_real_escape_string()' – 2014-09-03 16:28:56
怎么样?我是小白,你能帮我多一点吗? – user3774980 2014-09-03 16:29:34
这是您将获得的最佳帮助:使用[** CRYPT_BLOWFISH **](http://security.stackexchange.com/q/36471)或PHP 5.5的['password_hash()'](http ://www.php.net/manual/en/function.password-hash.php)功能。对于PHP <5.5,使用['password_hash()兼容包]](https://github.com/ircmaxell/password_compat)。另外,[**使用准备好的语句**](http://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php)或[**使用准备好的语句**的PDO](http ://php.net/pdo.prepared-statements)。 – 2014-09-03 16:30:35