Jump to content

[SOLVED] Updating Password question


tqla

Recommended Posts

I have the form below with an email field that should get passed through to the next form.

 

<body>
<form name="form1" method="post" action="expiredresetscript.php">
  email address: 
    <input name="email" type="text" id="email">
    <input type="submit" name="Submit" value="Submit">
</form>
</body>

 

 

This form below is supposed to take that email and update a table called Member with a new password and is also supposed to update the dayCounter column with a new timestamp. 

 

 

<?php
require_once('Connections/Auth.php'); 
$connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) 
or die ("Couldn't connect to server.");
$db = mysql_select_db($database_Auth, $connection)
or die ("Couldn't select database.");
$date=time();                                 
mysql_query('UPDATE `Member` SET `password` = shop, `dayCounter` = $date WHERE `email` = $_POST['email']);
echo 'The password is now shop.';
?>

 

 

It doesn't seem to work. Can someone take a look at this and tell me where I've gone bad?

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/
Share on other sites

I spoke too soon. It did not work after all.

 

Can some take a look at this and see where I'm going wrong now?

 

Here's my Form:

 

<body><form name="form1" method="post" action="expiredpwscript.php">
  email address: 
    <input name="email" type="text" id="email">
    <input type="submit" name="Submit" value="Submit">
</form>
</body>

 

Here's to script:

 

<?php
require_once('../Connections/Auth.php'); 
$connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) 
or die ("Couldn't connect to server.");
$db = mysql_select_db($database_Auth, $connection)
or die ("Couldn't select database.");
$date=time();                                 
mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `email` = ".$_POST['email']."")or die(mysql_error());
echo 'The password is now shop.';
?>

 

I put in my email and get this error:

 

You have an error in your SQL syntax near '@myemail.com' at line 1

 

Thanks.

I spoke too soon. It did not work after all.

 

Can some take a look at this and see where I'm going wrong now?

 

Here's my Form:

 

<body><form name="form1" method="post" action="expiredpwscript.php">
  email address: 
    <input name="email" type="text" id="email">
    <input type="submit" name="Submit" value="Submit">
</form>
</body>

 

Here's to script:

 

<?php
require_once('../Connections/Auth.php'); 
$connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) 
or die ("Couldn't connect to server.");
$db = mysql_select_db($database_Auth, $connection)
or die ("Couldn't select database.");
$date=time();                                 
mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `email` = ".$_POST['email']."")or die(mysql_error());
echo 'The password is now shop.';
?>

 

I put in my email and get this error:

 

You have an error in your SQL syntax near '@myemail.com' at line 1

 

Thanks.

 

For as much as I can see, the @ symbol seems to causing the problem...

Thanks Trecool999. I thought about what you said and changed the script to:

 

FORM:

<form name="form1" method="post" action="expiredpwscript.php">
  User Name: 
    <input name="loginName" type="text" id="loginName">
    <input type="submit" name="Submit" value="Submit">
</form>

 

SCRIPT:

<?php
require_once('../Connections/Auth.php'); 
$connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) 
or die ("Couldn't connect to server.");
$db = mysql_select_db($database_Auth, $connection)
or die ("Couldn't select database.");
$date=time();                                 
mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `loginName` = ".$_POST['loginName']."")or die(mysql_error());
echo 'The password is now shop.';
?>

 

The result is now:

 

Unknown column 'test' in 'where clause'

 

That's weird. There is no column called 'test'. That is the name of a user's `loginName` in the Member DB table. `Test` is what I put in the form. I want to change Test's password to "shop" and update the `dayCounter` with a new timestamp.

 

 

 

I need help! Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.