require_once 'header.php'; require_once '../Includes/database.php'; @session_start(); if (isset($_SESSION['username']) || isset($_COOKIE['userid'])) { redirect('/newForum'); } if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "") { $redirect = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header("HTTP/1.1 301 Moved Permanently"); header("Location: {$redirect}"); } if (!isset($_SESSION['username'])) { if (isset($_POST['login'])) { $user = new UserDatabase(); $eror = $user->login(mysqlPrep($_POST['txtUsername']), mysqlPrep(trim($_POST['txtPassword']))); if ($eror) { echo ";;fkjd"; $loginError = "Login Successful"; @session_start(); $_SESSION['username'] = $eror[2]; $_SESSION['id'] = $eror[0]; $_SESSION['firstname'] = $eror[1]; if (isset($_POST['remember']) && $_POST['remember'] == 0) { //echo "posted"; setcookie('userid', $eror[0], time() + 24 * 7 * 60 * 60); setcookie('firstName', $eror[1], time() + 24 * 7 * 60 * 60); } //print_r($_POST); redirect("/newForum/index.php?usrid={$eror[1]}"); } else {