<?php //header('Content-Type: text/plain; charset=UTF-8'); $head_time_start = microtime(true); require_once "lib/lib.php"; require_once "lib/sorts.php"; connect(); vkAuth(); if (array_key_exists("logout", $_GET)) { if (isset($_SESSION['user'])) { unset($_SESSION['user']); } if (isset($_SESSION['showSettings'])) { unset($_SESSION['showSettings']); } header("Location: " . \pass\VK::$redirect_uri); } Login(); $user = $_SESSION["user"]; $userId = $user['id']; $login = $user['login'] ? $user['login'] : $user['vkid']; if (array_key_exists('method', $_POST)) { switch ($_POST['method']) { case "setSettings": setSettings($user, array("minRating" => (double) $_POST['minRating'], "minVotes" => (int) $_POST['minVotes'], "maxDaysDif" => (int) $_POST['maxDaysDif'], "onlyNewTor" => (int) (!empty($_POST['onlyNewTor'])), "quality" => (int) (!empty($_POST['quality'])), "translateQuality" => (int) $_POST['translateQuality'], "sortType" => (int) $_POST['sortType'])); //Login(); break; default: break; } }
<?php require_once 'functions.php'; session_start(); if (isset($_GET['code'])) { $data = vkAuth($_GET['code']); if (register($data)) { echo "user registered and user logged in via Vk"; $_SESSION['auth'] = true; $_SESSION['email'] = $data['email']; } else { echo "user logged in via Vk"; $_SESSION['auth'] = true; $_SESSION['email'] = $data['email']; } } if (isset($_POST['data']) && ctype_alpha($_POST['data']['name']) && isset($_SESSION['auth'])) { addComment($_POST['data']); } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Guestbook</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">