| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/m.musiccircle/ |
Upload File : |
<?php
if (session_id() === "") {
session_start();
}
//new pdo
define("PRODUCTION", 0);
if (PRODUCTION == 1) {
$dbh2 = new PDO("mysql:host=localhost;dbname=muscircledb", "muscirclesa", "Mus.#0933");
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
ini_set('display_errors', 0);
} else {
$dbh2 = new PDO("mysql:host=192.168.171.23;dbname=dev_imusiccircle", "admin", "PHac7dru");
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
ini_set('display_errors', 1);
}
$dbh2->exec("set names utf8");
date_default_timezone_set("Asia/Hong_Kong");
//get member data
if (!function_exists('dump_sql')) {
function dump_sql($sql, $parameters)
{
$keys = array();
# build a regular expression for each parameter
foreach ($parameters as $key => $value) {
if (is_string($key)) {
$keys[] = '/:' . $key . '/';
} else {
$keys[] = '/[?]/';
}
}
foreach ($parameters as $key2 => $value) {
$parameters[$key2] = "'" . $value . "'";
}
$sql = preg_replace($keys, $parameters, $sql, 1, $count);
#trigger_error('replaced '.$count.' keys');
return $sql;
}
}
if (!function_exists('bind_pdo')) {
function bind_pdo($sql, $parameters = NULL, $action = NULL)
{
global $dbh2;
if ($action == "insert" || $action == "update" || $action == "delete" || empty($action)) {
if (!($sth = $dbh2->prepare($sql))) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
} else {
return true;
}
}
if ($action == "selectone") {
if (!($sth = $dbh2->prepare($sql))) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
return $sth->fetch(PDO::FETCH_ASSOC);
}
if ($action == "selectall") {
if (!($sth = $dbh2->prepare($sql))) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
debug_print_backtrace();
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
return $sth->fetchAll(PDO::FETCH_ASSOC);
}
if ($action == "dump") {
return dump_sql($sql, $parameters);
}
}
}
header('Content-Type: application/json; charset=utf-8');
//$_SESSION["app_device_id"] = 111;
//$_SESSION["app_notification_token"] = 222;
/*"cannot_get_json_message" => "伺服器連接錯誤,請先檢查你的手機是否可以連接互聯網。",
"confirm_close_app_message" => "確定離開?",*/
if ($_GET["action"] == "app_user_info") {
$_SESSION["app_device_id"] = $_POST["app_device_id"];
$_SESSION["app_notification_token"] = $_POST["app_notification_token"];
if (!empty($_SESSION["app_device_id"]) && !empty($_SESSION["app_notification_token"])) {
$response = array("success");
}else{
$response = array("fail");
}
echo json_encode($response);
} else if ($_GET["action"] == "basic_info") {
$response = array(
"app_index_url" => "http://www.hkosl.com/m.musiccircle/index.php?key=dMuZetw5",
"version" => "1.3.0",
"ios_version" => "1.3.1",
"force_update_word" => "應用程式已更新,請更新後再嘗試。",
"force_update_link" => "https://play.google.com/store/apps/details?id=com.musiccircle&hl=zh-TW",
"confirm_leave" => "確定離開?",
"alert_box_right" => "確定",
"alert_box_left" => "取消",
);
echo json_encode($response);
}