gpt4 book ai didi

php - 登录后看不到我的网站

转载 作者:行者123 更新时间:2023-11-29 13:09:21 24 4
gpt4 key购买 nike

我的网站成员(member)区域的“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

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a8479867/public_html/pages/index.php on line 7

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

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

SQL 错误!

SELECT count(*) FROM membre WHERE login="momo1o4" AND pass_md5="b83287a789719ce4a412b0b9da582cee"
Access denied for user 'a8479867'@'localhost' (using password: NO)

这是我的代码

<?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>

最佳答案

您似乎正在尝试使用 ftp 用户名 (a8479867) 连接到 mysql,但我很确定您仍然需要手动将该用户(使用正确的密码)添加到 mysql。

您的虚拟主机面板中应该有一个选项来创建 mysql 用户并更新其密码。

关于php - 登录后看不到我的网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22298089/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com