登录后无法看到我的网站
i've got a error in my 'index.php' for my membre area for my site i've got those error
我的'index.php'中有错误,因为我的网站我的网站区域有错误
Warning: mysql_connect() [function.mysql-connect]: Host 'srv9.000webhost.com' is not allowed to connect to this MySQL server in /home/a8479867/public_html/pages/index.php on line 6
警告:mysql_connect()[function.mysql-connect]:主机'srv9.000webhost.com'不允许在第6行的/home/a8479867/public_html/pages/index.php中连接到此MySQL服务器
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a8479867/public_html/pages/index.php on line 7
警告:mysql_select_db():提供的参数不是第7行/home/a8479867/public_html/pages/index.php中的有效MySQL-Link资源
Warning: mysql_query() [function.mysql-query]: Access denied for user 'a8479867'@'localhost' (using password: NO) in /home/a8479867/public_html/pages/index.php on line 11
警告:mysql_query()[function.mysql-query]:第11行/home/a8479867/public_html/pages/index.php中用户'a8479867'@'localhost'(使用密码:NO)拒绝访问
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/a8479867/public_html/pages/index.php on line 11
警告:mysql_query()[function.mysql-query]:无法在第11行的/home/a8479867/public_html/pages/index.php中建立到服务器的链接
Error SQL !
错误SQL!
SELECT count(*) FROM membre WHERE login="momo1o4" AND pass_md5="b83287a789719ce4a412b0b9da582cee"
Access denied for user 'a8479867'@'localhost' (using password: NO)
Here is my Code
这是我的代码
<?php
// on teste si le visiteur a soumis le formulaire de connexion
if (isset($_POST['connexion']) && $_POST['connexion'] == 'Connexion') {
if ((isset($_POST['login']) && !empty($_POST['login'])) && (isset($_POST['pass']) && !empty($_POST['pass']))) {
$base = mysql_connect ('server', 'login', 'password');
mysql_select_db ('nom_base', $base);
// it tests whether a database entry contains the couple login / pass
$sql = 'SELECT count(*) FROM membre WHERE login="'.mysql_escape_string($_POST['login']).'" AND pass_md5="'.mysql_escape_string(md5($_POST['pass'])).'"';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$data = mysql_fetch_array($req);
mysql_free_result($req);
mysql_close();
// if a response is obtained, then the user is a member
if ($data[0] == 1) {
session_start();
$_SESSION['login'] = $_POST['login'];
header('Location: membre.php');
exit();
}
// if there is no response, the visitor was wrong either in his login or password in
elseif ($data[0] == 0) {
$erreur = 'Compte non reconnu.';
}
// if not, then there is a big problem :)
else {
$erreur = 'Probème dans la base de données : plusieurs membres ont les mêmes identifiants de connexion.';
}
}
else {
$erreur = 'Au moins un des champs est vide.';
}
}
?>
<html>
<head>
<title>Accueil</title>
</head>
<body>
Connexion à l'espace membre :<br />
<form action="index.php" method="post">
Login : <input type="text" name="login" value="<?php if (isset($_POST['login'])) echo htmlentities(trim($_POST['login'])); ?>"><br />
Mot de passe : <input type="password" name="pass" value="<?php if (isset($_POST['pass'])) echo htmlentities(trim($_POST['pass'])); ?>"><br />
<input type="submit" name="connexion" value="Connexion">
</form>
<a href="inscription.php">Vous inscrire</a>
<?php
if (isset($erreur)) echo '<br /><br />',$erreur;
?>
</body>
</html>
1 个解决方案
#1
1
It seems you're trying to connect to mysql using your ftp username (a8479867) but I'm pretty sure you still need to manually add that user (with a proper password) to mysql.
看来你正在尝试使用你的ftp用户名(a8479867)连接到mysql,但我很确定你仍然需要手动将该用户(使用正确的密码)添加到mysql。
There should be an option in your webhost panel to create mysql users and update their passwords.
您的webhost面板中应该有一个选项来创建mysql用户并更新其密码。
更多相关文章
- 如何区分socket.io聊天中的Symfony用户角色/组
- PHP万能密码登陆
- 从mysql中选择加密密码
- php微信网页授权获取用户信息
- Laravel Auth只验证管理员/超级用户
- 用户GROUP BY ERROR之间的SQL查询privatemsgs
- 使用PHP显示用户输入
- 根据网址上的国家/地区将用户重定向到正确的数据库,我使用i18n fo
- PHP结合Redis来限制用户或者IP某个时间段内访问的次数