[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
// Check if session has timed out
if (!isset($_SESSION['admin_id'])) zen_redirect(zen_href_link(FILENAME_LOGIN));
$user = $_SESSION['admin_id'];
// determine whether an action has been requested
if (isset($_POST['action']) && in_array($_POST['action'], array('update','reset'))) {
$action = $_POST['action'];
} elseif (isset($_GET['action']) && in_array($_GET['action'], array('edit','password'))) {
$action = $_GET['action'];
} else {
$action = '';
}
// validate form input as not expired and not spoofed
if ($action != '' && isset($_POST['action']) && $_POST['action'] != '' && $_POST['securityToken'] != $_SESSION['securityToken']) {
$messageStack->add_session(ERROR_TOKEN_EXPIRED_PLEASE_RESUBMIT, 'error');
zen_redirect(zen_href_link(FILENAME_ADMIN_ACCOUNT));
}
// act upon any specific action specified
switch ($action) {
case 'edit': // display populated form for editing existing user
$formAction = 'update';
$profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles());
break;
case 'password': // display unpopulated form for resetting existing user's password
$formAction = 'reset';
break;
case 'update': // update existing user's details in database. Post data is prep'd for db in the first function call
$errors = zen_update_user(FALSE, $_POST['email'], $_POST['id'], $_POST['profile']);
if (sizeof($errors) > 0)
{
foreach ($errors as $error)
{
$messageStack->add($error, 'error');
}
$action = 'edit';
$formAction = 'update';
$profilesList = array_merge(array(array('id'=>0,'text'=>'Choose Profile')), zen_get_profiles());
} else
{
$action = '';
$messageStack->add(SUCCESS_USER_DETAILS_UPDATED, 'success');
}
break;
case 'reset': // reset existing user's password in database. Post data is prep'd for db in the first function call
$errors = zen_reset_password($_POST['user'], $_POST['password'], $_POST['confirm']);
if (sizeof($errors) > 0)
{
foreach ($errors as $error)
{
$messageStack->add($error, 'error');
}
$action = 'password';
$formAction = 'reset';
} else
{
$action = '';
$messageStack->add(SUCCESS_PASSWORD_UPDATED, 'success');
}
break;
default: // no action, simply drop through and display existing users
}
// get this user's details
$userList = zen_get_users($_SESSION['admin_id']);
$userDetails = $userList[0];