Esempio n. 1
0
	<script src="js/script.js"></script>
	<script src="js/view.js"></script>

</head>
<?php 
session_start();
include "timezone.php";
require_once "Dao.php";
$here = "view.php";
date_default_timezone_set("UTC");
$dao = new Dao();
$row = $dao->getLogin();
if (!$row) {
    header("Location: index.php");
}
$user = $dao->getUser($row["user_id"]);
$events = $dao->getUserEvents($user["id"]);
?>
<body>
<?php 
require_once "header.php";
?>

<div class="h2Wrap">
	<h2>
		<?php 
echo htmlspecialchars($user["username"]);
?>
's Events
	</h2>
</div>
Esempio n. 2
0
<?php

session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/Dao.php";
$dao = new Dao();
$user = $dao->getUser($_SESSION["email"]);
$user_id = $user["id"];
$content = clean_input($_POST["content"]);
$post_id = $_POST["post_id"];
$id = $dao->saveComment($user_id, $post_id, $content);
function clean_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
?>

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="refresh" content="0; url=<?php 
echo $_SERVER['HTTP_REFERER'];
?>
" />
</head>
<body>
  <h1>
  </h1>
<?php

session_start();
include "timezone.php";
require_once "Dao.php";
date_default_timezone_set("UTC");
$dao = new Dao();
$row = $dao->getLogin();
$sherpa = $dao->getUser($row["user_id"]);
$createConsole = $_POST["createConsole"];
if ($createConsole === "1") {
    $createConsole = "PS3";
} else {
    if ($createConsole === "2") {
        $createConsole = "X360";
    } else {
        if ($createConsole === "3") {
            $createConsole = "PS4";
        } else {
            if ($createConsole === "4") {
                $createConsole = "X1";
            } else {
                $createConsole = "ERR";
            }
        }
    }
}
$createActivity = $_POST["createActivity"];
$createDateTime = $_POST["createDate"] . " " . $_POST["createTime"];
$createOther = $_POST["createOther"];
if ($createConsole === "ERR" || empty($createActivity) || empty($createDateTime)) {
Esempio n. 4
0
} else {
    if (!preg_match("/([\\w\\-]+\\@[\\w\\-]+\\.[\\w\\-]+)/", $email)) {
        $_SESSION["form_errors"] = true;
        $_SESSION["email_error"] = "A valid email is required";
        $_SESSION["email"] = $email;
    }
}
if (empty($_POST["password"])) {
    $_SESSION["form_errors"] = true;
    $_SESSION["password_error"] = "A password is required";
    $_SESSION["email"] = $email;
} else {
    $password = $pass->crypt_pass($_POST['password']);
}
if ($_SESSION["password_error"] === "") {
    $user = $dao->getUser($email);
    if (is_null($user["email"])) {
        $_SESSION["form_errors"] = true;
        $_SESSION["email_error"] = "Account not found";
        $_SESSION["email"] = $email;
    } else {
        if ($pass->is_password_correct($user, "{$password}")) {
            $_SESSION["name"] = $user["first"];
            $_SESSION["email"] = $email;
            $_SESSION["user_id"] = $user["id"];
        } else {
            $_SESSION["form_errors"] = true;
            $_SESSION["password_error"] = "Invalid password";
            $_SESSION["email"] = $email;
        }
    }
	<script src="js/jquery.js"></script>
	<script src="js/script.js"></script>
	<script src="js/account.js"></script>
</head>
<?php 
session_start();
require_once "Dao.php";
require_once "User.php";
$here = "account.php";
date_default_timezone_set("UTC");
$dao = new Dao();
$row = $dao->getLogin();
if (!$row) {
    header("Location: index.php");
}
$userData = $dao->getUser($row["user_id"]);
$user = new User($userData["username"]);
$PS3 = $userData["console"] === "PS3" ? " active" : "";
$X360 = $userData["console"] === "X360" ? " active" : "";
$PS4 = $userData["console"] === "PS4" ? " active" : "";
$X1 = $userData["console"] === "X1" ? " active" : "";
if (isset($_SESSION["account_updateFail"]) && !empty($_SESSION["account_updateFail"])) {
    $PS3 = "";
    $X360 = "";
    $PS4 = "";
    $X1 = "";
    if ($_SESSION["account_updateConsole"] === 1) {
        $PS3 = " active";
    } else {
        if ($_SESSION["account_updateConsole"] === 2) {
            $X360 = " active";
        if ($filterConsole === "3") {
            $filterConsole = "PS4";
        } else {
            if ($filterConsole === "4") {
                $filterConsole = "X1";
            } else {
                $filterConsole = "*";
            }
        }
    }
}
$filterActivity = $_POST["activity"];
$filterDateTime = $_POST["dateTime"];
$filterResult = $dao->filterEvents($filterConsole, $filterActivity, $filterDateTime);
foreach ($filterResult as $event) {
    $sherpa = $dao->getUser($event["sherpa"]);
    $activity = $dao->getActivity($event["activity"]);
    ?>
	<a class="eventWrap" href="details.php?id=<?php 
    echo $event["id"];
    ?>
">
		<div class="event">
			<div class="eventSherpa">
				<div class="eventConsole">
					<div class="event<?php 
    echo $event["console"];
    ?>
 consoleMini">
						<?php 
    echo htmlspecialchars($event["console"]);
<?php

session_start();
require_once "Dao.php";
require_once "User.php";
date_default_timezone_set("UTC");
$dao = new Dao();
$row = $dao->getLogin();
if (!$row) {
    header("Location: index.php");
}
$userRow = $dao->getUser($row["user_id"]);
$username = $userRow["username"];
$password = $userRow["password"];
$console = $_POST["accountConsole"];
if ($console === "1") {
    $console = "PS3";
} else {
    if ($console === "2") {
        $console = "X360";
    } else {
        if ($console === "3") {
            $console = "PS4";
        } else {
            if ($console === "4") {
                $console = "X1";
            } else {
                $console = "ERR";
            }
        }
    }
<?php

session_start();
require_once "Dao.php";
$dao = new Dao();
$email = isset($_POST["email"]) ? $_POST["email"] : "";
$pass = isset($_POST["pass"]) ? $_POST["pass"] : "";
$count = $dao->getUser($email, $pass);
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count != null) {
    $_SESSION["access_granted"] = true;
    $_SESSION["email"] = $email;
    $dao->saveLogOn($email);
    header("Location:myprofile.php");
} else {
    $count = $dao->getUser($email, $pass);
    $status = "Invalid username or password";
    $_SESSION["status"] = $status;
    $_SESSION["email_preset"] = $_POST["email"];
    $_SESSION["access_granted"] = false;
    header("Location:login.php");
}