Begin work on session system and start work on Sock Chat auth.
This commit is contained in:
parent
c1c8bfaaf9
commit
0c47a9037d
6 changed files with 71 additions and 36 deletions
46
_developer_data/Sakura.php
Normal file
46
_developer_data/Sakura.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Sakura Sock Chat authentication script
|
||||||
|
* By Flashwave
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
$sockSakuraPath = ''; // Filesystem path to the _sakura folder WITHOUT an ending /
|
||||||
|
|
||||||
|
/* * * DON'T EDIT ANYTHING BELOW THIS LINE * * */
|
||||||
|
|
||||||
|
// Include Sakura
|
||||||
|
require_once $sockSakuraPath .'/sakura.php';
|
||||||
|
|
||||||
|
use sockchat\Auth;
|
||||||
|
|
||||||
|
if(Auth::getPageType() == AUTH_FETCH) {
|
||||||
|
|
||||||
|
// Check if user is logged into the Sakura backend if not deny
|
||||||
|
if(/* Login check */) {
|
||||||
|
|
||||||
|
// If so append the required arguments and accept
|
||||||
|
Auth::AppendArguments([/* User ID */, /* Session ID */]);
|
||||||
|
Auth::Accept();
|
||||||
|
|
||||||
|
} else
|
||||||
|
Auth::Deny();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Check if session is active else deny
|
||||||
|
if(/* Check if session is active */) {
|
||||||
|
|
||||||
|
Auth::SetUserData(
|
||||||
|
/* User ID */,
|
||||||
|
/* Username */,
|
||||||
|
/* User colour */
|
||||||
|
);
|
||||||
|
|
||||||
|
} else
|
||||||
|
Auth::Deny();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serve the authentication data
|
||||||
|
Auth::Serve();
|
|
@ -7,6 +7,10 @@ namespace Sakura;
|
||||||
|
|
||||||
class Session {
|
class Session {
|
||||||
|
|
||||||
|
// Current user data
|
||||||
|
public static $userId;
|
||||||
|
public static $sessionId;
|
||||||
|
|
||||||
// Initiate new session
|
// Initiate new session
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ class Users {
|
||||||
'password_chan' => 0,
|
'password_chan' => 0,
|
||||||
'password_new' => '',
|
'password_new' => '',
|
||||||
'email' => 'deleted@flashii.net',
|
'email' => 'deleted@flashii.net',
|
||||||
'group_main' => 0,
|
'rank_main' => 0,
|
||||||
'groups' => '[0]',
|
'ranks' => '[0]',
|
||||||
'name_colour' => '',
|
'name_colour' => '',
|
||||||
'register_ip' => '127.0.0.1',
|
'register_ip' => '127.0.0.1',
|
||||||
'last_ip' => '127.0.0.1',
|
'last_ip' => '127.0.0.1',
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# Empty .htaccess to make git realise this directory exists
|
|
|
@ -1 +0,0 @@
|
||||||
<wow aja i mean sock chat>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>Amu Style Tests</title>
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<input type="submit" />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Reference in a new issue