PDA

View Full Version : help me again pls.



PixelResources
23-08-2006, 10:48 PM
<?
include('config.php');
if (!$_POST[submit])

{
?>
<form name="form1" method="post" action="">
<p><font face='Verdana' size='1'><b>
Forgotten Password</b><br /><br /><font face='Verdana' size='1'>
If you have forgotten your Password, you may enter your Username below and you will be sent an Email containing details on how to reset it..<br /><br />
<b>Username;</b><br />
<input name="username" type="text" id="username">
<br />
<br />
<input type="submit" name="submit" value="Recover Password">
</p>
</form><br />
<font face='Verdana' size='1'>+ <a href='login.php' style='text-decoration: none'>Back to Main Page</a>
<?
}
else
{
?>
<?
$username = $_POST[username];
$username = htmlspecialchars($username);
$code=rand(151343,18618774);

$query = mysql_query("INSERT INTO forgotpw (username, code) VALUES('$username','$code')");
$getemail = MYSQL_QUERY("SELECT * email from users WHERE username='$username'");

$sitename = 'PixelResources';
$subject = 'PixelResources Members System - Password Recovery';
$message = 'Hello.. <br>
Please visit the URL below and type in the Validation Code on the page you end up at;<br><br>
http://www.yoursite.com/passcode.php<br><br>
Your Validation Code Is; $code <br><br>
Thankyou.. PixelResources.. ';

$headers = 'From: $sitename' . "\r\n" .

mail($getemail, $subject, $message, $headers);
echo('<font face="verdana" size="1"><b>Thankyou</b><br /><br />An Email has been dispatched to the Email registered with the account with details on how to reset the Password.. <br /><br />+ <a href="passcode.php" style="text-decoration: none">Proceed to Step 2</a><br />+ <a href="login.php" style="text-decoration: none">Main Page</a>');

?>
<?
}
?>


for some reason once you typed in your username you dont recieve an email?

Jamie.
23-08-2006, 10:52 PM
whats the adress there receiving the email from?

PixelResources
23-08-2006, 10:56 PM
Well im testing it and i dont get the email ;S

Eric30
23-08-2006, 11:09 PM
Im bored...


<?
include('config.php');
if (!$_POST[submit])

{
?>
<form name="form1" method="post" action="">
<p><font face='Verdana' size='1'><b>
Forgotten Password</b><br /><br /><font face='Verdana' size='1'>
If you have forgotten your Password, you may enter your Username below and you will be sent an Email containing details on how to reset it..<br /><br />
<b>Username;</b><br />
<input name="username" type="text" id="username">
<br />
<br />
<input type="submit" name="submit" value="Recover Password">
</p>
</form><br />
<font face='Verdana' size='1'>+ <a href='login.php' style='text-decoration: none'>Back to Main Page</a>
<?
}
else
{
?>
<?
$username = $_POST[username];
$username = htmlspecialchars($username);
$code=rand(151343,18618774);

$query = mysql_query("INSERT INTO forgotpw (username, code) VALUES('$username','$code')");
$query2 = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
$row = mysql_fetch_array($query2);
$getemail = $row['email'];

$sitename = 'PixelResources';
$subject = 'PixelResources Members System - Password Recovery';
$message = 'Hello.. <br>
Please visit the URL below and type in the Validation Code on the page you end up at;<br><br>
http://www.yoursite.com/passcode.php<br><br>
Your Validation Code Is; $code <br><br>
Thankyou.. PixelResources.. ';

$headers = 'From: $sitename' . "\r\n" .

mail($getemail, $subject, $message, $headers);
echo('<font face="verdana" size="1"><b>Thankyou</b><br /><br />An Email has been dispatched to the Email registered with the account with details on how to reset the Password.. <br /><br />+ <a href="passcode.php" style="text-decoration: none">Proceed to Step 2</a><br />+ <a href="login.php" style="text-decoration: none">Main Page</a>');
}
?>

-Eric

PixelResources
23-08-2006, 11:41 PM
thanks eric, another problem though when i get the email the $code actually comes through as '$code'

Mentor
24-08-2006, 01:49 AM
thanks eric, another problem though when i get the email the $code actually comes through as '$code'

becuse hes useing single quotes and not breaking the php


<?
include('config.php');
if (!$_POST[submit])

{
?>
<form name="form1" method="post" action="">
<p><font face='Verdana' size='1'><b>
Forgotten Password</b><br /><br /><font face='Verdana' size='1'>
If you have forgotten your Password, you may enter your Username below and you will be sent an Email containing details on how to reset it..<br /><br />
<b>Username;</b><br />
<input name="username" type="text" id="username">
<br />
<br />
<input type="submit" name="submit" value="Recover Password">
</p>
</form><br />
<font face='Verdana' size='1'>+ <a href='login.php' style='text-decoration: none'>Back to Main Page</a>
<?
}
else
{
?>
<?
$username = $_POST[username];
$username = htmlspecialchars($username);
$code=rand(151343,18618774);

$query = mysql_query("INSERT INTO forgotpw (username, code) VALUES('$username','$code')");
$query2 = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
$row = mysql_fetch_array($query2);
$getemail = $row['email'];

$sitename = 'PixelResources';
$subject = 'PixelResources Members System - Password Recovery';
$message = 'Hello.. <br>
Please visit the URL below and type in the Validation Code on the page you end up at;<br><br>
http://www.yoursite.com/passcode.php<br><br>
Your Validation Code Is; '.$code.' <br><br>
Thankyou.. PixelResources.. ';

$headers = 'From: $sitename' . "\r\n" .

mail($getemail, $subject, $message, $headers);
echo('<font face="verdana" size="1"><b>Thankyou</b><br /><br />An Email has been dispatched to the Email registered with the account with details on how to reset the Password.. <br /><br />+ <a href="passcode.php" style="text-decoration: none">Proceed to Step 2</a><br />+ <a href="login.php" style="text-decoration: none">Main Page</a>');
}
?>
-possibly the smallest update to need a full repost of the code.

If your gona have a php site maybe you should learn php? even if just the basics to fix simple mistakes like that one "/

Eric30
24-08-2006, 05:43 PM
Didnt see that $code there ;)

PixelResources
24-08-2006, 08:12 PM
Grrrr now need more help.. When i type in the code it says incorrect ;s

Colin-Roberts
24-08-2006, 08:17 PM
php.net..

PixelResources
24-08-2006, 08:20 PM
already tryed php.net didnt help me ;s

Colin-Roberts
24-08-2006, 08:28 PM
its called learn php and code something yourself.

PixelResources
24-08-2006, 08:29 PM
urm thanks but you cant really say that rofl..

Colin-Roberts
24-08-2006, 08:50 PM
even i can fix those errors.

PixelResources
24-08-2006, 08:51 PM
Go for it..

Colin-Roberts
24-08-2006, 09:02 PM
whats the code for the page were you enter the codes.

PixelResources
24-08-2006, 09:10 PM
<?
include('config.php');

if (!$_POST[submit])
{
?>
<form name="form1" method="post" action="">
<p>Please Enter Your Username and Your Forgot Password Code Below<br>
<br>
Username:
<input type="username" name="textfield">
<br>
<br>
Password Reset Code:
<input name="code" type="password" value="">
<br>
<br>
<input type="submit" name="submit" value="Change My Password">
<br>
</p>
</form>
<?
// The form for recovring password
}else{
?>
<?
$username = $_POST[username];
$passcode = $_POST[code];

$query= MYSQL_QUERY("SELECT * from forgotpw WHERE username = '$username' AND code = '$passcode'");
$exists = MySQL_Fetch_Array($query);

if($exists[code] != $passcode) {
echo(' The Password Reset Code You Entered, Was Incorrect ');
}else{

// checks the code entered was the one in the email
?>
<form name="form2" method="post" action="">
Please Enter A New Password<br>
<br>
New Password:
<input name="pass" type="text" id="pass">
<br>
<br>
Confirm New Password
<input name="pass2" type="text" id="pass2">
<br>
<br>
<input type="submit" name="update value="Change Password">
</form>
}
}
}
// The form where the user can enter a new password
?>
<?
if ($_POST[update])
{
$password = $_POST[pass];
$password2 = $_POST[pass2];

if($password != $password2) {
echo(' Your New Passwords Do Not Match ');
}else{

$password = md5($password);
$password = htmlspecialchars($password);

$query = mysql_query("UPDATE members set password= '$password' WHERE username = '$username' ");
echo(' Your password has been changed ');

// Updates the database with the new password
?>

<?
}
}
}

}
?>

Colin-Roberts
24-08-2006, 09:14 PM
i think you got your if and else backwords.
if($exists[code] != $passcode) so if the code exists your giving them an error message?

PixelResources
24-08-2006, 09:16 PM
I dunno? ;s

Want to hide these adverts? Register an account for free!