[USER=20311]@shadows[/USER] what do you think of this for getting current user without a global this way it can be passed around easier with the constructor
dont want to be passing globals around if i can help it, ive removed the array config and replaced with one where they defined like you suggested
to avoid having to pass $site_config around
using the cookie[pass] the token is encrypted and generated at every login
when a member visits the original cookie functions are still there so there not automatically signed in
dont want to be passing globals around if i can help it, ive removed the array config and replaced with one where they defined like you suggested
to avoid having to pass $site_config around
using the cookie[pass] the token is encrypted and generated at every login
when a member visits the original cookie functions are still there so there not automatically signed in
// set token
if(isset($_COOKIE['pass'])) {
DB::run("UPDATE users SET token=? WHERE id=?", [$_COOKIE['pass'], $_COOKIE['uid']]);
}
// replace curuser with model method
$res = DB::run("SELECT * FROM users INNER JOIN groups ON users.class=groups.group_id WHERE token=? AND users.enabled='yes' AND users.status = 'confirmed'", [$_COOKIE['pass']]);
$row = $res->fetch(PDO::FETCH_ASSOC);
// $row = $this->userModel->getToken()
// echo $_COOKIE['pass'];
// example $2y$10$4.YE57V9O.GbaT/4NqKcEuY3j04ODZVQUp3Jzgus9uRUSMdN1TQxi

