//$mysql_host = "localhost";
$mysql_host = "db-57.coowo.com:3306";
$mysql_username = "jm1787_user";
$mysql_password = "@mj1787X231212u";
$mysql_database = "mj1787_db";
$conn = mysqli_connect($mysql_host, $mysql_username, $mysql_password ,$mysql_database);
if (mysqli_connect_errno($conn))
{
echo "Connection error:" . mysqli_connect_error();
}
mysqli_set_charset($conn,"utf8");
?>
//==================================================================
//Jason function Jfunciont v2.0
//此程式未經本人同意禁止使用,修改,重製,散佈
//File: jfunction.php
//Date: 2009-12-30 ~ 2020-05-12
//Author: Jason Yang (ozcth@hotmail.com)
//Version: 2.0
//Description:
//Copyright (C) 2009,Jason Yang
//修改適用於 php5.6 ~ php7.4 版本
//==================================================================
function get_Uni_code($words)
{
//選擇一個隨機的方式
mt_srand((double) microtime() * 1000000);
if($words=="") $words="A";
return $words . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
}
function jshow_msg($words,$mode){
//global $ebox_BasePath;
$msg_code="";
if($mode==0){
$msg_code="
";
return $msg_code;
}
if($mode==1){
$msg_code="";
return $msg_code;
}
}
function jshow_msg2($words,$mode){
//global $ebox_BasePath;
//bootstrap 4.3
$msg_code="";
if($mode==0){
$msg_code=''
.$words
."
";
return $msg_code;
}
if($mode==1){
$msg_code=''
.$words
."
";
return $msg_code;
}
}
function JNum_check($ValueX,$ReValueX){
//必為數值
if(!is_numeric($ValueX) || is_null($ValueX)){
return $ReValueX;
}else {
return $ValueX;
}
}
function JRequest($ValueX,$ReValueX){
//JRequest 2.0 修改有變數但是空值的問題 例:sid=
//JRequest 2.1 修改有過濾HTML的問題 例:sid=
//JRequest 2.2 修改資料欄位為數值,但輸入非數值造成錯誤 例:sid=1' 或 sid=a
//JRequest 2.3 修正php 5.4 php7.4 移除get_magic_quotes_gpc()函式 Deprecated: Function get_magic_quotes_gpc() is deprecated
//改為config設定 MAGIC_QUOTES_GPC 常數
$rt_value="";
if (isset($_GET[$ValueX])){
if(is_null($_GET[$ValueX]) or trim($_GET[$ValueX])=="" ) {
return $ReValueX;
}else{
//檢查是否為數值
//$rt_value=get_magic_quotes_gpc()?trim($_GET[$ValueX]):addslashes(trim($_GET[$ValueX]));
$rt_value=MAGIC_QUOTES_GPC?trim($_GET[$ValueX]):addslashes(trim($_GET[$ValueX]));
if(is_numeric($ReValueX)){
return JNum_check($rt_value,$ReValueX);
}else{
return $rt_value;
}
}
} else {
if (isset($_POST[$ValueX])){
if(is_null($_POST[$ValueX]) or trim($_POST[$ValueX])=="" ) {
return $ReValueX;
}else{
//檢查是否為數值
//$rt_value=get_magic_quotes_gpc()?trim($_POST[$ValueX]):addslashes(trim($_POST[$ValueX]));
$rt_value=MAGIC_QUOTES_GPC?trim($_POST[$ValueX]):addslashes(trim($_POST[$ValueX]));
if(is_numeric($ReValueX)){
return JNum_check($rt_value,$ReValueX);
}else {
return $rt_value;
}
}
} else {
return $ReValueX;
}
}
}
function JRedirect($Url,$mode){ //轉頁1
if ($mode==1){
header("HTTP/1.1 303 See Other");
header("Location: ".$Url);
exit;
}
}
function J_Get_Array($ValueX,$ReValueX){
//$_GET 陣列
if (isset($_GET[$ValueX])){
if(is_null($_GET[$ValueX])) {
return $ReValueX;
}else{
return $_GET[$ValueX];
}
}
}
function J_POST_Array($ValueX,$ReValueX){
//$_POST 陣列
if (isset($_POST[$ValueX])){
if(is_null($_POST[$ValueX])) {
return $ReValueX;
}else{
return $_POST[$ValueX];
}
}
}
function J_implode ($chg_ValueX,$arr_ValueX){
//陣列轉特定字串 v2.0
//將陣列轉乘 ,1,2,3,4,5,6,
//修正 陣列為空值時 多產生 "," 的錯誤
$temp_value="";
for ($i=0;$i 0 驗證資料有效性
// substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16) 驗證資料完整性
// 驗證資料有效性,請看未加密明文的格式
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
// 把動態密匙保存在密文裡,這也是為什麼同樣的明文,生產不同密文後能解密的原因
// 因為加密後的密文可能是一些特殊字元,複製過程可能會丟失,所以用base64編碼
return $keyc.str_replace('=', '', base64_encode($result));
}
}
//end加密解密============================================================================
function caclutime(){ //計算執行時間
$time = explode( " ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
function txt_out_html ($code) {
$code=str_replace(" "," ",$code);
$code=str_replace("<","<",$code);
$code=str_replace(">",">",$code);
$code=str_replace("\"",""",$code);
$code=str_replace("'","´",$code);
$code=str_replace("\n","
",$code);
return $code;
}
function JHtmlOutPut ($value){
//html輸出編輯頁面轉換
//避免HTML本頁與含有HTML頁面資料充突破壞版面
//例如ckeditor4,