|
|
|
| Web Hosting |
![]() ![]() |
Password Recovery Script |
Feb 5 2008, 12:06 PM
Post
#1
|
|
|
Advanced Member Group: [HOSTED] Posts: 177 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! pls respond |
|
|
|
Feb 5 2008, 05:37 PM
Post
#2
|
|
|
Premium Member Group: [HOSTED] Posts: 427 Joined: 16-February 06 From: Kolkata, India Member No.: 11,322 myCENTs:29.11 |
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 |
|
|
|
Feb 5 2008, 09:28 PM
Post
#3
|
|
|
the Q Group: [HOSTED] Posts: 1,205 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 myCENTs:49.62 |
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']; ?> |
|
|
|
Feb 5 2008, 10:18 PM
Post
#4
|
|
|
Advanced Member Group: [HOSTED] Posts: 177 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 |
|
|
|
Feb 6 2008, 04:44 AM
Post
#5
|
|
|
Premium Member Group: [HOSTED] Posts: 427 Joined: 16-February 06 From: Kolkata, India Member No.: 11,322 myCENTs:29.11 |
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 |
|
|
|
Feb 6 2008, 06:48 AM
Post
#6
|
|
|
Advanced Member Group: [HOSTED] Posts: 177 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
|
|
|
|
Feb 6 2008, 07:07 AM
Post
#7
|
|
|
Advanced Member Group: [HOSTED] Posts: 177 Joined: 19-January 08 From: Zagreb/Croatia Member No.: 27,735 |
solved again
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) |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
5 | Niru | 1,630 | 3rd January 2009 - 04:28 AM Last post by: iG-Marty |
|||
![]() |
1 | cherri | 1,354 | 21st December 2008 - 09:59 AM Last post by: iG-Christian |
|||
![]() |
13 | Feelay | 1,153 | 19th December 2008 - 03:43 AM Last post by: laniczech |
|||
![]() |
2 | denverporia19 | 1,860 | 11th December 2008 - 10:36 PM Last post by: iG-Marble |
|||
![]() |
10 | m3th | 3,225 | 8th December 2008 - 09:08 PM Last post by: iG-silv3r |
|||
![]() |
5 | websaint | 874 | 6th December 2008 - 06:13 PM Last post by: khalilov |
|||
![]() |
3 | khalilov | 117 | 4th December 2008 - 10:28 AM Last post by: Quatrux |
|||
![]() |
4 | Suxie | 209 | 3rd December 2008 - 12:25 AM Last post by: magiccode9 |
|||
![]() |
5 | derouge | 1,536 | 30th November 2008 - 07:16 AM Last post by: iG-Rev.Keith Ratliff |
|||
![]() |
8 | Kart | 1,700 | 25th November 2008 - 04:51 AM Last post by: iG-Jeffry |
|||
![]() |
24 | JohnNitro | 9,645 | 14th November 2008 - 11:54 AM Last post by: Guest |
|||
![]() |
0 | khalilov | 153 | 9th November 2008 - 11:10 AM Last post by: khalilov |
|||
![]() |
15 | coder2000 | 6,324 | 7th November 2008 - 03:44 PM Last post by: Shag |
|||
![]() |
7 | tansqrx | 592 | 9th October 2008 - 11:21 AM Last post by: Atomic0 |
|||
![]() |
3 | FirefoxRocks | 310 | 29th September 2008 - 03:03 AM Last post by: FirefoxRocks |
|||
|
Lo-Fi Version | Time is now: 7th January 2009 - 11:24 PM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Feb 5 2008, 12:06 PM





