diff --git a/app/Controllers/Api/Login.php b/app/Controllers/Api/Login.php index 81a2741..4a41753 100644 --- a/app/Controllers/Api/Login.php +++ b/app/Controllers/Api/Login.php @@ -43,21 +43,15 @@ class Login $data = json_decode($response, true); $loc = $data['country'].', '.$data['city']; - DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id, :platform, :browser, :browserversion, 0, :ip, :servicekey, :loc)', array( + DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id)', array( ':token' => $token, ':user_id' => $user_id, - ':platform' => $ua->platform(), - ':browser' => $ua->browser(), - ':browserversion' => $ua->browserVersion(), - ':ip' => $ip, - ':servicekey' => $servicekey, - ':loc' => $loc )); - setcookie("BIRUXSESS", $token, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); - setcookie("BIRUXSERVICE", $servicekey, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); - setcookie("BIRUXSESS_", '1', time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); - setcookie("BIRUXID", $user_id, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); + setcookie("NGALLERYSESS", $token, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); + setcookie("NGALLERYSERVICE", $servicekey, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); + setcookie("NGALLERYSESS_", '1', time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); + setcookie("NGALLERYID", $user_id, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); echo Json::return ( array( diff --git a/app/Controllers/Api/Register.php b/app/Controllers/Api/Register.php index 577ba9a..c4d99dd 100644 --- a/app/Controllers/Api/Register.php +++ b/app/Controllers/Api/Register.php @@ -56,7 +56,7 @@ class Register ) ); - DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password 5, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':email' => $email, ':content' => $content)); + DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl'=>'/static/img/avatar.png', ':email' => $email, ':content' => $content)); $cstrong = True; $token = GenerateRandomStr::gen_uuid(); $user_id = DB::query('SELECT id FROM users WHERE username=:username', array(':username' => $username))[0]['id']; @@ -81,15 +81,10 @@ class Register $data = json_decode($response, true); $loc = $data['country'].', '.$data['city']; - DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id, :platform, :browser, :browserversion, 0, :ip, :servicekey, :loc)', array( + DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id)', array( ':token' => $token, ':user_id' => $user_id, - ':platform' => $ua->platform(), - ':browser' => $ua->browser(), - ':browserversion' => $ua->browserVersion(), - ':ip' => $ip, - ':servicekey' => $servicekey, - ':loc' => $loc + )); setcookie("NGALLERYSESS", $token, time() + 120 * 180 * 240 * 720, '/', NULL, NULL, TRUE); diff --git a/app/Models/User.php b/app/Models/User.php new file mode 100644 index 0000000..3a42772 --- /dev/null +++ b/app/Models/User.php @@ -0,0 +1,15 @@ +userid = $user_id; + } + public function i($table) { + return DB::query("SELECT * FROM users WHERE id=:id", array(':id'=>$this->userid))[0][$table]; + } + +} \ No newline at end of file diff --git a/app/Services/Auth.php b/app/Services/Auth.php index e002984..437ef3e 100644 --- a/app/Services/Auth.php +++ b/app/Services/Auth.php @@ -9,18 +9,17 @@ class Auth { $userid = 0; - if (!empty($_COOKIE['NGALLERYSESS']) && !empty( $_COOKIE['NGALLERYSESS_']) || $_COOKIE['KANDLESERVICETOKEN__779hfh908BNol8FHn7d9MNFOL8fjND8D9MNfdo'] ==='BIRUXSERVICE__TOKENYY') { + if (!empty($_COOKIE['NGALLERYSESS']) && !empty($_COOKIE['NGALLERYSESS_'])) { $userInfo = DB::query('SELECT user_id FROM login_tokens WHERE token=:token', array(':token' => $_COOKIE['NGALLERYSESS'])); if ($userInfo && count($userInfo) > 0) { $userid = $userInfo[0]['user_id']; - DB::query('UPDATE users SET online=:timed WHERE id=:id', array(':id'=>$userid, ':timed'=>time())); - } else if ($_COOKIE['KANDLESERVICETOKEN__779hfh908BNol8FHn7d9MNFOL8fjND8D9MNfdo'] ==='BIRUXSERVICE__TOKENYY') { - return 1000000013; + + //DB::query('UPDATE users SET online=:timed WHERE id=:id', array(':id'=>$userid, ':timed'=>time())); } } - return $userid; + return (int)$userid; } diff --git a/ngallery.yaml b/ngallery.yaml index e69de29..c0b3603 100644 --- a/ngallery.yaml +++ b/ngallery.yaml @@ -0,0 +1,29 @@ +ngallery: + root: + maintenance: false + debug: true + botkey: '89D5D5DDS9SD' + db: + name: 'kndle' + host: '127.127.126.50' + login: 'root' + password: '' + websockets: + messages: "wss://birux.ru/wss" + storage: + type: 's3' + s3: + domains: + public: 'cdn.biruxpages.eu.org' + gateway: 'https://ebe2250f09e5d59d02abd3b5eb483b4b.eu.r2.cloudflarestorage.com' + credentials: + key: 'e5eb99cd33ef7b25a1cf2090cd1dc592' + secret: '4d7c5ed69cad0e28c545ea825fb51997c92127655f344b60efcfec64d0e4c2ff' + region: 'auto' + version: 'latest' + bucket: 'birux' + img: + proxy: true + percent: 50 + + \ No newline at end of file diff --git a/views/components/Navbar.php b/views/components/Navbar.php index b9ff55d..3019054 100644 --- a/views/components/Navbar.php +++ b/views/components/Navbar.php @@ -1,58 +1,87 @@ +