diff --git a/cookie_checking.php b/cookie_checking.php
new file mode 100644
index 0000000000000000000000000000000000000000..114baadeef5ecce53910eb7141945bf56dfff247
--- /dev/null
+++ b/cookie_checking.php
@@ -0,0 +1,56 @@
+/**
+ * Created by PhpStorm.
+ * User: kevin
+ * Date: 2/1/2019
+ * Time: 4:17 PM
+ */
+
+<?php
+/**
+ * Created by PhpStorm.
+ * User: kevin
+ * Date: 10/22/2018
+ * Time: 10:47 PM
+ */
+
+require "dbConnect.php";
+#Cookie Checking, Expire -> Redirect to Login, Not set -> Redirect to Login
+if(isset($_COOKIE["loginCredentials"] )){
+    # Already set
+    list($idUser,$expire) = explode("|",$_COOKIE["loginCredentials"]);
+    if ($expire < time()){
+        #Expire
+        unset($_COOKIE['loginCredentials']);
+        setcookie('loginCredentials','',time()-3600,"/");
+        header("Location: admin/login.html");
+        die();
+    }
+    else {
+        $stmt = $conn -> prepare('SELECT * FROM `user` WHERE id = ?');
+        if (!$stmt) {
+            echo $conn->error;
+            return;
+        }
+        $stmt->bind_param("s", $idUser);
+        $stmt->execute();
+        $result = $stmt->get_result();
+        $results_array = array();
+        while ($row = $result->fetch_assoc()) {
+            $results_array[] = $row;
+        }
+
+        if (empty($results_array)){
+            #User invalid
+            unset($_COOKIE['loginCredentials']);
+            setcookie('loginCredentials','',time()-3600,"/");
+            header("Location: admin/login.html");
+            die();
+        }
+    }
+}else{
+    #Not set
+    unset($_COOKIE['loginCredentials']);
+    setcookie('loginCredentials','',time()-3600,"/");
+    header("Location: admin/login.html");
+    die();
+}
\ No newline at end of file
diff --git a/login_process.php b/login_process.php
index 54867d51183967d49b42783d9cca252d96771ea2..e4fa2eae930721e9f0d85ad2b5b6d123b82a48d6 100644
--- a/login_process.php
+++ b/login_process.php
@@ -28,11 +28,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST'){
     while ($row = $result->fetch_assoc()) {
         $results_array[] = $row;
     }
-    var_dump($results_array);
 }
 
 if (!empty($results_array)) {
     header("Location: admin/");
+    # set cookie and expire in 1 hour
+    $expire = time() + 3600;
+    setcookie("loginCredentials", (string) $results_array[0]['id'] . "|$expire", $expire, "/");
     die();
 } else {
     header("Location: admin/login.html");
diff --git a/register.php b/register.php
index 0606802b875977d92b2cfaebef642cc4c9d177f4..0e9bd0b9d20e1cf4b17642987b6d845c06bb8d81 100644
--- a/register.php
+++ b/register.php
@@ -21,9 +21,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST'){
 
     if(!is_null($user)) {
         header("Location: admin");
-        echo '<script language="javascript">';
-        echo 'alert("Username has already taken")';  
-        echo '</script>';
+        echo "<script language='javascript'>";
+        echo "alert('Username has already taken')";
+        echo "</script>";
         die();
         //exit();
     } else {