Hello Im A Newb Not a noob -_- im not that annoying
Well i wanted to test my Skill in codding So Im codding A CMS from scratch.. I Plan on adding basic authentication, because this is my first CMS the final outcome might be sloppy and full of exploits :/ WARNING: This is not a HABBO CMS this is a private CMS content management system i also hate habbo -_-
So Far Codded
Session Control
cookie Control
Template class
Authentication Class
Rank Class
Snippits:
updated:
Session Control for authentication:
authentication :
Notes:
Still haven't found away to return a error like $error :S but ill keep trying
So far you can log in by username or email, Users language is set when logged in sadley u cant change ur language un less you goto account settings and change it threw db UPDATE lol first CMS YAY and thanks for the negative comments ^_^
Well i wanted to test my Skill in codding So Im codding A CMS from scratch.. I Plan on adding basic authentication, because this is my first CMS the final outcome might be sloppy and full of exploits :/ WARNING: This is not a HABBO CMS this is a private CMS content management system i also hate habbo -_-
So Far Codded
Session Control
cookie Control
Template class
Authentication Class
Rank Class
Snippits:
updated:
Session Control for authentication:
PHP:
<?php
################################################
# Mojo - Created By GarettMcCarty
################################################
class session
{
static $id;
static $data = array();
public function __construct()
{
$this->system_check();
}
public static function system_check()
{
if(!isset($_SESSION)):
session_save_path('application\tmp');
session_start();
endif;
}
public static function check($id)
{
if(isset($_SESSION[$id])):
Return True;
else:
Return False;
endif;
}
public static function set_session($id, $data)
{
if(!static::check($id)):
$_SESSION[$id] = $data;
else:
Return False;
endif;
}
public static function forget($id)
{
if(static::check($id)):
unset($_SESSION[$id]);
endif;
}
}
?>
PHP:
<?php
################################################
# Mojo - Created By GarettMcCarty
################################################
class accounts {
public static function status()
{
global $sessions;
if($sessions->check('username') or $sessions->check('userid')):
Return True;
else:
Return False;
endif;
}
public static function information($name)
{
global $database, $validate;
$query = $database::query("SELECT * FROM accounts WHERE username='".$_SESSION['username']."' LIMIT 1");
$result = $database::sql_array($query);
return $result[$name];
}
public static function login()
{
global $database, $validate, $sessions, $cookie;
$username = $database::escape($_POST['m_username']);
$password = sha1($_POST['m_password']);
if($validate::email($username))
{
$query = $database::query("SELECT * FROM accounts WHERE email='".$username."' LIMIT 1");
$result = $database::sql_array($query);
if($database::sql_count($query) > 0)
{
if($result['password'] == $password)
{
$sessions::set_session('username', $result['username']);
$sessions::set_session('userid', $result['id']);
header("Location: me.php");
} else {
print "Wrong Password";
}
} else {
print "Email was not found";
}
} else {
$query = $database::query("SELECT * FROM accounts WHERE username='".$username."' LIMIT 1");
$result = $database::sql_array($query);
if($database::sql_count($query) > 0)
{
if($result['password'] == $password)
{
$sessions::set_session('username', $username);
$sessions::set_session('userid', $result['id']);
header("Location: me.php");
} else {
print "Wrong Password";
}
} else {
print "Username was not found";
}
}
}
public static function register()
{
}
}
?>
Notes:
Still haven't found away to return a error like $error :S but ill keep trying
So far you can log in by username or email, Users language is set when logged in sadley u cant change ur language un less you goto account settings and change it threw db UPDATE lol first CMS YAY and thanks for the negative comments ^_^