fix cookies

This commit is contained in:
iBNu Maksum 2025-02-07 15:18:50 +07:00
parent 91271b9f00
commit b6fadae2e5
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -29,7 +29,7 @@ class User
public static function getTawkToHash($email) public static function getTawkToHash($email)
{ {
global $config; global $config;
if (!empty($config['tawkto_api_key']) && !Empty($email)) { if (!empty($config['tawkto_api_key']) && !empty($email)) {
return hash_hmac('sha256', $email, $config['tawkto_api_key']); return hash_hmac('sha256', $email, $config['tawkto_api_key']);
} }
return ''; return '';
@ -187,7 +187,7 @@ class User
global $db_pass; global $db_pass;
if (isset($uid)) { if (isset($uid)) {
$token = self::generateToken($uid); $token = self::generateToken($uid);
setcookie('uid', $token['token'], time() + 86400 * 30); setcookie('uid', $token['token'], time() + 86400 * 30, "/");
return $token; return $token;
} else { } else {
return false; return false;
@ -197,7 +197,7 @@ class User
public static function removeCookie() public static function removeCookie()
{ {
if (isset($_COOKIE['uid'])) { if (isset($_COOKIE['uid'])) {
setcookie('uid', '', time() - 86400); setcookie('uid', '', time() - 86400, "/");
} }
} }
@ -277,7 +277,8 @@ class User
return $d; return $d;
} }
public static function setFormCustomField($uid = 0){ public static function setFormCustomField($uid = 0)
{
global $UPLOAD_PATH; global $UPLOAD_PATH;
$fieldPath = $UPLOAD_PATH . DIRECTORY_SEPARATOR . "customer_field.json"; $fieldPath = $UPLOAD_PATH . DIRECTORY_SEPARATOR . "customer_field.json";
if (!file_exists($fieldPath)) { if (!file_exists($fieldPath)) {
@ -291,7 +292,8 @@ class User
} }
} }
public static function getFormCustomField($ui, $register = false, $uid = 0){ public static function getFormCustomField($ui, $register = false, $uid = 0)
{
global $UPLOAD_PATH; global $UPLOAD_PATH;
$fieldPath = $UPLOAD_PATH . DIRECTORY_SEPARATOR . "customer_field.json"; $fieldPath = $UPLOAD_PATH . DIRECTORY_SEPARATOR . "customer_field.json";
if (!file_exists($fieldPath)) { if (!file_exists($fieldPath)) {