[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 源代码 admin_account.php

Zen Cart 源代码 admin_account.php




下载文件

文件名: admin_account.php
文件类型: PHP文件
文件大小: 6.73 KiB
MD5: 1fa4ab1ef90a6da5f8da056b4556662c

admin_account.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 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 $Id: admin_account.php 18698 2011-05-04 14:50:06Z wilt $
  8.  */
  9.  
  10. require('includes/application_top.php');
  11. if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . 'users.php')) {
  12.   include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . 'users.php');
  13. }
  14.  
  15. // Check if session has timed out
  16. if (!isset($_SESSION['admin_id'])) zen_redirect(zen_href_link(FILENAME_LOGIN));
  17. $user = $_SESSION['admin_id'];
  18.  
  19. // determine whether an action has been requested
  20. if (isset($_POST['action']) && in_array($_POST['action'], array('update','reset'))) {
  21.   $action = $_POST['action'];
  22. } elseif (isset($_GET['action']) && in_array($_GET['action'], array('edit','password'))) {
  23.   $action = $_GET['action'];
  24. } else {
  25.   $action = '';
  26. }
  27. // validate form input as not expired and not spoofed
  28. if ($action != '' && isset($_POST['action']) && $_POST['action'] != '' && $_POST['securityToken'] != $_SESSION['securityToken']) {
  29.   $messageStack->add_session(ERROR_TOKEN_EXPIRED_PLEASE_RESUBMIT, 'error');
  30.   zen_redirect(zen_href_link(FILENAME_ADMIN_ACCOUNT));
  31. }
  32.  
  33. // act upon any specific action specified
  34. switch ($action) {
  35.   case 'edit': // display populated form for editing existing user
  36.     $formAction = 'update';
  37.     $profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles());
  38.     break;
  39.   case 'password': // display unpopulated form for resetting existing user's password
  40.     $formAction = 'reset';
  41.     break;
  42.   case 'update': // update existing user's details in database. Post data is prep'd for db in the first function call
  43.     $errors = zen_update_user(FALSE, $_POST['email'], $_POST['id'], $_POST['profile']);
  44.     if (sizeof($errors) > 0)
  45.     {
  46.       foreach ($errors as $error)
  47.       {
  48.         $messageStack->add($error, 'error');
  49.       }
  50.       $action = 'edit';
  51.       $formAction = 'update';
  52.       $profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles());
  53.     } else
  54.     {
  55.       $action = '';
  56.       $messageStack->add(SUCCESS_USER_DETAILS_UPDATED, 'success');
  57.     }
  58.     break;
  59.   case 'reset': // reset existing user's password in database. Post data is prep'd for db in the first function call
  60.     $errors = zen_reset_password($_POST['user'], $_POST['password'], $_POST['confirm']);
  61.     if (sizeof($errors) > 0)
  62.     {
  63.       foreach ($errors as $error)
  64.     {
  65.       $messageStack->add($error, 'error');
  66.     }
  67.     $action = 'password';
  68.     $formAction = 'reset';
  69.     } else
  70.     {
  71.       $action = '';
  72.       $messageStack->add(SUCCESS_PASSWORD_UPDATED, 'success');
  73.     }
  74.     break;
  75.   default: // no action, simply drop through and display existing users
  76. }
  77.  
  78. // get this user's details
  79. $userList = zen_get_users($_SESSION['admin_id']);
  80. $userDetails = $userList[0];
  81.  
  82.  
  83. ?>
  84. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  85. <html <?php echo HTML_PARAMS; ?>>
  86. <head>
  87. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  88. <title><?php echo TITLE; ?></title>
  89. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  90. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  91. <link rel="stylesheet" type="text/css" href="includes/admin_access.css" />
  92. <script language="javascript" src="includes/menu.js"></script>
  93. <script language="javascript" src="includes/general.js"></script>
  94. <script type="text/javascript">
  95.   <!--
  96.   function init()
  97.   {
  98.     cssjsmenu('navbar');
  99.     if (document.getElementById)
  100.     {
  101.       var kill = document.getElementById('hoverJS');
  102.       kill.disabled = true;
  103.     }
  104.   }
  105.   // -->
  106. </script>
  107. </head>
  108. <body onload="init()">
  109. <!-- header //-->
  110. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  111. <!-- header_eof //-->
  112.  
  113. <!-- body //-->
  114. <div id="pageWrapper">
  115.  
  116.   <h1><?php echo HEADING_TITLE ?></h1>
  117.  
  118. <form action="<?php echo zen_href_link(FILENAME_ADMIN_ACCOUNT) ?>" method="post">
  119. <?php if (isset($formAction)) echo zen_draw_hidden_field('action',$formAction) . zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  120. <?php if ($action == 'edit' || $action == 'password') echo zen_draw_hidden_field('user',$user) ?>
  121.   <table cellspacing="0">
  122.     <tr class="headingRow">
  123.       <th class="name"><?php echo TEXT_NAME ?></th>
  124.       <th class="email"><?php echo TEXT_EMAIL ?></th>
  125. <?php if ($action == 'password') { ?>
  126.       <th class="password"><?php echo TEXT_ADMIN_NEW_PASSWORD ?></th>
  127.       <th class="password"><?php echo TEXT_ADMIN_CONFIRM_PASSWORD ?></th>
  128. <?php } ?>
  129.       <th class="actions">&nbsp;</th>
  130.     </tr>
  131.     <tr>
  132.       <td class="name"><?php echo $userDetails['name'] ?><?php echo zen_draw_hidden_field('id', $userDetails['id']) . zen_draw_hidden_field('admin_name', $userDetails['name']); ?></td>
  133. <?php if ($action == 'edit' && $user == $userDetails['id']) { ?>
  134.       <td class="email"><?php echo zen_draw_input_field('email', $userDetails['email'], 'class="field"', false, 'text', true) ?></td>
  135. <?php } else { ?>
  136.       <td class="email"><?php echo $userDetails['email'] ?></td>
  137. <?php } ?>
  138. <?php if ($action == 'password' && $user == $userDetails['id']) { ?>
  139.     <td class="password"><?php echo zen_draw_input_field('password', '', 'class="field"', false, 'password', true) ?></td>
  140.     <td class="confirm"><?php echo zen_draw_input_field('confirm', '', 'class="field"', false, 'password', true) ?></td>
  141. <?php } elseif($action == 'add' || $action == 'password') { ?>
  142.       <td class="password">&nbsp;</td>
  143.       <td class="confirm">&nbsp;</td>
  144. <?php } ?>
  145. <?php if ($action == 'edit' || $action == 'password') { ?>
  146. <?php if ($user == $userDetails['id']) { ?>
  147.       <td class="actions">
  148.         <?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE) ?>
  149.         <a href="<?php echo zen_href_link(FILENAME_ADMIN_ACCOUNT) ?>"><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL) ?></a>
  150.       </td>
  151. <?php } else { ?>
  152.       <td class="actions">&nbsp;</td>
  153. <?php } ?>
  154. <?php } else { ?>
  155.       <td class="actions">
  156.         <a href="<?php echo zen_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit') ?>"><?php echo zen_image_button('button_edit.gif', IMAGE_EDIT) ?></a>
  157.         <a href="<?php echo zen_href_link(FILENAME_ADMIN_ACCOUNT, 'action=password') ?>"><?php echo zen_image_button('button_reset_pwd.gif', IMAGE_RESET_PWD) ?></a>
  158.       </td>
  159.     </tr>
  160. <?php } ?>
  161.   </table>
  162. </form>
  163.  
  164. </div>
  165. <!-- body_eof //-->
  166.  
  167. <!-- footer //-->
  168. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  169. <!-- footer_eof //-->
  170. <br>
  171. </body>
  172. </html>
  173. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  174.  


cron