7 Replies - 1059 Views - Last Post: 30 October 2014 - 01:59 PM Rate Topic: -----

#1 Villacaleb   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-October 14

Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 11:11 AM

Hello I am following this http://www.dreaminco...ot-pass-part-2/ and im getting an error "Table 'a9019417_user.login' doesn't exist".

Lost_Pass.php
<?php include_once("connect.php"); ?>
<? require 'functions.php'; ?>

<form method="post" >
  <center>
    <h1><strong>Lost Password</strong></h1>
    <p>Email: 
      <input type="text" name="Email" id="Email">
      <br>
<input type="submit" name="Send" id="Send" value="Send">
    </p>
</center>
</form>
<? 
if (isset($_POST['Send'])) {

$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
		// Generate a random password

$nsql = "SELECT * FROM login WHERE mail='".mysql_real_escape_string($_POST['Email'])."'";
$query = mysql_query($nsql) or die(mysql_error());
$row = mysql_fetch_object($query);
$name = htmlspecialchars($row->name);
$pass = htmlspecialchars($row->pass);
$mail = htmlspecialchars($row->email);

	
	
if((empty($_POST['Email']))){ // if the email field is empty there will be an error

		echo 'You one field empty.';
	}else{
		
	
	  if(empty($name)){ // there is no name with the entered email
		echo 'Invalid information.';
	}else{
	
	  if($_POST['Email'] != $mail){
			echo 'Invalid information.'; // if their is no match in the email
	}else{
	
	if(!checkEmail($_POST['Email'])){ // the checkEmail function we have in our function that saves us time and sapce
		echo 'Your email is not valid!';
	}else{
		
	$result = mysql_query("UPDATE users SET password='$password' WHERE name='" .mysql_real_escape_string($name). "'") 
or die(mysql_error());	

			$to = $_POST['Email'];
    $from = "[email protected]";
    $subject = "Registration - Your Registration Details";

    $message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Game Registration Details</h1>
   Dear $name, <br>
    <center>
Your Username: $name <p>

Your Password: $password <p>

  </body>
</html>";
   
    $headers  = "From: Game Lost Details <[email protected]>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers);             

			echo 'We sent you an email with your Details!';
		
	}
}
}// check if name is unused.
}// check if accepted to the tos.
}// name check.
// if post register.		

?>



connect.php
<?php
    $mysql_server = "mysql8.000webhost.com"; //server
	$mysql_user = "a9019417_user";
	$mysql_password = "ghed8377";
	$mysql_database = "a9019417_user";
	$connection = mysql_connect("$mysql_server","$mysql_user","$mysql_password") or die ("Unable to establish a DB connection");
	$db = mysql_select_db("$mysql_database") or die ("Unable to establish a DB connection");
	
?>


<?
function checkEmail($str) // This function is going to help us filter out bad email from the good one and it makes sure the email enter is in the format of [email protected]
{
	return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);
}


function send_mail($from,$to,$subject,$body)// this is a send email function that will help us send email to the registered users.
{
	$headers = '';
	$headers .= "From: $from\n";
	$headers .= "Reply-to: $from\n";
	$headers .= "Return-Path: $from\n";
	$headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n";
	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Date: " . date('r', time()) . "\n";

	mail($to,$subject,$body,$headers);
}
?>



and the mysql http://puu.sh/cwvVD/c5c36f0b4a.png

Ive been trying to figure this out for a while but nothing happens, Thank you in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Table 'a9019417_user.login' doesn't exist

#2 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,955
  • Joined: 03-December 12

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 11:17 AM

From the looks of what you have provided, the login table does not exist, users is the table name.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15790
  • View blog
  • Posts: 63,277
  • Joined: 12-June 08

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 11:20 AM

I don't know what the actual names are you telling me the user and db name are the same, or is this a copy/paste error when obfuscating that information?
3	    $mysql_user = "a9019417_user";
5	    $mysql_database = "a9019417_user";

Was This Post Helpful? 0
  • +
  • -

#4 Villacaleb   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-October 14

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 12:22 PM

View Postmodi123_1, on 30 October 2014 - 11:20 AM, said:

I don't know what the actual names are you telling me the user and db name are the same, or is this a copy/paste error when obfuscating that information?
3	    $mysql_user = "a9019417_user";
5	    $mysql_database = "a9019417_user";

They are in fact the same, you can try out the register and forgot password here http://goldminer.hos...om/Register.php and http://goldminer.hos...m/Lost_Pass.php after you register.

View Postastonecipher, on 30 October 2014 - 11:17 AM, said:

From the looks of what you have provided, the login table does not exist, users is the table name.

You can try out the register and forgot password here http://goldminer.hos...om/Register.php and http://goldminer.hos...m/Lost_Pass.php after you register.
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15790
  • View blog
  • Posts: 63,277
  • Joined: 12-June 08

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 12:34 PM

Ah, what?
Was This Post Helpful? 0
  • +
  • -

#6 Villacaleb   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-October 14

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 12:45 PM

View Postmodi123_1, on 30 October 2014 - 12:34 PM, said:

Ah, what?

The goal of the program is to generate a new password by taking the email and finding which account has the email and then generate the password and email it, but its claiming for no matter what I put in it cant find the email "Table 'a9019417_user.login'".
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15790
  • View blog
  • Posts: 63,277
  • Joined: 12-June 08

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 12:50 PM

See.. here's what is funny to me. If this is all, indeed, your name and password biz.. then it stands to reason that something named "_user" is *NOT* a table name. That would be your user name.
Was This Post Helpful? 0
  • +
  • -

#8 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6259
  • View blog
  • Posts: 24,028
  • Joined: 23-August 08

Re: Table 'a9019417_user.login' doesn't exist

Posted 30 October 2014 - 01:59 PM

Your table name is users, not login. So trying select * from login isn't going to work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1