[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: password_forgotten.php 3 2006-05-27 04:59:07Z user $ 4 5 osCMax Power E-Commerce 6 http://oscdox.com 7 8 Copyright 2009 osCMax 9 10 Released under the GNU General Public License 11 */ 12 13 require ('includes/application_top.php'); 14 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN); 15 16 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) { 17 $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']); 18 $username = tep_db_prepare_input($HTTP_POST_VARS['username']); 19 $log_times = $HTTP_POST_VARS['log_times']+1; 20 if ($log_times >= 4) { 21 tep_session_register('password_forgotten'); 22 } 23 24 // Check if email exists 25 $check_admin_query = tep_db_query("select admin_id as check_id, admin_username as check_username, admin_lastname as check_lastname, admin_email_address as check_email_address from " . TABLE_ADMIN . " where admin_email_address = '" . tep_db_input($email_address) . "'"); 26 if (!tep_db_num_rows($check_admin_query)) { 27 $HTTP_GET_VARS['login'] = 'fail'; 28 } else { 29 $check_admin = tep_db_fetch_array($check_admin_query); 30 if ($check_admin['check_username'] != $username) { 31 $HTTP_GET_VARS['login'] = 'fail'; 32 } else { 33 $HTTP_GET_VARS['login'] = 'success'; 34 35 function randomize() { 36 $salt = "ABCDEFGHIJKLMNOPQRSTUVWXWZabchefghjkmnpqrstuvwxyz0123456789"; 37 srand((double)microtime()*1000000); 38 $i = 0; 39 40 while ($i <= 7) { 41 $num = rand() % 33; 42 $tmp = substr($salt, $num, 1); 43 $pass = $pass . $tmp; 44 $i++; 45 } 46 return $pass; 47 } 48 $makePassword = randomize(); 49 50 tep_mail($check_admin['check_username'] . ' ' . $check_admin['admin_lastname'], $check_admin['check_email_address'], ADMIN_EMAIL_SUBJECT, sprintf(ADMIN_EMAIL_TEXT, $check_admin['check_username'], HTTP_SERVER . DIR_WS_ADMIN, $check_admin['check_email_address'], $makePassword, STORE_OWNER), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); 51 tep_db_query("update " . TABLE_ADMIN . " set admin_password = '" . tep_encrypt_password($makePassword) . "' where admin_id = '" . $check_admin['check_id'] . "'"); 52 } 53 } 54 } 55 56 ?> 57 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 58 <html <?php echo HTML_PARAMS; ?>> 59 <head> 60 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 61 <title><?php echo TITLE; ?></title> 62 <link rel="stylesheet" type="text/css" href="style.css"> 63 </head> 64 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 65 66 <table border="0" width="600" height="100%" cellspacing="0" cellpadding="0" align="center" valign="middle"> 67 <tr> 68 <td><table border="0" width="600" height="440" cellspacing="0" cellpadding="1" align="center" valign="middle"> 69 <tr bgcolor="#000000"> 70 <td><table border="0" width="600" height="440" cellspacing="0" cellpadding="0"> 71 <tr bgcolor="#ffffff" height="50"> 72 <td height="50"><?php echo '<a href="http://www.oscmax.com/">' . tep_image(DIR_WS_IMAGES . 'oscmax.gif', 'osCMax v2.0', '169', '56') . '</a>'; ?></td> 73 <td align="right" class="text" nowrap><?php echo ' <a href="http://www.aabox.com/?oscmax" target="_blank" class="headerLink">AABox Web Hosting</a> | <a href="http://oscdox.com" class="headerLink">' . HEADER_TITLE_OSCDOX . '</a> | <a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . HEADER_TITLE_ADMINISTRATION . '</a> | <a href="' . tep_catalog_href_link() . '">' . HEADER_TITLE_ONLINE_CATALOG . '</a>'; ?> </td> 74 </tr> 75 <tr bgcolor="#E7E7E7"> 76 <td colspan="2" align="center" valign="middle"> 77 <?php echo tep_draw_form('login', FILENAME_PASSWORD_FORGOTTEN, 'action=process'); ?> 78 <table width="280" border="0" cellspacing="0" cellpadding="2"> 79 <tr> 80 <td class="login_heading" valign="top"> <b><?php echo HEADING_PASSWORD_FORGOTTEN; ?></b></td> 81 </tr> 82 <tr> 83 <td height="100%" width="100%" valign="top" align="center"> 84 <table border="0" height="100%" width="100%" cellspacing="0" cellpadding="1" bgcolor="#666666"> 85 <tr><td><table border="0" width="100%" height="100%" cellspacing="3" cellpadding="2" bgcolor="#F3F3F3"> 86 87 <?php 88 if ($HTTP_GET_VARS['login'] == 'success') { 89 $success_message = TEXT_FORGOTTEN_SUCCESS; 90 } elseif ($HTTP_GET_VARS['login'] == 'fail') { 91 $info_message = TEXT_FORGOTTEN_ERROR; 92 } 93 if (tep_session_is_registered('password_forgotten')) { 94 ?> 95 <tr> 96 <td class="smallText"><?php echo TEXT_FORGOTTEN_FAIL; ?></td> 97 </tr> 98 <tr> 99 <td align="center" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_LOGIN, '' , 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 100 </tr> 101 <?php 102 } elseif (isset($success_message)) { 103 ?> 104 <tr> 105 <td class="smallText"><?php echo $success_message; ?></td> 106 </tr> 107 <tr> 108 <td align="center" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_LOGIN, '' , 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 109 </tr> 110 <?php 111 } else { 112 if (isset($info_message)) { 113 ?> 114 <tr> 115 <td colspan="2" class="smallText" align="center"><?php echo $info_message; ?><?php echo tep_draw_hidden_field('log_times', $log_times); ?></td> 116 </tr> 117 <?php 118 } else { 119 ?> 120 <tr> 121 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?><?php echo tep_draw_hidden_field('log_times', '0'); ?></td> 122 </tr> 123 <?php 124 } 125 ?> 126 <tr> 127 <td class="login"><?php echo ENTRY_USERNAME; ?></td> 128 <td class="login"><?php echo tep_draw_input_field('username'); ?></td> 129 </tr> 130 <tr> 131 <td class="login"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> 132 <td class="login"><?php echo tep_draw_input_field('email_address'); ?></td> 133 </tr> 134 <tr> 135 <td colspan="2" align="right" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_LOGIN, '' , 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> ' . tep_image_submit('button_confirm.gif', IMAGE_BUTTON_LOGIN); ?> </td> 136 </tr> 137 <?php 138 } 139 ?> 140 </table></td></tr> 141 </table> 142 </td> 143 </tr> 144 </table> 145 </form> 146 147 </td> 148 </tr> 149 </table></td> 150 </tr> 151 <tr> 152 <td><?php require (DIR_WS_INCLUDES . 'footer.php'); ?></td> 153 </tr> 154 </table></td> 155 </tr> 156 </table> 157 158 </body> 159 160 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |