forked from SnowHall/Silurus-Classifieds-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforgot.php
More file actions
executable file
·73 lines (60 loc) · 2.47 KB
/
forgot.php
File metadata and controls
executable file
·73 lines (60 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Silurus Classifieds Builder
*
*
* @author SnowHall - http://snowhall.com
* @website http://snowhall.com/silurus
* @email support@snowhall.com
*
* @version 1.0
* @date May 7, 2009
*
* Silurus is a professionally developed PHP Classifieds script that was built for you.
* Whether you are running classifieds for autos, motorcycles, bicycles, rv's, guns,
* horses, or general merchandise, our product is the right package for you.
* It has template system and no limit to usage with free for any changes.
*
* Copyright (c) 2009
*/
include("./include_php/init.php");
$action_result = "Forgot your NickName or password? No problem! Please, supply your e-mail address below and you will be sent your account Username and password." ;
if ( $_POST['Email'] )
{
if ( !eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $_POST['Email']) )
{
$action_result = "The e-mail you entered doesn't seem to be valid. Please, try again.";
}
else
{
// Check if entered email is in the base
$sEmail = mysql_escape_string($_POST['Email']);
$memb_arr = mysql_fetch_assoc(mysql_query( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$sEmail'" ));
if ( $memb_arr['ID'] )
{
$recipient = $sEmail;
$newp = substr( base64_encode( microtime () ), 0, 7 );
$templates = mysql_fetch_assoc(mysql_query("select * from LTemplates where ID=3"));
$subj = $templates['subj'];
$message = nl2br($templates['text']);
$message = str_replace("{LOGIN}",$memb_arr['NickName'],$message);
$message = str_replace("{PASSWORD}",$newp,$message);
$message = str_replace("{TO_NAME}",$memb_arr['fname'].' '.$memb_arr['lname'],$message);
$mail_ret = sendMail(trim($memb_arr['Email']),$memb_arr['fname'].' '.$memb_arr['lname'],$subj,$message);
$sQuery = "UPDATE `Profiles` SET `Password` = md5('".$newp."') WHERE `ID`='{$memb_arr['ID']}'";
mysql_query( $sQuery );
$action_result = "You have been recognized as a member and your account details have just been sent to you.";
}
else
{
$action_result = "Sorry, you have not been recognized as a member. Please, make sure that you entered the e-mail you used in creating your account.";
}
}
}
$smarty->assign("action_result", $action_result);
$HEADERTEXT = 'Forgot Username or Password';
addNavigation('',$HEADERTEXT);
$smarty->assign("site_title", $HEADERTEXT." :: ".$gConfig['site_title']);
$smarty->assign("HEADERTEXT", $HEADERTEXT);
show_smarty_template('forgot');
?>