Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Password Recovery Script
Eggie
post Feb 5 2008, 12:06 PM
Post #1


Advanced Member
Group Icon

Group: Members
Posts: 130
Joined: 19-January 08
From: Zagreb/Croatia
Member No.: 27,735



While trying to make password recovery script for "bhupinunder" i run into a problem...
i made this:
CODE
<?php
$dbh = mysql_connect('localhost','jaskaran_gc','gc') or die ("Cannot Connect: " . mysql_error());
mysql_select_db('jaskaran_gc',$dbh);
?>
<form method=post action=restore.php?recover=answer>
<?php print"Email:</td><td><input type=text name=email></td></tr>";?>
<P><INPUT TYPE=submit VALUE=Submit!></P></form>
<?php
if ($recover=answer) print"$email";
?>

and it doesn't print anything...but if i put it like this
CODE
<?php
$dbh = mysql_connect('localhost','jaskaran_gc','gc') or die ("Cannot Connect: " . mysql_error());
mysql_select_db('jaskaran_gc',$dbh);
?>
<form method=post action=restore.php?recover=answer>
<?php print"Email:</td><td><input type=text name=email></td></tr>";?>
<P><INPUT TYPE=submit VALUE=Validate it!></P></form>
<?php
if ($recover=answer) print"ssss";
?>

it just shows that form and prints
QUOTE
ssss

how do i make it that i type email and click submit that the email is stored in "$email"
if someone help me with that i don't think that i'll have any problems storing it in mysql! tongue.gif
pls respond
Go to the top of the page
 
+Quote Post
turbopowerdmaxst...
post Feb 5 2008, 05:37 PM
Post #2


Premium Member
Group Icon

Group: [HOSTED]
Posts: 367
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322



email is the name of the field in the form, correct? Depending on the HTTP method of submission you are using for the form, you can retrieve the values as:-

$_GET['email'] for GET method
$_POST['email'] for POST method
Go to the top of the page
 
+Quote Post
Quatrux
post Feb 5 2008, 09:28 PM
Post #3


the Q
Group Icon

Group: [HOSTED]
Posts: 1,017
Joined: 13-July 05
From: Lithuania, Vilnius
Member No.: 7,059



It's one of the worst things I ever saw in a while, but anyway, I just fixed some things, it might work, I didn't test anything by myself, but I guess it should work, even though I think you're still learning and are just practicing, this is why I just fixed some stuff.

CODE
<?php
$dbh = mysql_connect('localhost','jaskaran_gc','gc') or die("Cannot Connect: " . mysql_error());
mysql_select_db('jaskaran_gc',$dbh);
?>
<form method="post" action="restore.php?recover=answer">
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<p><input type="submit" value="Submit!"></p>
</form>
<?php
if ($_GET['recover'] == 'answer') echo $_POST['email'];
?>
Go to the top of the page
 
+Quote Post
Eggie
post Feb 5 2008, 10:18 PM
Post #4


Advanced Member
Group Icon

Group: Members
Posts: 130
Joined: 19-January 08
From: Zagreb/Croatia
Member No.: 27,735



CODE
<?php
$dbh = mysql_connect('localhost','jaskaran_gc','gc') or die("Cannot Connect: " . mysql_error());
mysql_select_db('jaskaran_gc',$dbh);
?>
<form method="post" action="restore.php?recover=answer">
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<tr><td>pass:</td><td><input type="password" name="pass"></td></tr>
<p><input type="submit" value="Submit!"></p>
</form>
<?php
if ($_GET['recover'] == 'answer') mysql_query("update users set userpass=$_POST['pass'] where email=$_POST['email']") or die(mysql_error());
?>


whats wrong now?(i should have asked from the start for someone to solve it now now when no one will answer)

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/jaskaran/public_html/restore.php on line 11

This post has been edited by Eggie: Feb 5 2008, 11:06 PM
Go to the top of the page
 
+Quote Post
turbopowerdmaxst...
post Feb 6 2008, 04:44 AM
Post #5


Premium Member
Group Icon

Group: [HOSTED]
Posts: 367
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322



Use $_POST outside of the double quotes.

CODE
if ($_GET['recover'] == 'answer') mysql_query("update users set userpass=" . $_POST['pass'] . "where email=" . $_POST['email']) or die(mysql_error());


This post has been edited by turbopowerdmaxsteel: Feb 6 2008, 04:49 AM
Go to the top of the page
 
+Quote Post
Eggie
post Feb 6 2008, 06:48 AM
Post #6


Advanced Member
Group Icon

Group: Members
Posts: 130
Joined: 19-January 08
From: Zagreb/Croatia
Member No.: 27,735



You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'email=jurica@mail.com' at line 1
Go to the top of the page
 
+Quote Post
Eggie
post Feb 6 2008, 07:07 AM
Post #7


Advanced Member
Group Icon

Group: Members
Posts: 130
Joined: 19-January 08
From: Zagreb/Croatia
Member No.: 27,735



solved again smile.gif))

CODE
mysql_query("UPDATE users SET userpass = '".md5($_POST['pass'])."' WHERE email = '".$_POST['email']."'") or die(mysql_error());


pls put [SOLVED] in the topic name(and delete this)
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Trainable Anti-spam Filter Script(3)
  2. Php Script To Download File From Another Site(9)
  3. Need Help With A PHP - MySQL Registration Script(13)
  4. [PHP + MySQL] Encrypting Data(9)
  5. What Would Make A Good Registration Script?(4)
  6. Auto Responder Script(6)
  7. Need Help With 2-Way Password Encryption(8)
  8. Installed A PR Checker Script - But Not Working Correctly(6)
  9. How To Delete File Using PHP Shell Script(3)
  10. Online Multiplayer Chess Script(2)
  11. Automated File Structure Creation Script(3)
  12. Authentication Script(1)
  13. Login Script(5)
  14. Please Help (php Join Script)(5)
  15. Automatic/remote Php Script Execution(9)
  1. Something Wrong With This Script?(9)
  2. Automated Product Suggestion Script(2)
  3. Run A Script When Expires A Session(6)
  4. Php Script Help(1)
  5. SQL Doesn't Connect In PHP Script(19)
  6. Warning: Mysql_result(): Supplied Argument Is Not A Valid Mysql Result Resource In ...(4)
  7. Login Script(8)
  8. Free Forum Hosting Type Script Help!(2)
  9. Script Request(2)
  10. Writing And Testing My Own Login Script [solved](20)
  11. Make A Script Run Even If No User Is Online(6)
  12. Php Login Script(0)
  13. Myspacetv Download Php Script Help(6)


 



- Lo-Fi Version Time is now: 30th August 2008 - 04:06 PM