doumi1884 2014-03-10 10:48
浏览 30

登录后无法看到我的网站

i've got a error in my 'index.php' for my membre area for my site i've got those error

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

Error 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条回答 默认 最新

  • dqp21271 2014-03-10 10:55
    关注

    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.

    There should be an option in your webhost panel to create mysql users and update their passwords.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。