/**
  * @param String strName
  * @return String
  */
 public function addTableWrappers($strName)
 {
     if ($this->strLeftWrapper != "\"") {
         return $this->addFieldWrappers($strName);
     }
     return DBFunctions::addTableWrappers($strName);
 }
Esempio n. 2
0
<?php

include 'DBFunctions.php';
if (isset($_POST['tag']) && $_POST['tag'] != '') {
    // get tag
    $tag = $_POST['tag'];
    $dbFunctions = new DBFunctions();
    // response Array
    $response = array("tag" => $tag, "error" => FALSE);
    //Login the user
    if ($tag == 'login') {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $result = $dbFunctions->login($username, $password);
        if ($result) {
            $response["error"] = FALSE;
            $response["user"]["username"] = $username;
            $response["user"]["password"] = $password;
            echo json_encode($response);
        } else {
            $response["error"] = TRUE;
            $response["error_msg"] = "Incorrect username or password";
            echo json_encode($response);
        }
    } else {
        if ($tag == 'register') {
            $username = $_POST['username'];
            $password = $_POST['password'];
            if ($dbFunctions->isUserExist($username)) {
                $response["error"] = TRUE;
                $response["error_msg"] = "User already exist";
Esempio n. 3
0
<?php

//Author: Declan Barnes
if (isset($_POST['tag']) && $_POST['tag'] != '') {
    $tag = $_POST['tag'];
    require_once 'include/DBFunctions.php';
    $db = new DBFunctions();
    $response = array("tag" => $tag, "error" => FALSE);
    if ($tag == 'login') {
        $Student_ID = $_POST['Student_ID'];
        $password = $_POST['password'];
        $user = $db->getUserByEmailAndPassword($Student_ID, $password);
        if ($user != FALSE) {
            $response["error"] = FALSE;
            $response["uid"] = $user["unique_id"];
            $response["user"]["name"] = $user["name"];
            $response["user"]["created_at"] = $user["created_at"];
            $response["user"]["updated_at"] = $user["updated_at"];
            $response["user"]["Student_ID"] = $user["Student_ID"];
            echo json_encode($response);
        } else {
            $response["error"] = TRUE;
            $response["error_msg"] = "Incorrect Student ID or password";
            echo json_encode($response);
        }
    } else {
        if ($tag == 'register') {
            $name = $_POST['name'];
            $Student_ID = $_POST['Student_ID'];
            $password = $_POST['password'];
            if ($db->isUserExisted($Student_ID)) {
Esempio n. 4
0
<?php

require "classes/DBFunctions.class.php";
header('Content-type: text/html; charset=utf-8');
$database = new DBFunctions();
$year = $_GET['year'];
//if no year set, set to 1999
if (!isset($year)) {
    $year = 1999;
}
//Keeps Track Of How Many Results Were DQ'd
function dqCount($echo = null)
{
    static $count = 0;
    if (!isset($echo)) {
        ++$count;
    }
    return $count;
}
//Keeps Track Of How Many Cyclists Were Banned
function banCount($echo = null)
{
    static $count = 0;
    if (!isset($echo)) {
        ++$count;
    }
    return $count;
}
$banned_cyclist_count = $database->getNumCyclistsBanned($year);
$dq_count = $database->getNumDq($year);
?>
Esempio n. 5
0
<?php

require_once './php/config.php';
require_once './php/admin_config.php';
require_once './php/db_connect.php';
require_once './php/commons.php';
require_once './php/db_functions.php';
require_once './php/modes.php';
require_once './php/admin_modes.php';
require_once './php/admin_db_functions.php';
$modes = new Modes();
$db = new DBFunctions();
$admin_modes = new AdminModes();
$admin_db = new AdminDBFunctions();
$commons = new Commons();
// set to UTC
$db->setMYSQLTimeZone('+08:00');
date_default_timezone_set('Australia/Perth') or die('timezone error');
// no echo / print_r / var_dump
$response = array();
$response[KEY_STATUS] = R_STATUS_FAILED;
if (SETTING_ERROR) {
    $response[KEY_ERROR_CODE] = E_UNKNOWN;
    $response[KEY_ERROR_MESSAGE] = EM_UNKNOWN;
}
foreach ($_REQUEST as $key => $value) {
    $_REQUEST[$key] = $commons->clean($value);
}
if (!isset($_REQUEST[KEY_MODE])) {
    $response[KEY_STATUS] = R_STATUS_FAILED;
    if (SETTING_ERROR) {
Esempio n. 6
0
         $db->truncate('exchange_info');
         $db->create('exchange_info', array('catalog_id' => trim($xml->Каталог->Ид)));
     }
     if ($xml->Каталог->Товары) {
         $products = saveProducts($products, $xml, $db);
     }
     $log_mess = "****************** " . date('d-m-Y-H-i-s', time()) . " *********************\n\r";
     $log_mess .= "Импорт товаров прошел нормально\n\r";
     fwrite($handle, $log_mess);
     //$db->disconnect();
 } elseif ($file == 'offers.xml' && file_exists(IMPORT_FILES . $file)) {
     $xml = simplexml_load_file(IMPORT_FILES . $file);
     $log_mess = "****************** " . date('d-m-Y-H-i-s', time()) . " *********************\n\r";
     $log_mess .= "Импорт предложений\n\r";
     fwrite($handle, $log_mess);
     $db = new DBFunctions(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD);
     $products = $db->findAll('shop');
     $price_types = $db->findAll('shop_price_type');
     if ($products && count($products) > 0) {
         $products['products'] = $products;
         if ($xml->ПакетПредложений->ТипыЦен && $xml->ПакетПредложений->ТипыЦен->ТипЦены) {
             $price_types = saveShopPriceType($price_types, $xml, $db);
             $products['price_types'] = $price_types;
         }
     }
     if ($xml->ПакетПредложений->Предложения && $xml->ПакетПредложений->Предложения->Предложение) {
         $products = saveOffers($products, $xml, $db);
     }
     $log_mess = "****************** " . date('d-m-Y-H-i-s', time()) . " *********************\n\r";
     $log_mess .= "Импорт предложений прошел нормально\n\r";
     fwrite($handle, $log_mess);
<?php

include 'DBFunctions.php';
if (isset($_POST['tag']) && $_POST['tag'] != '') {
    // get tag
    $tag = $_POST['tag'];
    $dbFunctions = new DBFunctions();
    // response Array
    $response = array("tag" => $tag, "error" => FALSE);
    //Login the user
    if ($tag == 'login') {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $result = $dbFunctions->login($username, $password);
        if ($result) {
            $response["error"] = FALSE;
            $response["user"]["username"] = $username;
            $response["user"]["password"] = $password;
            echo json_encode($response);
        } else {
            $response["error"] = TRUE;
            $response["error_msg"] = "Incorrect username or password";
            echo json_encode($response);
        }
    } else {
        if ($tag == 'register') {
            $username = $_POST['username'];
            $password = $_POST['password'];
            if ($dbFunctions->isUserExist($username)) {
                $response["error"] = TRUE;
                $response['error_msg'] = "User already exist";
Esempio n. 8
0
 function MySQLFunctions($leftWrapper, $rightWrapper, $extraParams)
 {
     parent::DBFunctions($leftWrapper, $rightWrapper, $extraParams);
     $this->conn = $extraParams["conn"];
 }
<?php

if (isset($_POST['tag']) != '') {
    $tag = $_POST['tag'];
    require_once 'include/DBFunctions.php';
    $db = new DBFunctions();
    $response = array("tag" => $tag, "error" => FALSE);
    if ($tag == 'attendance') {
        $Student_ID = $_POST['Student_ID'];
        $Room = $_POST['Room'];
        $weekDay = $_POST['weekDay'];
        $user = $db->storeAttendance($Student_ID, $Room, $weekDay);
        if ($user) {
            $response["error"] = FALSE;
            $response["user"]["Student_ID"] = $user["Student_ID"];
            $response["user"]["Room"] = $user["Room"];
            $response["user"]["Scan_Time"] = $user["Scan_Time"];
            $response["user"]["weekDay"] = $user["weekDay"];
            echo json_encode($response);
        } else {
            $response["error"] = TRUE;
            $response["error_msg"] = "Error occurred in attendance";
            echo json_encode($response);
        }
    }
} else {
    $response["error"] = TRUE;
    $response["error_msg"] = "Unknown 'tag' value. It should be attendance";
    echo json_encode($response);
}
Esempio n. 10
0
<?php

include 'DBfunctions.php';
$dbFunctions = new DBFunctions();
$response = array();
if (isset($_POST['action']) && $_POST['action'] != '') {
    $action = $_POST['action'];
    if ($action == 'join') {
        $username_ = $_POST['username'];
        $result = $dbFunctions->isUserExists($username_);
        //Check if user exist
        if ($result == true) {
            //If user exist, Check if user expired
            $result = $dbFunctions->isUserExpired($username_);
            if ($result == true) {
                //If user expired, delete user entry
                $result = $dbFunctions->deleteUser($username_);
                if ($result == true) {
                    //If delete is successful, add username as a new entry
                    $result = $dbFunctions->addUser($username_);
                    if ($result == true) {
                        $response["success"] = true;
                        $response["uid"] = $result["uid"];
                        $response["username"] = $result["username"];
                        echo json_encode($response);
                    } else {
                        $response["success"] = false;
                        $response["errorMsg"] = "Failed to create username. Please try again.";
                        echo json_encode($response);
                    }
                } else {
Esempio n. 11
0
 function PostgreFunctions($leftWrapper, $rightWrapper, $extraParams)
 {
     parent::DBFunctions($leftWrapper, $rightWrapper, $extraParams);
     $this->postgreDbVersion = $extraParams["postgreDbVersion"];
 }
Esempio n. 12
0
                                $data["success"] = 0;
                                $data["error"] = 1;
                                $data["message"] = "Not enough parameters provided!";
                                echo json_encode($data);
                            }
                        }
                    }
                }
            }
        }
    }
} else {
    if (isset($_GET['mode']) && $_GET['mode'] != '') {
        $mode = $_GET['mode'];
        require_once 'esakioskinclude/DBFunctions.php';
        $database = new DBFunctions();
        //The array where we'll return JSON data
        $data = array("mode" => $mode, "success" => 0, "error" => 0);
        if ($mode == 'userInfo') {
            //Extract all the other parameters
            $name = $_GET['name'];
            $user = $database->getUserDetails($name);
            //Success
            if ($user != false) {
                $data["success"] = 1;
                $data["error"] = 0;
                $data["uid"] = $user;
                echo json_encode($data);
            } else {
                $data["success"] = 0;
                $data["error"] = 1;
Esempio n. 13
0
<?php

require './php/config.php';
require './php/db_connect.php';
require './php/commons.php';
require './php/db_functions.php';
require './php/modes.php';
require_once '../swiftmailer-master/lib/swift_required.php';
require_once '../PHPMailer/class.phpmailer.php';
require_once '../PHPExcel/PHPExcel.php';
$modes = new Modes();
$db = new DBFunctions();
$commons = new Commons();
// set to UTC
$db->setMYSQLTimeZone('+05:30') or die('timezone set error');
date_default_timezone_set('Asia/Calcutta') or die('timezone error');
// no echo / print_r / var_dump
$response = array();
$response[KEY_STATUS] = R_STATUS_FAILED;
if (SETTING_ERROR) {
    $response[KEY_ERROR_CODE] = E_UNKNOWN;
    $response[KEY_ERROR_MESSAGE] = EM_UNKNOWN;
}
if (!isset($_REQUEST[KEY_MODE])) {
    $response[KEY_STATUS] = R_STATUS_FAILED;
    if (SETTING_ERROR) {
        $response[KEY_ERROR_CODE] = E_INSUFFICIENT_PARAMS;
        $response[KEY_ERROR_MESSAGE] = EM_INSUFFICIENT_PARAMS;
    }
    echo json_encode($response);
    exit;