| 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/ergofito/webadmin/ |
Upload File : |
<?php
if (session_id() === "") {
session_start();
}
//---------------------------------MYSQL輸入-----------------------------------------//
function pass_gen($length = 8) {
$pass = array();
$a = array('a','s','d','f','g','h','j','k','l','b');
$b = array('1','2','3','4','5','6','7','8','9','0');
for ($i = 0; $i < $length; $i++) {
$r1 = rand(0,9);
$r2 = rand(0,1);
$r3 = rand(0,1);
if($r2==1){
$string = $b[$r1];
}else{
$string = $a[$r1];
}
if($r3==1){
$string = strtoupper($string);
}
$pass[] = $string;
}
return implode($pass);
}
function getPhpTemplate( $file = '', $data = array() ) {
if (!file_exists($file)||!is_array($data)) return false;
$template = file_get_contents($file);
foreach ($data as $key=>$value) $template = str_replace('#{'.$key.'}', $value, $template);
return $template;
}
function formatPostData( $datas = array(), $filter = array(), $kill_empty = false ) {
if (count($datas)<1) return $datas;
$main_keys = array_keys($datas[current(array_keys($datas))]);
$sub_keys = array_keys($datas);
foreach($main_keys as $main_key) {
$empty = true;
foreach($sub_keys as $sub_key) {
$data[$main_key][$sub_key] = $datas[$sub_key][$main_key];
$empty = !empty($data[$main_key][$sub_key])&&!in_array($sub_key, $filter) ? false : $empty;
}
if ($kill_empty && $empty) array_pop($data);
}
return $data;
}
function getJsTemplate( $file = '' ) {
if (!file_exists($file)) return false;
$template = file_get_contents($file);
$template = str_replace("\n", "", str_replace("'", "\'", $template));
$template = str_replace("\r", "", $template);
for ($i=0; $i<10; $i++) $template = str_replace(" ", " ", $template);
$template = str_replace("> <", "><", $template);
return $template;
}
function replaceJsTemplate( $html ) {
if (!$html) return false;
$template = $html;
$template = str_replace("\n", "", str_replace("'", "\'", $template));
$template = str_replace("\r", "", $template);
for ($i=0; $i<10; $i++) $template = str_replace(" ", " ", $template);
$template = str_replace("> <", "><", $template);
return $template;
}
function mysql_install($array,$table,$action='add',$idname="",$id=""){ //array字串(array_keys),db table name,add=新db edit=修改,del= 刪除
$arraykey=array_keys($array);
if($action=='add'){
$sql= "INSERT INTO `".$table."` (";
for($i=0;$i<count($array);$i++){
if($i+1<count($array)){
$dot=',';
}else{
$dot='';
}
$sql.= "`".$arraykey[$i]."`".$dot;
}
$sql.= ') values (';
for($i=0;$i<count($array);$i++){
if($i+1<count($array)){
$dot=',';
}else{
$dot='';
}
//$sql.= "'".$array[$arraykey[$i]]."'".$dot;
$sql.= "?".$dot;
}
$sql.= ')';
}else if($action=='edit'){
$sql="UPDATE `".$table."` SET ";
for($i=0;$i<count($array);$i++){
if($i+1<count($array)){
$dot=',';
}else{
$dot='';
}
//$sql.= "`".$arraykey[$i]."` = '".$array[$arraykey[$i]]."'".$dot;
$sql.= "`".$arraykey[$i]."` = ?".$dot;
}
//$sql.=" WHERE `".$table."`.`".$idname."` =".$id.";";
$sql.=" WHERE `".$table."`.`".$idname."` =?;";
}else if($action=='del'){
$sql.="DELETE FROM `".$table."` WHERE `".$table."`.`".$idname."` =".$id;
}
return $sql;
}
// Check if the user is logged in
if (!isset($_SESSION['loginname'])) {
header("Location: login.php");
exit;
}
include_once ('configure.php');
?>