php - can't see my site after log in -
i've got error in 'index.php' membre area site i've got error
warning: mysql_connect() [function.mysql-connect]: host 'srv9.000webhost.com' not allowed connect mysql server in /home/a8479867/public_html/pages/index.php on line 6
warning: mysql_select_db(): supplied argument not valid mysql-link resource in /home/a8479867/public_html/pages/index.php on line 7
warning: mysql_query() [function.mysql-query]: access denied user 'a8479867'@'localhost' (using password: no) in /home/a8479867/public_html/pages/index.php on line 11
warning: mysql_query() [function.mysql-query]: link server not established in /home/a8479867/public_html/pages/index.php on line 11
error sql !
select count(*) membre login="momo1o4" , pass_md5="b83287a789719ce4a412b0b9da582cee" access denied user 'a8479867'@'localhost' (using password: no)
here code
<?php // on teste si le visiteur 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); // tests whether database entry contains couple login / pass $sql = 'select count(*) membre login="'.mysql_escape_string($_post['login']).'" , 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 response obtained, user member if ($data[0] == 1) { session_start(); $_session['login'] = $_post['login']; header('location: membre.php'); exit(); } // if there no response, visitor wrong either in login or password in elseif ($data[0] == 0) { $erreur = 'compte non reconnu.'; } // if not, there 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 connect mysql using ftp username (a8479867) i'm pretty sure still need manually add user (with proper password) mysql.
there should option in webhost panel create mysql users , update passwords.
Comments
Post a Comment