[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 password_forgotten.php

Zen Cart 源代码 password_forgotten.php




下载文件

文件名: password_forgotten.php
文件类型: PHP文件
文件大小: 4.18 KiB
MD5: f2420eb5b1e99c780c5fc328cc3aae7a

password_forgotten.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: Ian Wilson  Sun Jul 22 20:55:36 2012 +0100 Modified in v1.5.1 $
  8.  */
  9. // reset-token is good for only 24 hours:
  10. define('ADMIN_PWD_TOKEN_DURATION', (24 * 60 * 60) );
  11.  
  12. /////////
  13. require ('includes/application_top.php');
  14. // demo active test
  15. if (zen_admin_demo())
  16. {
  17.   $_GET['action'] = '';
  18.   $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  19.   zen_redirect(zen_href_link(FILENAME_DEFAULT));
  20. }
  21. if (isset($_POST['login']))
  22. {
  23.   zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  24. }
  25. // Slam prevention:
  26. if ($_SESSION['login_attempt'] > 9) {
  27.   header('HTTP/1.1 406 Not Acceptable');
  28.   exit(0);
  29. }
  30. $error = false;
  31. $reset_token = '';
  32. if (isset($_POST['submit']))
  33. {
  34.   if (! $_POST['admin_email'])
  35.   {
  36.     $error = true;
  37.     $email_message = ERROR_WRONG_EMAIL_NULL;
  38.   }
  39.   $admin_email = zen_db_prepare_input($_POST['admin_email']);
  40.   $sql = "select admin_id, admin_name, admin_email, admin_pass from " . TABLE_ADMIN . " where admin_email = :admEmail: LIMIT 1";
  41.   $sql = $db->bindVars($sql, ':admEmail:', $admin_email, 'string');
  42.   $result = $db->Execute($sql);
  43.   if (! ($admin_email == $result->fields['admin_email']))
  44.   {
  45.     $error = true;
  46.     $email_message = MESSAGE_PASSWORD_SENT;
  47.   }
  48.   // BEGIN SLAM PREVENTION
  49.   if ($_POST['admin_email'] != '')
  50.   {
  51.     if (! isset($_SESSION['login_attempt'])) $_SESSION['login_attempt'] = 0;
  52.     $_SESSION['login_attempt'] ++;
  53.   } // END SLAM PREVENTION
  54.  
  55.   if ($error == false)
  56.   {
  57.     $new_password = zen_create_PADSS_password((int)ADMIN_PASSWORD_MIN_LENGTH < 7 ? 7 : (int)ADMIN_PASSWORD_MIN_LENGTH);
  58.     $resetToken = (time() + ADMIN_PWD_TOKEN_DURATION) . '}' . zen_encrypt_password($new_password);
  59.     $sql = "update " . TABLE_ADMIN . " set reset_token = :token: where admin_id = :admID: ";
  60.     $sql = $db->bindVars($sql, ':token:', $resetToken, 'string');
  61.     $sql = $db->bindVars($sql, ':admID:', $result->fields['admin_id'], 'string');
  62.     $db->Execute($sql);
  63.     $html_msg['EMAIL_CUSTOMERS_NAME'] = $result->fields['admin_name'];
  64.     $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(TEXT_EMAIL_MESSAGE_PWD_RESET, $_SERVER['REMOTE_ADDR'], $new_password);
  65.     zen_mail($result->fields['admin_name'], $result->fields['admin_email'], TEXT_EMAIL_SUBJECT_PWD_RESET, sprintf(TEXT_EMAIL_MESSAGE_PWD_RESET, $_SERVER['REMOTE_ADDR'], $new_password), STORE_NAME, EMAIL_FROM, $html_msg, 'password_forgotten_admin');
  66.     $email_message = MESSAGE_PASSWORD_SENT;
  67.   }
  68. }
  69. ?>
  70. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  71. <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
  72. <head>
  73. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  74. <title><?php echo TITLE; ?></title>
  75. <link href="includes/stylesheet.css" rel="stylesheet" type="text/css" />
  76. </head>
  77. <body id="login" onload="document.getElementById('admin_email').focus()">
  78. <form id="loginForm" action="<?php echo zen_href_link(FILENAME_PASSWORD_FORGOTTEN, 'action=update', 'SSL'); ?>" method="post">
  79. <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  80. <fieldset>
  81. <legend><?php echo HEADING_TITLE; ?></legend>
  82. <?php if ($resetToken == '') { ?>
  83. <label for="admin_email"><?php echo TEXT_ADMIN_EMAIL; ?><input type="text" id="admin_email" name="admin_email" value="<?php if ($error) echo zen_output_string($admin_email); ?>" autocomplete="off" /></label>
  84. <?php } ?>
  85. <p class="<?php echo ($error ? 'messageStackError' : 'messageStackSuccess'); ?>"><?php echo $email_message; ?></p>
  86. <?php if ($resetToken == '') { ?>
  87. <input type="submit" name="submit" class="button" value="<?php echo TEXT_BUTTON_REQUEST_RESET; ?>" />
  88. <input type="submit" name="login" class="button" value="<?php echo TEXT_BUTTON_CANCEL; ?>" />
  89. <?php } else { ?>
  90. <input type="submit" name="login" class="button" value="<?php echo TEXT_BUTTON_LOGIN; ?>" />
  91. <?php } ?>
  92. </fieldset>
  93. </form>
  94. </body>
  95. </html>
  96. <?php require('includes/application_bottom.php'); ?>
  97.