mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-19 18:46:41 +00:00
Should be able to run on PHP >= 5.5
This commit is contained in:
parent
e3ab67e95c
commit
24f7fd670a
@ -18,7 +18,9 @@ if ($user != NULL) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
(new MessageCookie("Username or password incorrect", "login"))->setCookie();
|
$msg = new MessageCookie("Username or password incorrect", "login");
|
||||||
|
$msg->setCookie();
|
||||||
|
|
||||||
header("Location: login.php#login");
|
header("Location: login.php#login");
|
||||||
|
|
||||||
}
|
}
|
@ -1,10 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: simon
|
|
||||||
* Date: 24/09/17
|
|
||||||
* Time: 1:59 PM
|
|
||||||
*/
|
|
||||||
|
|
||||||
class MessageCookie
|
class MessageCookie
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
include_once "include/config.php";
|
include_once "include/config.php";
|
||||||
|
|
||||||
class SessionManager
|
class SessionManager
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
include_once "include/SqlConnection.php";
|
include_once "include/SqlConnection.php";
|
||||||
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
class TokenManager
|
class TokenManager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -12,4 +12,3 @@ define("MAR_SERVER_NAME", "Official MAR server");
|
|||||||
|
|
||||||
//Plugins
|
//Plugins
|
||||||
//Version
|
//Version
|
||||||
//Server name
|
|
19
index.php
19
index.php
@ -22,6 +22,15 @@ $user = SessionManager::get();
|
|||||||
<!--[if lte IE 8]>
|
<!--[if lte IE 8]>
|
||||||
<link rel="stylesheet" href="assets/css/ie8.min.css"/><![endif]-->
|
<link rel="stylesheet" href="assets/css/ie8.min.css"/><![endif]-->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'fixedsys';
|
||||||
|
src: url("./mar/fonts/FSEX301-L2.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="homepage">
|
<body class="homepage">
|
||||||
|
|
||||||
@ -54,16 +63,6 @@ $user = SessionManager::get();
|
|||||||
<div class="row 200%">
|
<div class="row 200%">
|
||||||
<div class="12u">
|
<div class="12u">
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: 'fixedsys';
|
|
||||||
src: url("./mar/fonts/FSEX301-L2.ttf");
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- Features -->
|
<!-- Features -->
|
||||||
<section class="box features">
|
<section class="box features">
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
include_once "include/UserManager.php";
|
include_once "include/UserManager.php";
|
||||||
include_once "include/MessageCookie.php";
|
include_once "include/MessageCookie.php";
|
||||||
include_once "include/SessionManager.php";
|
include_once "include/SessionManager.php";
|
||||||
@ -17,7 +13,8 @@ $password = filter_var($_POST['password'], FILTER_SANITIZE_STRING);
|
|||||||
|
|
||||||
if (strlen($username) < 5 || strlen($username) > 20) {
|
if (strlen($username) < 5 || strlen($username) > 20) {
|
||||||
|
|
||||||
(new MessageCookie("Username must be 5-20 characters", "register"))->setCookie();
|
$msg = new MessageCookie("Username must be 5-20 characters", "register");
|
||||||
|
$msg->setCookie();
|
||||||
header("Location: login.php#register");
|
header("Location: login.php#register");
|
||||||
|
|
||||||
} else if (strlen($password) < 8 || strlen($password) > 32) {
|
} else if (strlen($password) < 8 || strlen($password) > 32) {
|
||||||
@ -32,11 +29,12 @@ if (strlen($username) < 5 || strlen($username) > 20) {
|
|||||||
|
|
||||||
//Register success
|
//Register success
|
||||||
//Generate session
|
//Generate session
|
||||||
SessionManager::generate(new User($username, 0));
|
SessionManager::generate(new User($username));
|
||||||
header("Location: index.php"); //todo User page
|
header("Location: index.php"); //todo User page
|
||||||
} else {
|
} else {
|
||||||
//Register failed
|
//Register failed
|
||||||
(new MessageCookie("Username already in use", "register"))->setCookie();
|
$msg = new MessageCookie("Username already in use", "register");
|
||||||
|
$msg->setCookie();
|
||||||
header("Location: login.php#register");
|
header("Location: login.php#register");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user