本文整理汇总了PHP中USER::auth方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::auth方法的具体用法?PHP USER::auth怎么用?PHP USER::auth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::auth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (!empty($files)) {
file_put_contents('data/' . $filename, $files, FILE_APPEND);
echo "success\n";
}
if (empty($_GET['mode'])) {
MG::redirect('/');
}
MG::disableTemplate();
Storage::$noCache = true;
$this->unlinkFile = true;
$this->startTime = microtime(true);
$this->maxExecTime = min(30, @ini_get("max_execution_time"));
if (empty($this->maxExecTime)) {
$this->maxExecTime = 30;
}
$mode = (string) $_GET['mode'];
$this->mode = $mode;
$this->type = $_GET['type'];
$this->filename = $_GET['filename'];
$this->auth = USER::auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
$this->{$mode}();
if ($mode && $this->auth) {
$this->{$mode}();
}
}
示例2: __construct
function __construct()
{
$lang = MG::get('lang');
$settings = MG::get('settings');
$this->lang = $lang;
$status = 0;
if (User::isAuth()) {
$order = new Models_Order();
$status = 3;
//обработка запроса на изменение данных пользователя
if (URL::getQueryParametr('userData')) {
$customer = URL::getQueryParametr('customer');
$userData = array('name' => URL::getQueryParametr('name'), 'sname' => URL::getQueryParametr('sname'), 'address' => URL::getQueryParametr('address'), 'phone' => URL::getQueryParametr('phone'), 'nameyur' => $customer == 'yur' ? URL::getQueryParametr('nameyur') : '', 'adress' => $customer == 'yur' ? URL::getQueryParametr('adress') : '', 'inn' => $customer == 'yur' ? URL::getQueryParametr('inn') : '', 'kpp' => $customer == 'yur' ? URL::getQueryParametr('kpp') : '', 'bank' => $customer == 'yur' ? URL::getQueryParametr('bank') : '', 'bik' => $customer == 'yur' ? URL::getQueryParametr('bik') : '', 'ks' => $customer == 'yur' ? URL::getQueryParametr('ks') : '', 'rs' => $customer == 'yur' ? URL::getQueryParametr('rs') : '');
if (USER::update(User::getThis()->id, $userData)) {
$message = 'Данные успешно сохранены';
} else {
$error = 'Не удалось сохранить данные ' . $this->_newUserData['sname'];
}
}
// Обработка запроса на изменения пароля.
if (URL::getQueryParametr('chengePass')) {
if (USER::auth(User::getThis()->email, URL::getQueryParametr('pass'))) {
$person = new Models_Personal();
$message = $person->changePass(URL::getQueryParametr('newPass'), User::getThis()->id);
} else {
$error = 'Неверный пароль';
}
}
// Обработка запроса на изменения способа оплаты.
if (URL::getQueryParametr('changePaymentId')) {
$order = new Models_Order();
$status = $order->updateOrder(array('payment_id' => $_POST['changePaymentId'], 'id' => $_POST['orderId']));
$result = array('status' => $status, 'comment' => 2, 'orderStatus' => 3);
echo json_encode($result);
MG::disableTemplate();
exit;
}
// Обработка AJAX запроса на закрытие заказа.
if (URL::getQueryParametr('delOK')) {
$comment = 'Отменено покупателем, по причине <br>"' . URL::getQueryParametr('comment') . '"';
// Пересчитываем остатки продуктов из заказа.
$orderModel = new Models_Order();
$orderModel->refreshCountProducts(URL::getQueryParametr('delID'), 4);
$res = DB::query('
UPDATE `' . PREFIX . 'order`
SET close_date = now(), status_id = 4, comment = "%s"
WHERE id = %d AND user_email = "%s"', $comment, URL::getQueryParametr('delID'), User::getThis()->email);
if ($res) {
$status = true;
}
if ($comment) {
$comm = "<b>Комментарий: " . $comment . "</b>";
}
$result = array('status' => $status, 'comment' => $comm, 'orderStatus' => $lang[$order->getOrderStatus(array('status_id' => 4))]);
$orderModel->sendMailOfUpdateOrder(URL::getQueryParametr('delID'));
echo json_encode($result);
MG::disableTemplate();
exit;
}
// Отображение данных пользователя.
$orderArray = $order->getOrder('user_email = "' . User::getThis()->email . '"', TRUE);
if (is_array($orderArray)) {
foreach ($orderArray as $orderId => $orderItems) {
$orderArray[$orderId]['string_status_id'] = $order->getOrderStatus($orderItems);
$paymentArray = $order->getPaymentMethod($orderItems['payment_id']);
$orderArray[$orderId]['name'] = $paymentArray['name'];
$orderArray[$orderId]['paided'] = $order->getPaidedStatus($orderItems);
}
}
if (!User::getThis()->activity) {
$status = 2;
unset($_SESSION['user']);
}
if (User::getThis()->blocked) {
$status = 1;
unset($_SESSION['user']);
}
$paymentList = $order->getPaymentBlocksMethod();
} else {
MG::redirect('/enter');
}
$this->data = array('error' => !empty($error) ? $error : '', 'message' => !empty($message) ? $message : '', 'status' => !empty($status) ? $status : '', 'userInfo' => User::getThis(), 'orderInfo' => !empty($orderArray) ? $orderArray : '', 'currency' => $settings['currency'], 'paymentList' => $paymentList, 'meta_title' => 'Личный кабинет', 'meta_keywords' => !empty($model->currentCategory['meta_keywords']) ? $model->currentCategory['meta_keywords'] : "заказы,личные данные, личный кабинет", 'meta_desc' => !empty($model->currentCategory['meta_desc']) ? $model->currentCategory['meta_desc'] : "В личном кабинете нашего сайта вы сможете отслеживать состояние заказов и менять свои данные");
}
示例3: header
<?php
/**
* 登录
*/
if (!defined("PMX_ENTRANCE")) {
header("HTTP/1.0 404 Not Found");
exit;
}
$username = isset($_POST['username']) ? $_POST['username'] : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
$user = new USER($username, $password);
if (!$user->auth()) {
header('Content-Type: text/plain; charset=utf-8');
die("The username or password you input is incorrect.");
}
if ($user->login()) {
pmx_gourl_home();
} else {
header('Content-Type: text/plain; charset=utf-8');
die("Unknow error occured.");
}