General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 10th, 2004, 04:59 PM
Combust Combust is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 Combust User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post data in emails

I'm trying to get a forget password script working.

when a user forgets their password and inputs their username only, it sends them email that includes a form which has a new password input. my main question is how do i carry post data from that email in outlook or whatever email client they are using into the browser. so far it hasnt been able to work.

this is the php code.

<?php

include("includes/sql_system.php"); // System Functions
if ($_SERVER['QUERY_STRING'] == "submit_login")
{
$user_id = evaluateVariable('user_id');
$mysql = mysql_query ("SELECT * FROM $members_table WHERE $usernameField='$user_id'") or die (mysql_error());
$rowcount = mysql_num_rows ($mysql);
if ($rowcount == "0")
{
beginLayout();
showError("UserError, your User Name is Wrong, please go back and try again.");
endLayout();
exit;
}
if ($rowcount != "0")
{
beginLayout();
$new_pass = randomPass();
$email_address = "";
$new_link = "http://" . $_SERVER['SERVER_NAME'] . $folder . "system_forget.php?activate";
while ($sql = mysql_fetch_array($mysql))
{
$email_address .= $sql[$emailField];
}
echo "An email has been sent to <u>" . $email_address . "</u> with your new password. If this email is not correct please contact an admin.";
endLayout();
$email_subject = "Monitor CMS - Lost Password";
$html_string = "<html>\n<body>";
$html_string .= "<div style=\"font-family: tahoma; font-size: 10px; color: #555555;\">";
$html_string .= "<form action=\"" . $new_link . "\" method=\"post\">\n";
$html_string .= "<input type=\"hidden\" name=\"user_id\" value=\"" . $user_id . "\" />\n";
$email_message = "<b>MONITOR CMS " . date("m/d/Y") . "</b>\n\n";
$email_message = "Enter a new password and submit the form, the new password must be between 6 - 10 characters.\n\n";
$email_message .= "<b>User Name</b>: " . $user_id . "\n";
$email_message .= "<b>New Password</b>: <input style=\"font-family: tahoma; font-size: 10px;\" type=\"password\" maxlength=\"10\" name=\"pass\" />\n";
$email_message .= "<input style=\"font-family: tahoma; font-size: 10px;\" type=\"submit\" />";
$email_message .= "\n\n\n<u>Message Sent From " . $systemTitle . "</u>\n";
$html_string_end = "</form></div></body></html>\n";
$headers = "From: Monitor CMS\n";
$headers .= "X-Sender: <mail@server.com>\n";
$headers .= "X-Mailer: PHP\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <mail@server.com>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
mail($email_address, $email_subject, $html_string . nl2br($email_message) . $html_string_end , $headers) or die ("unable to send email");
}
}
elseif ($_SERVER['QUERY_STRING'] == "activate")
{
if (evaluateVariable('pass'))
{
if (strlen(evaluateVariable('password')) < 6)
{
beginLayout();
showError("Your new password must be atleast 6 characters, please refer to the email again.");
endLayout();
}
else
{
// Mysql Procedures
}
}
else
{
beginLayout();
showError("You haven't submited a new password, please refer to the email again.");
endLayout();
}
}
else
{
if ($_COOKIE['user_id'] != "")
{
header ("Location: $frontpage");
}
else
{
beginLayout();
?>
<form name="mcms_forget" action="system_forget.php?submit_login" method="post">
<table cellspacing="0" cellpadding="5" style="border: 1px solid #c9c9c9;" bgcolor="#f9f9f9">
<tr>
<td >User Name</td>
<td><input type="text" name="user_id" size="30" maxlength="25" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" style="background-color: #F9F9F9; border: 0px; text-decoration: underline;" onmouseover="this.style.color='#ED135A';this.style.textDecorati on='none'" onmouseout="this.style.color='#000000';this.style.textDecorati on='underline'" value="Submit" onclick="mcms_forget_validate(this.form);" /></td>
</tr>
</table>
<a href="system_login.php">Back to Login</a>
</form>
<?php
endLayout();
}
}
?>

This is the email html source

<html>
<body><div style="font-family: tahoma; font-size: 10px; color: #555555;"><form action="" method="post">
<input type="hidden" name="user_id" value="Combust" />
Enter a new password and submit the form, the new password must be between 6 - 10 characters.<br />
<br />
<b>User Name</b>: Combust<br />
<b>New Password</b>: <input style="font-family: tahoma; font-size: 10px;" type="password" maxlength="10" name="pass" /><br />
<input style="font-family: tahoma; font-size: 10px;" type="submit" /><br />
<br />
<br />
<u>Message Sent From </u><br />
</form></div></body></html>


i took out the action/domain for this post for security reasons. they are there properly in the actual script so that ins't the problem.

and the evaluateVariable() function just checks if $_POST or $_REQUEST/$_GET has been set otherwise it returns false.

Thank you.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Post data in emails


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT