Jump to content

erro na ligação à db


Fakcon
 Share

Recommended Posts

Boas, se alguém me pudesse ajudar era 5 estrelas, desde já obrigado.

erro:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/galactica.awardspace.co.uk/forgot.php on line 7
Account with given email does not exist

Código:

<?php
include 'dbc.php';
if ($_POST['Submit']=='Send')
{
$host = $_SERVER['HTTP_HOST'];
$rs_search = mysql_query("select username_email from jogo_users where username_email='$_POST[email]'");
$username_count = mysql_num_rows($rs_search); // <<<<<<------------ linha 7 AQUI !!!!

if ($username_count != 0)
{
$newpassword = rand(1000,9999);
$host = $_SERVER['HTTP_HOST'];
$newmd5password = md5($newpassword);
mysql_query("UPDATE jogo_users set username_password='$newmd5password' where username_email='$_POST[email]'");
$message = 
"You have requested new login details from $host. Here are the login details...\n\n
User Name: $_POST[email] \n
Password: $newpassword \n
____________________________________________
*** LOGIN ***** \n
To Login: http://$host/index.php \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";

mail($_POST['email'], "New Login Details", $message,
    "From: \"Auto-Response\" <robot@$host>\r\n" .
     "X-Mailer: PHP/" . phpversion());

die("Thank you. New Login details has been sent to your email address");
} else die("Account with given email does not exist");

}
?>
<p> </p>
<h3>Forgot Password</h3>
<p>Please enter your email address and the new password will be sent.</p>
<table width="50%" border="0" cellpadding="1" cellspacing="0">
  <tr>
    <td> 
      <form name="form1" method="post" action="">
        <p><br>
          <strong>Email:</strong> 
          <input name="email" type="text" id="email">
          <input type="submit" name="Submit" value="Send">
        </p>
      </form></td>
  </tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<?php ?>
</body>
</html>

APARTE: Usa o Geshi, torna o post mais legível. 🙂

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.