Ejemplo n.º 1
0
<?php

require_once 'register/User.php';
require_once 'register/Connection.php';
require_once 'register/UserTableGateway.php';
$connection = Connection::getInstance();
$gateway = new UserTableGateway($connection);
$id = session_id();
if ($id == "") {
    session_start();
}
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
$confirmPassword = filter_input(INPUT_POST, 'confirmPassword', FILTER_SANITIZE_STRING);
$errorMessage = array();
if ($username == FALSE || $username === '') {
    $errorMessage['username'] = '******';
} else {
    // execute a query to see if username is in the database
    $statement = $gateway->getUserByUsername($username);
    // if the username is in the database then add an error message
    // to the errorMessage array
    if ($statement->rowCount() !== 0) {
        $errorMessage['username'] = '******';
    }
}
if ($password === FALSE || $password === '') {
    $errorMessage['password'] = '******';
}
if ($confirmPassword === FALSE || $confirmPassword === '') {
    $errorMessage['confirmPassword'] = '******';
Ejemplo n.º 2
0
<script type="text/javascript" src="Javascript/business.js"></script>
<?php 
require_once 'Connection.php';
require_once 'DealTableGateway.php';
require_once 'BusinessTableGateway.php';
require_once 'UserTableGateway.php';
$id = session_id();
if ($id == "") {
    session_start();
}
require 'ensureUserLoggedIn.php';
$username = $_SESSION['user_id'];
require 'ensureUserLoggedIn.php';
$conn = Connection::getInstance();
$dealGateway = new DealTableGateway($conn);
$userGateway = new UserTableGateway($conn);
$businessGateway = new BusinessTableGateway($conn);
$deals = $dealGateway->getDeals();
$users = $userGateway->getUserByUserName($username);
$businesses = $businessGateway->getBusinesses();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA3kPZdtcJcP3EuDFpPNU3iIfAh0q-X6Gc&libraries=places"></script>
        <title>Yoink!</title>
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
Ejemplo n.º 3
0
require_once 'User.php';
require_once 'Connection.php';
require_once 'UserTableGateway.php';
require_once 'BusinessTableGateway.php';
require_once 'DealTableGateway.php';
$connection = Connection::getInstance();
if (isset($_GET) && isset($_GET['sortOrder'])) {
    $sortOrder = $_GET['sortOrder'];
    $columnNames = array("businessID", "business_name", "business_address", "business_lat", "business_long", "business_type");
    if (!in_array($sortOrder, $columnNames)) {
        $sortOrder = 'businessID';
    }
} else {
    $sortOrder = 'businessID';
}
$gateway = new UserTableGateway($connection);
$businessGateway = new BusinessTableGateway($connection);
$dealGateway = new DealTableGateway($connection);
/* Starts new session if session doesn't already exist */
$id = session_id();
if ($id == "") {
    session_start();
}
/* Validates data entered and filters it to be applicable to the field */
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
/* Error message array for data entered */
/* If data is blank error message is shown */
$errorMessage = array();
if ($username === FALSE || $username === '') {
    $errorMessage['username'] = '******';