Example #1
0
 public static function redirect($path = "")
 {
     if ($path == "") {
         Route::getBackend();
     } else {
         header("location:" . $path);
     }
 }
Example #2
0
session_start();
require_once "../config/Route.php";
require_once "../model/UsersController.php";
require_once "../model/FeedbackController.php";
if (array_key_exists('userId', $_SESSION)) {
    $feedbackController = new FeedbackController();
    $userController = new UsersController();
    $userId = $_SESSION['userId'];
    $user = $userController->find($userId);
    if ($user) {
        if (array_key_exists('post', $_GET)) {
            $id = test_input($_GET['post']);
            $poi = $feedbackController->find($id);
            if ($poi) {
                $feedbackController->delete($id);
                Route::getBackend("feedbacks/");
            } else {
                Route::get404Error();
            }
        } else {
            Route::get404Error();
        }
    } else {
        Route::get404Error();
    }
} else {
    Route::get404Error();
}
function test_input($data)
{
    $data = trim($data);
Example #3
0
<?php

/**
 * Created by Yogesh on 11/23/2015.
 * 
 */
session_start();
require_once "../config/Route.php";
require_once "../model/UsersController.php";
$userController = new UsersController();
if (array_key_exists('userId', $_SESSION)) {
    $userController->logoutUser($_SESSION['userId']);
    unset($_SESSION['userId']);
}
if (array_key_exists('userId', $_COOKIE)) {
    if (isset($_COOKIE[session_name()])) {
        setcookie(session_name(), '', time() - 7000000, '/');
    }
    $userController->logoutUser($_COOKIE['userId']);
    setcookie("userId", "0", 10, "/");
}
session_destroy();
Route::getBackend();
exit;
Example #4
0
<?php

/**
 * Created by Yogesh on 11/19/2015.
 * 
 */
/*
 * Check for sessions and take necessary actions
 * If a user session is available work with that session
 * Else redirect user to the login page
 */
require_once "config/Route.php";
session_start();
if (!isset($_COOKIE['user']) && !isset($_SESSION['user'])) {
    Route::getBackend();
} else {
    Route::getBackend("dashboard.php");
}
Example #5
0
    $metaController = new MetaController();
    $userController = new UsersController();
    $userId = $_SESSION['userId'];
    $user = $userController->find($userId);
    if ($user) {
        if (array_key_exists('meta', $_GET) && array_key_exists('id', $_GET)) {
            $meta = $_GET['meta'];
            $id = $_GET['id'];
            $row = $metaController->findMeta($meta, $id);
            if ($row) {
                $filepath = "../assets/files/search/" . $row['filename'];
                if (file_exists($filepath)) {
                    unlink($filepath);
                    $metaController->deleteMeta($meta, $id);
                    Route::getBackend("service/");
                } else {
                    $metaController->deleteMeta($meta, $id);
                    Route::getBackend("service/");
                }
            } else {
                Route::get404Error();
            }
        } else {
            Route::get404Error();
        }
    } else {
        Route::get404Error();
    }
} else {
    Route::get404Error();
}
Example #6
0
session_start();
require_once "../config/Route.php";
require_once "../model/UsersController.php";
require_once "../model/ContributionController.php";
if (array_key_exists('userId', $_SESSION)) {
    $contributionController = new ContributionController();
    $userController = new UsersController();
    $userId = $_SESSION['userId'];
    $user = $userController->find($userId);
    if ($user) {
        if (array_key_exists('post', $_GET)) {
            $id = test_input($_GET['post']);
            $poi = $contributionController->find($id);
            if ($poi) {
                $contributionController->delete($id);
                Route::getBackend("contributions/");
            } else {
                Route::get404Error();
            }
        } else {
            Route::get404Error();
        }
    } else {
        Route::get404Error();
    }
} else {
    Route::get404Error();
}
function test_input($data)
{
    $data = trim($data);