TopDog07
04-16-2002, 12:56 AM
Greetings, I am curious if anyone knows of a script that could be use or what to do in order to setup myInvoice with an automated password recovery system. (Eg. client fills out a form consisiting of email address and username, then a new password is changed and then emailed to them). If that is not possible, what would work? Such as saying, please allow up to an hour for password (an hour would be a worse case scenario, just using that as an example). Any feedback is appreciated. Thanks :)
BC12
CB21
DT12
TD21 :stickout
Omair @ HB
04-18-2002, 06:49 AM
Hello,
I had few spare minutes in my hand during the college recess so I have created this script for which requests the client to enter their username and e-mail address and then e-mails them their new password.
Below is the code. Copy this code and save it as lostpassword.php.
<html>
<head>
<title>My Invoice</title>
<link rel="stylesheet" href="inc/style.css" type="text/css">
</head>
<body>
<p><img src="inc/title.gif" width="308" height="82"></p>
<blockquote>
<h1>Lost Password</h1>
<?php
include("inc/config.php");
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
?>
<?php
$action = $HTTP_GET_VARS['action'];
if(!$action)
{
?>
<p> </p>
<form name="form1" method="post" action="<?$PHP_SELF?>?action=yes">
<table width="350" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td><b>Username:</b></td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td><b>E-mail Address:</b></td>
<td>
<input type="text" name="email">
</td>
<td>
<input type="Submit" name="submit" value="Enter">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
<?php
}
else
{
$username = $HTTP_POST_VARS['username'];
$email = $HTTP_POST_VARS['email'];
$query = "SELECT * FROM clients WHERE name = '$username' AND email = '$email'";
$result = mysql_db_query($database, $query, $connection);
if (mysql_num_rows($result) == 1)
{
$npass = $username;
$usql = "update clients set password=PASSWORD('$username') where email='$email' and name='$username'";
$uqry = mysql_query($usql);
$subject = "Lost password for $username";
$extra = "From: host@hostingcompany.com\r\n";
$recipient = "$email";
$message = "Dear Customer,\n\n A new password for your username \"$username\" have been issued. Your new password is: \n$password\n Regards, \n$yourtitle";
mail ($recipient, $subject, $message, $extra);
echo("A new password have been issued and e-mailed to you.");
}
else
{
echo("<font color='red' size='2' face='verdana'>Sorry! but there is no such username and e-mail combination in our member database.");
exit();
}
}
?>
<?
include "inc/nav.inc";
include "inc/footer.inc";
?>
</body>
</html>
<!--
Copyright Notice:
This add-on created by omair@omair-haroon.com.
This script was written by Rob Minto, and is free for you to use.
Any improvements, please email rob@widgetmonkey.com.
Keep software free.
And please leave this copyright notice. Thanks.
-->
Let me know if I can be of any further assistance.
Salam,
-Omair
Starhost
04-18-2002, 02:35 PM
This is what I call service :)
Making some little scripts for free for the whole community :)
Omair @ HB
04-18-2002, 02:56 PM
Thanks. But actually, I had some spare time in my hands after I had my lunch, so I thought I might help the guy out.
Also, it might be an add-on for all those using myInvoice, which is really a cool piece of software.
Salam,
-Omair