Session using cookie

This commit is contained in:
Ibnu Maksum
2024-02-12 09:45:44 +07:00
parent 66432eda56
commit 9543ee6e34
7 changed files with 80 additions and 13 deletions

View File

@ -22,6 +22,7 @@ switch ($do) {
$d_pass = $d['password'];
if (Password::_verify($password, $d_pass) == true) {
$_SESSION['aid'] = $d['id'];
Admin::setCookie($d['id']);
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username . ' ' . $_L['Login_Successful'], 'Admin', $d['id']);

View File

@ -238,7 +238,7 @@ switch ($action) {
if (Validator::Length($fullname, 36, 2) == false) {
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
}
if (!Validator::Length($password, 35, 2)) {
if (!Validator::Length($password, 36, 2)) {
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
}
@ -275,14 +275,14 @@ switch ($action) {
$service_type = _post('service_type');
run_hook('edit_customer'); #HOOK
$msg = '';
if (Validator::Length($username, 16, 2) == false) {
if (Validator::Length($username, 35, 2) == false) {
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
}
if (Validator::Length($fullname, 26, 1) == false) {
if (Validator::Length($fullname, 36, 1) == false) {
$msg .= 'Full Name should be between 2 to 25 characters' . '<br>';
}
if ($password != '') {
if (!Validator::Length($password, 15, 2)) {
if (!Validator::Length($password, 36, 2)) {
$msg .= 'Password should be between 3 to 15 characters' . '<br>';
}
}

View File

@ -22,6 +22,7 @@ switch ($do) {
$d_pass = $d['password'];
if (Password::_uverify($password, $d_pass) == true) {
$_SESSION['uid'] = $d['id'];
User::setCookie($d['id']);
$d->last_login = date('Y-m-d H:i:s');
$d->save();
_log($username . ' ' . $_L['Login_Successful'], 'User', $d['id']);

View File

@ -6,5 +6,7 @@
run_hook('customer_logout'); #HOOK
if (session_status() == PHP_SESSION_NONE) session_start();
Admin::removeCookie();
User::removeCookie();
session_destroy();
header('location: index.php');