public function verifyLogin()
 {
     if (isset($_COOKIE["phpContact"]) && isset($_COOKIE["phpContactId"])) {
         $id = $_COOKIE["phpContact"];
         $cUser = new UserPDO();
         $user = $cUser->getUserByid($id);
         if ($_COOKIE["phpContact"] === $user->pass_hash) {
             $this->login = 1;
         } else {
             $this->login = 0;
         }
     } else {
         $this->login = 0;
     }
 }
Example #2
0
<?php

require_once "UserPDO.php";
require_once "User.php";
if (isset($_POST['submit'])) {
    $username = $_POST["username"];
    // echo $username . "<br>\n";
    $password = $_POST["password"];
    //echo $password ."<br>\n";
    if ($username != '' && $password != '') {
        $userPDO = new UserPDO();
        $user = new User();
        $user->setUserName($username);
        $user->setPassword($password);
        $loggedIn = $userPDO->checkUserExists($user);
        echo "<html>";
        echo "<head>";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
        echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
        echo "<title>News Portal -User Login</title>";
        echo "</head>";
        echo "<body>";
        if ($loggedIn) {
            include "menu.php";
            echo "User LoggedIn </br>";
            echo "Welcome to Nuntium Home";
        } else {
            echo "User Not LoggedIn </br>";
            echo "<a href='index.php'> Go to Home</a>";
        }
        echo "</body>";
Example #3
0
<?php

require_once "UserPDO.php";
require_once "User.php";
if (isset($_POST['submit'])) {
    $username = $_POST["username"];
    // echo $username . "<br>\n";
    $password = $_POST["password"];
    //echo $password ."<br>\n";
    if ($username != '' && $password != '') {
        $userPDO = new UserPDO();
        $user = new User();
        $user->setUserName($username);
        $user->setPassword($password);
        $userPDO->insertUser($user);
        echo "<html>";
        echo "<head>";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
        echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
        echo "<title>News Portal - Insert User</title>";
        echo "</head>";
        echo "<body>";
        include "menu.php";
        echo "Created a User </br>";
        echo "<a href='index.php'> Back to Home</a>";
        echo "</body>";
        echo "</html";
    } else {
        echo "Please fill all of the fields" . "<br>\n";
        echo "<a href='CreateUser.php'> Back to Create User</a>";
    }
Example #4
0
<html>
	<head>
		<meta content="noindex, nofollow" name="robots">
		
 <link rel="stylesheet" type="text/css" href="menu.css">

<title>News Portal - Update User</title>
	</head>
<body>
	
<?php 
include "menu.php";
require_once "UserPDO.php";
require_once "User.php";
$userid = $_GET["id"];
$userPDO = new UserPDO();
$user = $userPDO->getUser($userid);
?>
	
<form action="EditUser.php" method="post">
<input type="hidden" name="userid" value="<?php 
echo $userid;
?>
">
Input Username
<br>
<input type="text" name="username" value="<?php 
echo $user->getUserName();
?>
">
<br>
Example #5
0
require dirname(__DIR__) . '/vendor/autoload.php';
use Carbon\Carbon;
$ip = "Current IP Address: " . $_SERVER['REMOTE_ADDR'];
?>

<div class="footer row">
    <section class="col-sm-8">
        <?php 
echo $ip;
?>
    </section>
    <section class="col-sm-4 ">
    <?php 
if (isset($login->login) && $login->login == 1) {
    $timeZone = new UserPDO();
    echo carbon::now($timeZone->getTimeZoneByUserId($_COOKIE["phpContactId"]))->format('l jS \\of F Y');
}
?>
    </section>
</div>


<!--

Eastern ........... America/New_York
Central ........... America/Chicago
Mountain .......... America/Denver
Mountain no DST ... America/Phoenix
Pacific ........... America/Los_Angeles
Alaska ............ America/Anchorage
Example #6
0
<?php

require_once "UserPDO.php";
require_once "User.php";
$userPDO = new UserPDO();
$users = $userPDO->getUsers();
echo "<html>";
echo "<head>";
echo "<meta http-equiv='Content-Type'' content='text/html; charset=UTF-8' >";
echo "<link rel='stylesheet'' type='text/css' href='menu.css'>";
echo "<title>News Portal User List</title>";
echo "</head>";
echo "<body>";
include "menu.php";
echo "<table>";
echo "<tr>";
echo "<th>Userid</th>";
echo "<th>UserName</th>";
echo "<th>Password</th>";
echo "</tr>";
foreach ($users as $user) {
    echo "<tr>";
    echo "<td>";
    echo $user->getUserId();
    echo "</td>";
    echo "<td>";
    echo $user->getUserName();
    echo "</td>";
    echo "<td>";
    echo $user->getPassword();
    echo "</td>";
Example #7
0
<?php

require_once "UserPDO.php";
require_once "User.php";
if (isset($_POST['submit'])) {
    $userid = $_POST["userid"];
    // echo $userid . "<br>\n";
    $username = $_POST["username"];
    //echo $username . "<br>\n";
    $password = $_POST["password"];
    //echo $password ."<br>\n";
    if ($username != '' && $password != '') {
        $userPDO = new UserPDO();
        $user = new User();
        $user->setUserId($userid);
        $user->setUserName($username);
        $user->setPassword($password);
        $userPDO->updateUser($user);
        echo "<html>";
        echo "<head>";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
        echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
        echo "<title>News Portal - Edit User</title>";
        echo "</head>";
        echo "<body>";
        include "menu.php";
        echo "User updated <br>";
        echo "<a href='Home.php'> Back to Home</a>";
        echo "</body>";
        echo "</html";
    } else {
Example #8
0
<?php

require_once "UserPDO.php";
require_once "User.php";
$userid = $_GET["id"];
$userPDO = new UserPDO();
$user = $userPDO->getUser($userid);
// echo "UserId " .$user->getUserId();
$userPDO->deleteUser($user);
echo "<html>";
echo "<head>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
echo "<title>News Portal - Delete User</title>";
echo "</head>";
echo "<body>";
include "menu.php";
echo "Deleted User </br>";
echo "<a href='Home.php'> Back to Home</a>";
echo "</body>";
echo "</html";
Example #9
0
<?php

require_once "UserPDO.php";
$userPDO = new UserPDO();
$maxuserid = $userPDO->getMaxUserId();
echo "Max User Id " . $maxuserid;
Example #10
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
$user_pdo = new UserPDO();
$users = $user_pdo->getAllUsers();
foreach ($users as $user) {
    echo $user->getFirstname() . "-" . $user->getLastname() . "<br/>";
}