Esempio n. 1
0
<?php

use Moood\DBLayer;
use Moood\Bootstrap;
use Moood\helpers\Utils;
use Moood\User\UserActions;
$ROOT_PATH = $_SERVER['DOCUMENT_ROOT'];
include_once $ROOT_PATH . '/src/bootstrap.php';
// Init the DBlayer to verify that we have a valid DB
$dbLayer = DBLayer::getInstance();
// The instance of the class that responsible of processing this page actions
$actions = new UserActions();
// First of all logout the current user since we are in the login page
$actions->logout();
// Now process the given action
$actions->processRequest();
// Check if we have errors or not
$error = Utils::getParam('error', null);
$errorClass = isset($error) ? '' : 'hidden';
?>
<!DOCTYPE html >
<html>
<head>
    <meta charset='UTF-8'>
    <title>Music for your mood</title>

    <link href="/style/style.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div class="pageContent login">
Esempio n. 2
0
     */

    $ROOT_PATH = $_SERVER['DOCUMENT_ROOT'];
    include_once $ROOT_PATH . '/src/bootstrap.php';

    use Moood\User\UserActions;
    use Moood\helpers\Utils;

    // Execute the current action (if any)
    // In real application i will not do it this way,
    // i would have use Zend framework with views actions and forms.

    // We need to execute action only after the user has filled in the details.
    // we can know it by checking if there is a userId in the form
    if (Utils::getParam("id", null) != null) {
        $action = new UserActions();
        $action->processRequest();
    }

    // We use this page for registration and for updating the user details.
    // First of all check to see if this is a register or details page
    $isUpdate = isset($_GET['action']) && $_GET['action'] === 'update';

    // We use the same form for registration and for updating user information.
    // Find out if this is a registration or update action
    if ($isUpdate) {
        $userData = $_SESSION['user']->getUserData();
        $id = $userData['id'];
        $username = $userData['username'];
        $password = $userData['password'];
Esempio n. 3
0
<?php

use Moood\User\UserActions;
// This file will simply execute the desired action.
// It will contain no code. All the logic is inside the Actions class.
// The file is invoked using Ajax
include_once $_SERVER['DOCUMENT_ROOT'] . '/src/bootstrap.php';
// Simply execute the action and return JSON as reply
$users = new UserActions();
$users->processRequest();