简体   繁体   中英

can't see my site after log in

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM