|
|
|
| Web Hosting Guide |
![]() ![]() |
Password Recovery Script |
Feb 5 2008, 12:06 PM
Post
#1
|
|
|
Premium Member Group: [HOSTED] Posts: 212 Joined: 19-January 08 From: Zagreb/Croatia Member No.: 27,735 myCENTs:10.93 |
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: 445 Joined: 16-February 06 From: Kolkata, India Member No.: 11,322 myCENTs:65.75 |
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,314 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 myCENTs:14.53 |
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
|
|
|
Premium Member Group: [HOSTED] Posts: 212 Joined: 19-January 08 From: Zagreb/Croatia Member No.: 27,735 myCENTs:10.93 |
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: 445 Joined: 16-February 06 From: Kolkata, India Member No.: 11,322 myCENTs:65.75 |
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
|
|
|
Premium Member Group: [HOSTED] Posts: 212 Joined: 19-January 08 From: Zagreb/Croatia Member No.: 27,735 myCENTs:10.93 |
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
|
|
|
Premium Member Group: [HOSTED] Posts: 212 Joined: 19-January 08 From: Zagreb/Croatia Member No.: 27,735 myCENTs:10.93 |
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) |
|
|
|
Sep 9 2009, 02:22 AM
Post
#8
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
well their really isn't any confirmation.. Like what happened after you enter the user and pass.. It just changes the username and pass without verification.. So you could just put anyone's user and pass in.. -reply by nate |
|
|
|
![]() ![]() |
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 | |||
|---|---|---|---|---|---|---|---|
![]() |
26 | Feelay | 5,904 | 8th November 2009 - 11:27 PM Last post by: iG-JT |
|||
![]() |
5 | Niru | 3,788 | 5th November 2009 - 08:04 AM Last post by: iG-balajee |
|||
![]() |
7 | bluefish | 2,796 | 3rd November 2009 - 09:29 PM Last post by: HannahI |
|||
![]() |
10 | yordan | 2,215 | 27th October 2009 - 11:31 PM Last post by: HannahI |
|||
![]() |
9 | Emusic.SR.mN | 6,908 | 19th October 2009 - 12:00 PM Last post by: iG-PhoneandIT.com |
|||
![]() |
2 | pbolduc | 2,756 | 3rd October 2009 - 08:20 PM Last post by: iG-Andrew |
|||
![]() |
22 | TavoxPeru | 10,385 | 2nd October 2009 - 07:53 AM Last post by: iG-Mel |
|||
![]() |
5 | soleimanian | 1,209 | 30th September 2009 - 02:01 PM Last post by: iGuest |
|||
![]() |
9 | crs_cwiz | 3,862 | 24th September 2009 - 10:19 PM Last post by: iG- |
|||
![]() |
11 | soleimanian | 4,171 | 22nd September 2009 - 12:01 PM Last post by: iG- |
|||
![]() |
12 | m3th | 6,613 | 29th August 2009 - 12:16 AM Last post by: dmnhunter |
|||
![]() |
13 | tansqrx | 2,639 | 23rd August 2009 - 07:31 AM Last post by: surfermac |
|||
![]() |
2 | Alex@Synergy | 3,987 | 23rd July 2009 - 02:11 PM Last post by: iG-peter |
|||
![]() |
12 | Omkar™ | 2,804 | 22nd July 2009 - 11:58 AM Last post by: iG-stranger |
|||
![]() |
7 | Niru | 3,851 | 14th July 2009 - 11:50 AM Last post by: saint-michael |
|||
|
Lo-Fi Version | Time is now: 22nd November 2009 - 02:20 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





