本文整理汇总了PHP中security::set_user_lvl方法的典型用法代码示例。如果您正苦于以下问题:PHP security::set_user_lvl方法的具体用法?PHP security::set_user_lvl怎么用?PHP security::set_user_lvl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::set_user_lvl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verif_post_connect
public function verif_post_connect()
{
if (!isset($_POST['action']) || $_POST['action'] != 'connection') {
return;
}
if ($_POST['action'] == 'connection') {
$login = strip_tags($_POST['login']);
$mdp = strip_tags($_POST['password']);
unset($_POST);
$message = '';
$login = strtolower($login);
$mdp = strtolower($mdp);
if (isset($login) && $login != '' && (isset($mdp) && $mdp != '')) {
$res_fx_login = parent::select_simple($var = 'id, login', $from = 'login', $where = '', $order = '', $type_return = 'object');
foreach ($res_fx_login as $login_fx) {
if ($login == $login_fx->login) {
//ici ok
$res_fx_mdp = parent::select_simple($var = 'id, mdp', $from = 'login', $where = '', $order = '', $type_return = 'object');
foreach ($res_fx_mdp as $mdp_fx) {
//ici ok
if ($mdp == $mdp_fx->mdp) {
$id = $mdp_fx->id;
$where = 'id = ' . $id;
$level_user = parent::select_simple($var = 'auth', $from = 'login', $where, $order = '', $type_return = 'object');
if (isset($_SESSION['login'])) {
session_unset();
} else {
$_SESSION['login'] = $login;
$_SESSION['SERVER_NAME'] = $_SERVER['SERVER_NAME'];
$_SESSION['SERVER_ADDR'] = $_SERVER['SERVER_ADDR'];
$security = new security();
$ban_ip = true;
if ($ban_ip == 'true') {
$_SESSION['SERVER_PORT'] = $_SERVER['SERVER_PORT'];
if ($level_user[0]->auth == self::LEVEL_MODO) {
$_SESSION['level_user'] = self::LEVEL_MODO;
$security->set_user_lvl(self::LEVEL_MODO);
} else {
if ($level_user[0]->auth == self::LEVEL_ADMIN) {
$_SESSION['level_user'] = self::LEVEL_ADMIN;
$security->set_user_lvl(self::LEVEL_ADMIN);
} else {
if ($level_user[0]->auth == self::LEVEL_SUPER_ADMIN) {
$_SESSION['level_user'] = self::LEVEL_SUPER_ADMIN;
$security->set_user_lvl(self::LEVEL_SUPER_ADMIN);
} else {
$_SESSION['level_user'] = self::LEVEL_USER;
$security->set_user_lvl(0);
}
}
}
}
}
?>
<p style="font-size:17px; padding:10px; margin-top:15px; text-align:center;" class="bg-warning">Vous êtes bien connecté !</p>
<p style="font-size:17px; padding:10px; text-align:center;" class="bg-warning">Bienvenue <?php
echo $login;
?>
</p>
<script>
function return_after(){
document.location.href="../../";
}
setTimeout(return_after,1000);
</script>
<?php
break;
}
}
}
}
} else {
$message = 'Erreur de connection , vérifiez vos données !';
echo '<div class="alert alert-danger" role="alert">' . $message . '</div>';
}
}
}