diff --git a/dev/app/HUtils.php b/dev/app/HUtils.php deleted file mode 100644 index b620cac..0000000 --- a/dev/app/HUtils.php +++ /dev/null @@ -1,26 +0,0 @@ - \ No newline at end of file diff --git a/dev/app/assets/AssetHandler.php b/dev/app/assets/AssetHandler.php deleted file mode 100644 index 05dad34..0000000 --- a/dev/app/assets/AssetHandler.php +++ /dev/null @@ -1,17 +0,0 @@ -'; - } - else{ - echo 'prepare("SELECT * FROM users where email = :email"); - //Bind parameters - $query->bindParam(':email', $email, PDO::PARAM_STR, 256); - //Voer de query uit - $query->execute(); - //Check de hoeveelheid rijen die de database returnt. - if($query->rowCount() == 0){ - //Email adres is niet in gebruik, return false - return false; - } - else{ - //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true. - return true; - } - } - //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel. - static function checkUsedUsername($username){ - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("SELECT * FROM users where username = :username"); - //Bind parameters - $query->bindParam(':username', $username, PDO::PARAM_STR, 256); - //Voer de query uit - $query->execute(); - //Check de hoeveelheid rijen die de database returnt. - if($query->rowCount() == 0){ - //Username adres is niet in gebruik, return false - return false; - } - else{ - //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true. - return true; - } - } - //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam. - static function registerUser($email, $password, $username){ - $ip = $_SERVER['REMOTE_ADDR']; - //Initit db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)"); - //Bind parameters - $query->bindParam(':username', $username, PDO::PARAM_STR, 256); - $query->bindParam(':email', $email, PDO::PARAM_STR, 256); - $query->bindParam(':password', $password, PDO::PARAM_STR, 256); - $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256); - //Voer query uit - $query->execute(); - } - //Check of gegeven login info in de database voorkomt - static function isLoginValid($email, $password){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password"); - //Bind params - $query->bindParam(':email', $email, PDO::PARAM_STR, 256); - $query->bindParam(':password', $password, PDO::PARAM_STR, 256); - //Voer query it - $query->execute(); - //Check hoeveelheid teruggestuurde rijen - if($query->rowCount() == 1){ - //login correct (komt voor in de db) - return true; - } - else{ - //Incorrect - return false; - } - } - //Vraag gebruikers ID op doormiddel van email en pass - static function getUID($email, $password){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password"); - //Bind params - $query->bindParam(':email', $email, PDO::PARAM_STR, 256); - $query->bindParam(':password', $password, PDO::PARAM_STR, 256); - //Voer query it - $query->execute(); - //Check hoeveelheid teruggestuurde rijen - if($query->rowCount() == 1){ - //login correct, return uid - $result = $query->fetch(PDO::FETCH_COLUMN); - return $result; - } - else{ - //something went wrong, return -1 - return -1; - } - } - static function getUsername($uid){ - $con = Database::connectToDB(); - $query = $con->prepare("SELECT username FROM users where id = :uid"); - $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256); - $query->execute(); - if($query->rowCount() == 1){ - //login correct, return uid - $result = $query->fetch(PDO::FETCH_COLUMN); - return $result; - } - else{ - //something went wrong, return -1 - return "dbfetcherror"; - } - } - static function isSessionTokenInUse($token){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("SELECT * FROM usersessions where token = :token"); - //Bind params - $query->bindParam(':token', $token, PDO::PARAM_STR, 256); - //Voer query it - $query->execute(); - //Check hoeveelheid teruggestuurde rijen - if($query->rowCount() == 0){ - return false; - } - else{ - return true; - } - } - static function registerNewSession($uid, $token, $expires){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)"); - //Bind params - $query->bindParam(':uid', $uid, PDO::PARAM_INT); - $query->bindParam(':token', $token, PDO::PARAM_STR, 256); - $query->bindParam(':expires', $expires, PDO::PARAM_STR); - //Voer query it - $query->execute(); - } - static function isSessionValid($token, $uid){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()"); - //Bind params - $query->bindParam(':token', $token, PDO::PARAM_STR, 256); - $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256); - //Voer query it - $query->execute(); - //Check hoeveelheid teruggestuurde rijen - if($query->rowCount() == 1){ - return true; - } - else{ - return false; - } - } - static function invalidateSession($token){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("DELETE FROM usersessions WHERE token = :token"); - //Bind params - $query->bindParam(':token', $token, PDO::PARAM_STR, 256); - //Voer query it - $query->execute(); - } - static function invalidateSessionByUID($uid){ - //Init db connection - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid"); - //Bind params - $query->bindParam(':token', $uid, PDO::PARAM_INT); - //Voer query it - $query->execute(); - } - static function deleteExpiredSessions(){ - $con = Database::connectToDB(); - //Bereid query voor - $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()"); - $query->execute(); - } - static function getSessionExpiryDate($token){ - $con = Database::connectToDB(); - $query = $con->prepare("SELECT expires FROM usersessions where token = :token"); - $query->bindParam(':token', $token, PDO::PARAM_STR, 256); - $query->execute(); - if($query->rowCount() == 1){ - //login correct, return uid - $result = $query->fetch(PDO::FETCH_COLUMN); - return $result; - } - else{ - //something went wrong, return -1 - return "2000-01-01 00:00:00"; - } - } - static function createThread(){ - - } -} -?> \ No newline at end of file diff --git a/dev/app/login/UserSession.php b/dev/app/login/UserSession.php deleted file mode 100644 index c795add..0000000 --- a/dev/app/login/UserSession.php +++ /dev/null @@ -1,92 +0,0 @@ -username = $username; - $this->uid = $uid; - $this->token = $token; - $this->setExpiry(); - //echo($username."
"); - //echo($loginSessionToken); - $_SESSION['usersession'] = $this; - setcookie('usersession', $this->token); - setcookie('uid', $this->uid); - } - public function setSessionToken($token){ - $this->token = $token; - } - public function getSessionToken(){ - return $this->token; - } - public function getFormattedExpiry(){ - return $this->expires->format('Y-m-d H:i:s'); - } - public function setExpiry(){ - $this->expires = new DateTime(); - $this->expires->modify("+ 1 hour"); - } - public static function generateToken(){ - $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - $token = ""; - for ($i=0; $i < 32 ; $i++) { - $token .= $chars[rand(0, strlen($chars) - 1)]; - } - return $token; - } - public static function isSessionValid(){ - if(isset($_SESSION['usersession'])){ - if(!UserSession::isSessionExpired($_SESSION['usersession'])){ - //check if session also exists in database - return true; - } - } - else{ - if(isset($_COOKIE['usersession'])){ - $token = $_COOKIE['usersession']; - $uid = $_COOKIE['uid']; - if(Database::isSessionValid($token,$uid)){ - $username = Database::getUsername($uid); - $session = new UserSession($username, $uid, $token); - $session->expires = new DateTime(Database::getSessionExpiryDate($token)); - } - else{ - return false; - } - if(!UserSession::isSessionExpired($session)){ - return true; - } - } - return false; - } - } - public static function getSession() - { - return $_SESSION['usersession']; - } - public static function isSessionExpired($session){ - //session is expired - if(new DateTime() > $session->expires){ - return true; - } - //session is not expired - else{ - return false; - } - } - public static function isUserSignedIn(){ - if(UserSession::isSessionValid()){ - if(!UserSession::isSessionExpired(UserSession::getSession())){ - if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){ - return true; - } - } - else{ - return false; - } - } - } -} -?> \ No newline at end of file diff --git a/dev/app/login/attempt_login.php b/dev/app/login/attempt_login.php deleted file mode 100644 index cae9861..0000000 --- a/dev/app/login/attempt_login.php +++ /dev/null @@ -1,46 +0,0 @@ -getSessionToken(); - echo "
"; - echo $a->uid; - echo "
"; - echo $a->username; - } - //clean up expired sessions from ANY users - Database::deleteExpiredSessions(); - Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry()); - //logged in, time to continue with other stuff - } - else{ - echo "uid returned -1 from db interface"; - } - } - else{ - echo("login invalid"); - } - } -} -else{ - //we're done, don't even need to log in, session already active - //echo($_SESSION['usersession']->uid); -} -?> \ No newline at end of file diff --git a/dev/app/login/attempt_logout.php b/dev/app/login/attempt_logout.php deleted file mode 100644 index 456fc0f..0000000 --- a/dev/app/login/attempt_logout.php +++ /dev/null @@ -1,12 +0,0 @@ -token); - session_destroy(); -} - - - - - -?> \ No newline at end of file diff --git a/dev/app/login/destroy.php b/dev/app/login/destroy.php deleted file mode 100644 index ecf6762..0000000 --- a/dev/app/login/destroy.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/dev/app/pagecontent/content_createthread.php b/dev/app/pagecontent/content_createthread.php deleted file mode 100644 index 176c8a7..0000000 --- a/dev/app/pagecontent/content_createthread.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/dev/app/pagecontent/content_header.php b/dev/app/pagecontent/content_header.php deleted file mode 100644 index 1c07e88..0000000 --- a/dev/app/pagecontent/content_header.php +++ /dev/null @@ -1,7 +0,0 @@ - - \ No newline at end of file diff --git a/dev/app/pagecontent/content_header_signedin.php b/dev/app/pagecontent/content_header_signedin.php deleted file mode 100644 index 76343dd..0000000 --- a/dev/app/pagecontent/content_header_signedin.php +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/dev/app/pagecontent/content_index.php b/dev/app/pagecontent/content_index.php deleted file mode 100644 index 852160d..0000000 --- a/dev/app/pagecontent/content_index.php +++ /dev/null @@ -1,3 +0,0 @@ -
-

Welkom op hForumPHP. Log in of registreer om iets te doen.

-
\ No newline at end of file diff --git a/dev/app/pagecontent/content_page.php b/dev/app/pagecontent/content_page.php deleted file mode 100644 index ed57278..0000000 --- a/dev/app/pagecontent/content_page.php +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - <?=$sSiteTitle?> - - - - - -
- -
-
- -
- - \ No newline at end of file diff --git a/dev/app/pagecontent/login/content_destroy.php b/dev/app/pagecontent/login/content_destroy.php deleted file mode 100644 index dc3cd8b..0000000 --- a/dev/app/pagecontent/login/content_destroy.php +++ /dev/null @@ -1,3 +0,0 @@ -
-

You're still signed in thanks to our cookies!

-
\ No newline at end of file diff --git a/dev/app/pagecontent/login/content_login.php b/dev/app/pagecontent/login/content_login.php deleted file mode 100644 index dd07475..0000000 --- a/dev/app/pagecontent/login/content_login.php +++ /dev/null @@ -1,10 +0,0 @@ -
-
- E-mail:
- Password:
- -
-
- \ No newline at end of file diff --git a/dev/app/pagecontent/login/content_login_succesful.php b/dev/app/pagecontent/login/content_login_succesful.php deleted file mode 100644 index ea09f68..0000000 --- a/dev/app/pagecontent/login/content_login_succesful.php +++ /dev/null @@ -1,8 +0,0 @@ -
-

Login succesful :DDDDDDDD

-
- \ No newline at end of file diff --git a/dev/app/pagecontent/login/content_login_unsuccesful.php b/dev/app/pagecontent/login/content_login_unsuccesful.php deleted file mode 100644 index a9a1ae8..0000000 --- a/dev/app/pagecontent/login/content_login_unsuccesful.php +++ /dev/null @@ -1,3 +0,0 @@ -
-

UNEXPECTED LOGIN ERROR. OUR CODEMONKEYS DID SOMETHING VERY WRONG :(

-
\ No newline at end of file diff --git a/dev/app/pagecontent/login/content_register.php b/dev/app/pagecontent/login/content_register.php deleted file mode 100644 index 9bdc0ac..0000000 --- a/dev/app/pagecontent/login/content_register.php +++ /dev/null @@ -1,9 +0,0 @@ -
-
- Username:
- E-mail:
- Password:
- Verify Password:
- -
-
\ No newline at end of file diff --git a/dev/app/registration/attempt_register.php b/dev/app/registration/attempt_register.php deleted file mode 100644 index 1441324..0000000 --- a/dev/app/registration/attempt_register.php +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/dev/css/main.css b/dev/css/main.css deleted file mode 100644 index e69de29..0000000 diff --git a/dev/img/logo.png b/dev/img/logo.png deleted file mode 100644 index 5837651..0000000 Binary files a/dev/img/logo.png and /dev/null differ diff --git a/dev/index.php b/dev/index.php deleted file mode 100644 index d2d3c64..0000000 --- a/dev/index.php +++ /dev/null @@ -1,32 +0,0 @@ - \ No newline at end of file