<?php

if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION['loggedIn'])) {
    require_once '../access.php';
    if (userIsLoggedIn()) {
        header("Location: ../");
        exit;
    }
}
?>

<!DOCTYPE html>
<html>
<!-- Monitordroid Web Application
     By Monitordroid Inc.
     Last Updated July 2015 -->
    <head>
      <title>Monitordroid Login</title>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="apple-touch-icon" sizes="57x57" href="../img/apple-touch-icon-57x57.png">
      <link rel="apple-touch-icon" sizes="60x60" href="../img/apple-touch-icon-60x60.png">
      <link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
      <link rel="apple-touch-icon" sizes="76x76" href="../img/apple-touch-icon-76x76.png">
      <link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
      <link rel="apple-touch-icon" sizes="120x120" href="../img/apple-touch-icon-120x120.png">
      <link rel="apple-touch-icon" sizes="144x144" href="../img/apple-touch-icon-144x144.png">
예제 #2
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/voteonline/include/magicquotes.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/voteonline/include/access.inc.php';
if (!userIsLoggedIn()) {
    $loginstate = 'Zaloguj';
    include '../templates/login.html.php';
    exit;
} else {
    $loginstate = 'Wyloguj(' . $_SESSION['userlogin'] . ')';
}
if (!userHasRole('Administrator')) {
    $error = 'Dostęp do tej strony mają tylko Administratorzy';
    include '../templates/accessdenied.html.php';
    exit;
}
include $_SERVER['DOCUMENT_ROOT'] . '/voteonline/include/db.inc.php';
//wybór danych użytkownika do edycji
if (isset($_GET['action']) and $_GET['action'] == 'Edytuj') {
    try {
        $sql = 'SELECT id, login, email, roleid FROM users WHERE login = :login';
        $s = $pdo->prepare($sql);
        $s->bindValue(':login', $_GET['login']);
        $s->execute();
    } catch (PDOException $e) {
        $error = 'Błąd podczas pobierania danych użytkownika.';
        include '../templates/error.html.php';
        exit;
    }
    foreach ($s as $row) {
        $menageuserid = $row['id'];
예제 #3
0
function authCheck($redirect)
{
    if (!userIsLoggedIn()) {
        return header('Location: ' . $redirect);
    }
}
예제 #4
0
    try {
        $sql = 'SELECT COUNT(*) FROM users WHERE
        name = :name';
        $s = $pdo->prepare($sql);
        $s->bindParam(':name', $_POST['name']);
        $res = $s->execute();
        $row = $s->fetch();
        if ($row[0] > 0) {
            $regError = 'Имя занято! Выберите пожалуйста другое!';
            include $_SERVER['DOCUMENT_ROOT'] . '/reg_log/reg.html.php';
            exit;
        }
        $password = md5($_POST['password'] . $_POST['name']);
        $sql = 'INSERT INTO users SET
        name = :name, password = :password';
        $s = $pdo->prepare($sql);
        $s->bindParam(':name', $_POST['name']);
        $s->bindParam(':password', $password);
        $s->execute();
        $loginError = 'Вы удачно зарегистрировались в системе, теперь можете авторизироваться!';
    } catch (PDOException $e) {
        $error = 'Не удалось зарегистрироваться в чате. Попробуйте позже.';
        include $_SERVER['DOCUMENT_ROOT'] . '/error.html.php';
        exit;
    }
}
if (!userIsLoggedIn($loginError)) {
    include $_SERVER['DOCUMENT_ROOT'] . '/reg_log/login.html.php';
    exit;
}
header('Location: /chat/index.php');