Esempio n. 1
0
 private function writeLogToSQL($file, $logname, $description)
 {
     $table = 'Logs';
     $queryType = 'Insert';
     $condition = null;
     $types = array('text', 'text', 'text', 'timestamp');
     $columns = array('Filename', 'LogName', 'Description', 'Datetime');
     $now = getdate(date("U"));
     $datetime = new DateTime();
     $datetime->setDate($now['year'], $now['mon'], $now['mday']);
     $datetime->setTime($now['hours'] + 3, $now['minutes'], $now['seconds']);
     $values = array($file, $logname, $description, $datetime->format('Y/m/d H:i:s'));
     $args = array('column' => $columns, 'value' => $values, 'type' => $types);
     $xml = $this->createXML($table, $args);
     $sql = new SQLMediator();
     $sql->connect();
     $res = $sql->query($xml, $queryType, $condition);
     $sql->disconnect();
 }
Esempio n. 2
0
<?php

require_once dirname(__FILE__) . '/../base/ExceptionHandling/GlobalExceptionHandler.php';
require_once dirname(__FILE__) . '/../base/ExceptionHandling/ErrorToException.php';
require_once dirname(__FILE__) . '/../base/XML/XMLFactory.php';
require_once dirname(__FILE__) . '/../base/MySQL/SQLMediator.php';
function error_to_exception($code, $message, $file, $line, $context)
{
    if ($code != E_STRICT && $code != E_DEPRECATED) {
        throw new ErrorToException($code, $message, $file, $line, $context);
    }
}
set_error_handler("error_to_exception");
try {
    $sql = new SQLMediator();
    $status = $sql->connect();
    if ($status != null) {
        echo '<error>' . $status . '</error>';
    } else {
        $data = getData($sql);
        echo $data;
        $sql->disconnect();
    }
} catch (Exception $ex) {
    echo GlobalExceptionHandler::writeException($ex);
}
function getData($sqlconn)
{
    $res = $sqlconn->complexQuery("Select", "SELECT * FROM Logs WHERE LogName = 'Exception' ORDER BY Datetime desc", 'Logs');
    return $res;
}
Esempio n. 3
0
require_once dirname(__FILE__) . '/../ExceptionHandling/GlobalExceptionHandler.php';
require_once dirname(__FILE__) . '/../ExceptionHandling/ErrorToException.php';
require_once dirname(__FILE__) . '/../XML/XMLFactory.php';
require_once dirname(__FILE__) . '/../MySQL/SQLMediator.php';
function error_to_exception($code, $message, $file, $line, $context)
{
    if ($code != E_STRICT && $code != E_DEPRECATED) {
        throw new ErrorToException($code, $message, $file, $line, $context);
    }
}
set_error_handler("error_to_exception");
try {
    $mixTitle = $_POST['mixTitle'];
    $sql = new SQLMediator();
    $sql->connect();
    addToMixesLoadedTable($mixTitle, $sql);
    $xmlSongs = getSongs($mixTitle, $sql);
    echo $xmlSongs;
    $sql->disconnect();
} catch (Exception $ex) {
    echo GlobalExceptionHandler::writeException($ex);
}
function addToMixesLoadedTable($loadedMixesTitle, $sqlconn)
{
    $ip = $_SERVER['REMOTE_ADDR'];
    $loadedMixesTitle = str_replace("'", "\\'", $loadedMixesTitle);
    $res = $sqlconn->complexQuery("Select", "SELECT * FROM Mixes WHERE MixName = '{$loadedMixesTitle}'", 'Mixes');
    $mixid = getMixId($res);
    $now = getdate(date("U"));
    $datetime = new DateTime();
Esempio n. 4
0
require_once 'base/ExceptionHandling/GlobalExceptionHandler.php';
require_once 'base/ExceptionHandling/ErrorToException.php';
require_once 'base/XML/XMLFactory.php';
require_once 'base/MySQL/SQLMediator.php';
function error_to_exception($code, $message, $file, $line, $context)
{
    if ($code != E_STRICT && $code != E_DEPRECATED) {
        throw new ErrorToException($code, $message, $file, $line, $context);
    }
}
set_error_handler("error_to_exception");
try {
    echo "<html>\n\t\t\t<head>\n\t\t\t\t<title>Video Factory</title>\n\t\t\t\t<link rel='shortcut icon' href='favicon.png' type='img/x-icon'/>\n\t\t\t\t<link rel='stylesheet' type='text/css' href='masterPage/main.css'/>\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<div id='activatePage' class='container'>\n\t\t\t\t\t<div class='col-xs-12 activateContainer'>\n\t\t\t\t\t<p id='activateTitle' class='col-xs-'12>Video Factory</p>\n\t\t\t\t";
    $key = $_GET['key'];
    $sqlconn = new SQLMediator();
    $sqlconn->connect();
    $values = getValuesFromTempTable($key, $sqlconn);
    if (count($values) == 0) {
        echo 'Key not found<br/>';
        echo "<a class='activateLink' href='/'>Return to site</a>";
    } else {
        $userExists = checkIfUserExists($values['Email'], $sqlconn);
        if ($userExists) {
            echo 'User already has an active account<br/>';
            echo "<a class='activateLink' href='/'>Return to site</a>";
        } else {
            addToUserInfoTable($values, $sqlconn);
            deleteValuesFromTempTable($values['Email'], $sqlconn);
            echo 'Account is now active!<br/>';
            echo "<a class='activateLink' href='/'>Return to site</a>";
        }