예제 #1
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array("orderID" => $orderID);
    $selectOrder = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
    $orderRecord = mysql_fetch_array($selectOrder);
    $wordNum = (int) $orderRecord['wordNum'];
    $selectDetail = $db_utils->selectTableAnd($user_link, TableName::getOrderDetailTable, $select_array);
    if (!$selectDetail) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    $code = 0;
    while ($record = mysql_fetch_array($selectDetail)) {
        $code++;
예제 #2
0
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
$isTest = $obj["isTest"];
/*1.測試模式0.英文模式*/
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array("orderID" => $orderID);
    $selectOrder = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
    $orderRecord = mysql_fetch_array($selectOrder);
    $status = (int) $orderRecord['status'];
    if ($isTest != 1) {
        if ($status == 2) {
            $db_utils->responseError($start_time, "尚未上傳成績!請點擊上傳按鈕!", 209, $user_link);
        }
        if ($status == 4) {
            $db_utils->responseError($start_time, "已經結算過了!", 163, $user_link);
        }
예제 #3
0
 private function detectDatabases($db_params, $should_drop = false)
 {
     $verify = null;
     foreach ($this->install_config['databases'] as $db) {
         $result = DatabaseUtils::dbExists($db_params, $db);
         if ($result === -1) {
             $verify .= "   Cannot verify if '{$db}' database exists" . PHP_EOL;
         } else {
             if ($result === true) {
                 if (!$should_drop) {
                     $verify .= "   '{$db}' database already exists " . PHP_EOL;
                 } else {
                     logMessage(L_USER, "Dropping '{$db}' database");
                     DatabaseUtils::dropDb($db_params, $db);
                 }
             }
         }
     }
     return $verify;
 }
예제 #4
0
include "../../../database/DatabaseUtils.php";
include "../../../utils/TimeUtils.php";
include "../../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$enWord = $obj["enWord"];
$enWordID = $obj["enWordID"];
$definitionList = $obj["definitionList"];
$exampleList = $obj["exampleList"];
$translateList = $obj["translateList"];
$db_utils = new DatabaseUtils();
$start_time = TimeUtils::getNowTime();
$update_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $enWordObj = array("enWord" => $enWord);
    if (!$db_utils->updateData($user_link, TableName::getENWordTable, $enWordObj, "enWordID", $enWordID)) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    for ($i = 0; $i < count($definitionList); $i++) {
        $definitionItem = $definitionList[$i];
        $enDefinition = $definitionItem["enDefinition"];
        $enDefinitionID = $definitionItem["enDefinitionID"];
        $enDefObj = array("enDefinition" => $enDefinition);
        if (!$db_utils->updateData($user_link, TableName::getWordDefinitionTable, $enDefObj, "enDefinitionID", $enDefinitionID)) {
            $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
예제 #5
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$detailID = $obj["detailID"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $db_utils->deleteTableData($user_link, TableName::getOrderDetailTable, "detailID", $detailID);
    $res["message"] = "刪除成功!";
    $db_utils->response($start_time, $res, $user_link);
} else {
    $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
}
예제 #6
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../../database/DatabaseUtils.php";
include "../../../utils/TimeUtils.php";
include "../../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$db_utils = new DatabaseUtils();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array();
    $select_obj = $db_utils->selectTableAnd($user_link, TableName::getENTypeTable, $select_array);
    if (!$select_obj) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    $list = array();
    while ($record = mysql_fetch_array($select_obj)) {
        $get["enTypeID"] = $record['enTypeID'];
        $get["enTypeName"] = $record['enTypeName'];
        $get["create_time"] = $record['create_time'];
        $get["update_time"] = $record['update_time'];
        array_push($list, $get);
예제 #7
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$status = $obj["status"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array("status" => $status);
    $selectOrder = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
    $list = array();
    while ($orderRecord = mysql_fetch_array($selectOrder)) {
        $res["orderID"] = $orderRecord['orderID'];
        $res["deviceAddress"] = $orderRecord['deviceAddress'];
        $res["userName"] = $orderRecord['userName'];
        $res["userYearOld"] = (int) $orderRecord['userYearOld'];
        $res["testTime"] = (int) $orderRecord['testTime'];
        $res["status"] = (int) $orderRecord['status'];
        $res["testResult"] = (int) $orderRecord['testResult'];
예제 #8
0
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
if (!$orderID) {
    $db_utils->responseError($start_time, "get not found", 302, $user_link);
}
$showTranslate = $obj["showTranslate"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $res = array();
    $select_array = array("orderID" => $orderID);
    $selectOrder = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
    $orderRecord = mysql_fetch_array($selectOrder);
    $res["orderID"] = $orderRecord['orderID'];
    $res["deviceAddress"] = $orderRecord['deviceAddress'];
    $res["userName"] = $orderRecord['userName'];
    $res["userYearOld"] = (int) $orderRecord['userYearOld'];
    $res["testTime"] = (int) $orderRecord['testTime'];
    $res["status"] = (int) $orderRecord['status'];
    $res["testResult"] = (int) $orderRecord['testResult'];
예제 #9
0
        if (preg_match($prerequisites_config["request_order_regex"], $variables_order) === 0) {
            $prerequisites .= "Please set 'variables_order' ini value to include C,G and P in php.ini " . PHP_EOL;
        }
    }
}
// check php extensions
foreach ($prerequisites_config["php_extensions"] as $ext) {
    if (!extension_loaded($ext)) {
        $prerequisites .= "Missing {$ext} PHP extension" . PHP_EOL;
    }
}
// check mysql
if (!extension_loaded('mysqli')) {
    $prerequisites .= "Cannot check MySQL connection, version and settings because PHP mysqli extension is not loaded" . PHP_EOL;
} else {
    if (!DatabaseUtils::connect($link, $db_params, null)) {
        $prerequisites .= "Failed to connect to database " . $db_params['db_host'] . ":" . $db_params['db_port'] . " user:"******". Please check the database settings you provided and verify that MySQL is up and running." . PHP_EOL;
    } else {
        // check mysql version and settings
        $mysql_version = getMysqlSetting($link, 'version');
        // will always return the value
        if (!checkVersion($mysql_version, $prerequisites_config["mysql_min_version"])) {
            $prerequisites .= "MySQL version should be >= " . $prerequisites_config["mysql_min_version"] . " (current version is {$mysql_version})" . PHP_EOL;
        }
        $lower_case_table_names = getMysqlSetting($link, 'lower_case_table_names');
        if (!isset($lower_case_table_names)) {
            $prerequisites .= "Please set 'lower_case_table_names = " . $prerequisites_config["lower_case_table_names"] . "' in my.cnf and restart MySQL" . PHP_EOL;
        } else {
            if (intval($lower_case_table_names) != intval($prerequisites_config["lower_case_table_names"])) {
                $prerequisites .= "Please set 'lower_case_table_names = " . $prerequisites_config["lower_case_table_names"] . "' in my.cnf and restart MySQL (current value is {$lower_case_table_names})" . PHP_EOL;
            }
예제 #10
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../../database/DatabaseUtils.php";
include "../../../utils/TimeUtils.php";
include "../../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$list = $obj["list"];
/*Dictionary:enTypeName(string)*/
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    for ($i = 0; $i < count($list); $i++) {
        $enTypeDiry = $list[$i];
        $enTypeDiry["enTypeID"] = TimeUtils::getId();
        $enTypeDiry["create_time"] = $update_time;
        $enTypeDiry["update_time"] = $update_time;
        $db_utils->addENTypeTable($user_link, $enTypeDiry);
    }
    $res["message"] = "加入成功!";
    $db_utils->response($start_time, $res, $user_link);
} else {
    $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
예제 #11
0
 /**
  * Procesar formulario de nuevo encuestado
  *
  * @param $request sfWebRequest
  */
 public function executeProcesarForm(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     // Obtener datos base sin bloques "Sancion vigente"
     $manyToMany = array();
     $params = $request->getPostParameters();
     foreach ($params as $param => $value) {
         if (is_array($value)) {
             $manyToMany[$param] = $value;
             unset($params[$param]);
         }
     }
     // Agregar otros parametros
     $params['id_user_responsable_principal'] = $this->getUser()->getGuardUser()->getId();
     $params['created_at'] = $params['updated_at'] = '"NOW()"';
     // Guardar
     $sql = DatabaseUtils::prepareInsertQuery('encuestado', $params);
     $query = $this->pdo->prepare($sql);
     if (!$query->execute($params)) {
         return sfView::ERROR;
     }
     // Obtener id de encuestado recien añadido
     $id = $this->pdo->lastInsertId();
     // Obtener sanciones vigentes como objetos
     $count = count($request->getParameter('select_sistema_atencion'));
     $sancionesVigentes = array();
     for ($i = 0; $i < $count; $i++) {
         foreach ($manyToMany as $key => $value) {
             $sancionesVigentes[$i][$key] = $value[$i];
         }
         $sancionesVigentes[$i]['id_encuestado'] = $id;
     }
     // Guardar las sanciones vigentes; transaccion para mejor rendimiento
     try {
         $this->pdo->beginTransaction();
         foreach ($sancionesVigentes as $sancion) {
             $sql = DatabaseUtils::prepareInsertQuery('encuestado_sanciones', $sancion);
             $query = $this->pdo->prepare($sql);
             $query->execute($sancion);
         }
         $this->pdo->commit();
     } catch (Exception $e) {
         $this->pdo->rollBack();
         return sfView::ERROR;
     }
     $this->username = $this->getUser()->getUsername();
     //sanciones anteriores
     // Obtener sanciones vigentes como objetos
     $id2 = $this->pdo->lastInsertId();
     $count2 = count($request->getParameter('input_ruk_2'));
     $sancionesAnteriores = array();
     for ($j = 0; $j < $count2; $j++) {
         foreach ($manyToMany as $key => $value) {
             $sancionesAnteriores[$j][$key] = $value[$j];
         }
         $sancionesAnteriores[$j]['id_encuestado'] = $id;
     }
     // Guardar las sanciones vigentes; transaccion para mejor rendimiento
     try {
         $this->pdo->beginTransaction();
         foreach ($ssancionesAnteriores as $sancionant) {
             $sql = DatabaseUtils::prepareInsertQuery('encuestado_canteriores', $sancionant);
             $query = $this->pdo->prepare($sql);
             $query->execute($sancionant);
         }
         $this->pdo->commit();
     } catch (Exception $e) {
         $this->pdo->rollBack();
         return sfView::ERROR;
     }
     $this->username = $this->getUser()->getUsername();
     //
 }
예제 #12
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $orderID = TimeUtils::getId();
    $obj["orderID"] = $orderID;
    $obj["create_time"] = $update_time;
    $obj["update_time"] = $update_time;
    $db_utils->addOrderTable($user_link, $obj, 1, 0);
    $res["orderID"] = $orderID;
    $res["message"] = "加入成功!";
    $db_utils->response($start_time, $res, $user_link);
} else {
    $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
}
예제 #13
0
 /**
  * DatabaseModel->insert() Method
  *
  * Insert data into the database.
  *
  * @param  array    $in    (required) Associative array of input to be inserted, keys being the name of columns
  * @param  string   $table (optional if defined in constructor) Table to use
  * @return Database        reference to self
  */
 public function insert($in, $table = null)
 {
     $typeof_table = gettype($table);
     if ($table != null) {
         if ($typeof_table != 'string') {
             throw new DatabaseException(__METHOD__ . '(): encountered table argument of invalid type.', DatabaseException::EXCEPTION_INPUT_INVALID_TYPE, $this);
         } else {
             if (!$this->tableExists($table)) {
                 throw new DatabaseException(__METHOD__ . '(): table "' . $table . '" does not exist.', DatabaseException::EXCEPTION_INPUT_NOT_VALID, $this);
             }
         }
     }
     if (!$this->tableExists($table)) {
         $typeof_in = gettype($in);
     }
     if ($typeof_in == 'array') {
         //input is an array
         $sql = $this->dbms['sql']['insert'];
         //TODO: Generate data array so we can dynamically process input data.
         //generate the statement
         $query = self::genStmt($this->dbms['sql']['insert']['stmt'], isset($sql['tables']) ? $data[$sql['tables']['value']] : null, isset($sql['columns']) ? $data[$sql['columns']['value']] : null, isset($sql['sets']) ? $data[$sql['sets']['value']] : null, isset($sql['tablesets']) ? $data[$sql['tablesets']['value']] : null, isset($sql['columnsets']) ? $data[$sql['columnsets']['value']] : null, isset($sql['conditions']) ? $data[$sql['conditions']['value']] : null, $table);
         //prepare the statement
         $statement = $this->connector->prepare($query);
         //execute the statement
         $depth = DatabaseUtils::arrayMaxDepth($in);
         if ($depth == 1) {
             //array depth 1 - single row insert
             $executionArray = array($table);
             foreach ($in as $inKey => $inVal) {
                 $executionArray[] = (string) $inKey;
             }
             foreach ($in as $inKey => $inVal) {
                 $executionArray[] = (string) $inVal;
             }
             try {
                 $statement->execute($executionArray);
             } catch (PDOException $e) {
                 throw new DatabaseException(__METHOD__ . '(): caught exception thrown by PDO.', DatabaseException::EXCEPTION_GENERIC_DATABASE_ERROR, $this, $e);
             }
         } elseif ($depth == 2) {
             //array depth 2 - multi-row insert
             $status = array();
             foreach ($in as $inVal) {
                 $executionArray = array($table);
                 foreach ($inVal as $inValKey => $inValVal) {
                     $executionArray[] = (string) $inValKey;
                 }
                 foreach ($inVal as $inValKey => $inValVal) {
                     $executionArray[] = (string) $inValVal;
                 }
                 try {
                     $statement->execute($executionArray);
                 } catch (PDOException $e) {
                     throw new DatabaseException(__METHOD__ . '(): caught exception thrown by PDO.', DatabaseException::EXCEPTION_GENERIC_DATABASE_ERROR, $this, $e);
                 }
             }
         } else {
             throw new DatabaseException(__METHOD__ . '(): encountered array of excessive depth. Max depth = 2.', DatabaseException::EXCEPTION_INPUT_ARRAY_TOO_DEEP, $this);
         }
     } else {
         throw new DatabaseException(__METHOD__ . '(): encountered input of invalid type. Must be an array.', DatabaseException::EXCEPTION_INPUT_INVALID_TYPE, $this);
     }
     return $this;
     //for method chaining (since this is a mutator)
 }
예제 #14
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
include "../../database/DatabaseUtils.php";
$db_utils = new DatabaseUtils();
$root = $_GET["root"];
if ($root == "yoga") {
    $user_link = $db_utils->initUserDatabase();
    if (!$db_utils->deleteDatabase($user_link, DBName::getUserDB)) {
        echo mysql_error();
    }
    mysql_close($user_link);
    $product_link = $db_utils->initProductDatabase();
    if (!$db_utils->deleteDatabase($product_link, DBName::getProductDB)) {
        echo mysql_error();
    }
    mysql_close($product_link);
    $shared_link = $db_utils->initSharedDatabase();
    if (!$db_utils->deleteDatabase($shared_link, DBName::getSharedDB)) {
        echo mysql_error();
    }
    mysql_close($shared_link);
    $sharing_link = $db_utils->initSharingDatabase();
    if (!$db_utils->deleteDatabase($sharing_link, DBName::getSharingDB)) {
        echo mysql_error();
    }
    mysql_close($sharing_link);
}
예제 #15
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../../database/DatabaseUtils.php";
include "../../../utils/TimeUtils.php";
include "../../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$wordList = $obj["wordList"];
/*Dictionary:enTypeName(string)*/
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    for ($i = 0; $i < count($wordList); $i++) {
        $enWordDiry = $wordList[$i];
        $enWordID = TimeUtils::getId();
        $enWordDiry["enWordID"] = $enWordID;
        $enWordDiry["create_time"] = $update_time;
        $enWordDiry["update_time"] = $update_time;
        $db_utils->addENWordTable($user_link, $enWordDiry);
        $configList = $enWordDiry["configList"];
        for ($x = 0; $x < count($configList); $x++) {
            $configDiry = $configList[$x];
            $configDiry["enExampleID"] = TimeUtils::getId();
예제 #16
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
$list = $obj["list"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $upd["status"] = 3;
    if (!$db_utils->updateData($user_link, TableName::getOrderTable, $upd, "orderID", $orderID)) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    for ($i = 0; $i < count($list); $i++) {
        $item = $list[$i];
        $detailID = $item["detailID"];
        if (!$db_utils->updateData($user_link, TableName::getOrderDetailTable, $item, "detailID", $detailID)) {
            $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
        }
    }
예제 #17
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../../database/DatabaseUtils.php";
include "../../../utils/TimeUtils.php";
include "../../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$enWordID = $obj["enWordID"];
$db_utils = new DatabaseUtils();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_enWord = array("enWordID" => $enWordID);
    $select_obj = $db_utils->selectTableAnd($user_link, TableName::getENWordTable, $select_enWord);
    if (!$select_obj) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    $record = mysql_fetch_array($select_obj);
    $get["enWord"] = $record['enWord'];
    $get["enWordID"] = $record['enWordID'];
    $get["enTypeID"] = $record['enTypeID'];
    $get["create_time"] = $record['create_time'];
    $get["update_time"] = $record['update_time'];
    $definitionList = array();
예제 #18
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
//將時區設定為台灣
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
$db_utils = new DatabaseUtils();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $db_utils->createOrderTable($user_link);
    $db_utils->createOrderDetailTable($user_link);
}
mysql_close($user_link);
예제 #19
0
header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
include "../../utils/TimeUtils.php";
include "../../utils/tokenUtils.php";
$data = $_POST["data"];
if (get_magic_quotes_gpc()) {
    $data = stripslashes($_POST['data']);
} else {
    $data = $_POST['data'];
}
$obj = json_decode($data, true);
$orderID = $obj["orderID"];
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $select_array = array("orderID" => $orderID);
    $selectDetail = $db_utils->selectTableAnd($user_link, TableName::getOrderDetailTable, $select_array);
    if (!$selectDetail) {
        $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
    }
    $detailNum = 0;
    while ($record = mysql_fetch_array($selectDetail)) {
        $detailNum++;
    }
    if ($detailNum > 0) {
        $selectRoot = $db_utils->selectTableAnd($user_link, TableName::getOrderTable, $select_array);
예제 #20
0
<?php

header("Access-Control-Allow-Origin: *");
header('Content-Type: text/html; charset=utf8');
//將時區設定為台灣
date_default_timezone_set('Asia/Taipei');
include "../../database/DatabaseUtils.php";
$db_utils = new DatabaseUtils();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    $db_utils->createENTypeTable($user_link);
    $db_utils->createENWordTable($user_link);
    $db_utils->createWordDefinitionTable($user_link);
    $db_utils->createWordTranslateTable($user_link);
    $db_utils->createWordExampleTable($user_link);
}
mysql_close($user_link);