"; echo " "; echo " ".$title." "; } //jquery install function js__jquery() { if(!$GLOBALS['jquery']) { echo " "; $GLOBALS['jquery']=1; } } function js__device() { echo " "; } function css__cleverLogin() { echo " "; } function css__easyVer() { echo " "; } //mark the end of the html header function yimian__headerEnd() { js__jquery(); echo " "; } function js__easyVer() { echo " "; } function js__cleverLogin() { echo " "; js__easyVer(); } function yimian__heartbeat() { echo " "; } function yimian__simpleFooter($bodyEnd=0) { if(!$bodyEnd) echo " "; yimian__heartbeat(); echo " "; } //print a html footer function yimian__footer($wordColor="#C7C7C7",$backgroundColor="#2B2B2B",$urlColor="#87CEEB") { echo " "; yimian__heartbeat(); echo " "; } /**added functions**/ //get millis time stamp function millis() { list($msec, $sec) = explode(' ', microtime()); return $msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); } /**database connection**/ //connect to database function db__connect($servername="",$username="",$password="",$dbname="") { /* reset */ if($servername=="") $servername=$GLOBALS['g_db_serverName']; if($username=="") $username=$GLOBALS['g_db_usrName']; if($password=="") $password=$GLOBALS['g_db_psswd']; if($dbname=="") $dbname=$GLOBALS['g_db_dbName']; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Mysql Connect Failed: " . $conn->connect_error); } return ($conn); } //get table row number::(data_cnnct var,table name) ::(row number) function db__rowNum($conn,$table,$clmnName="",$value="",$clmnName2="",$value2="") { $table=db__antisql($table); $clmnName=db__antisql($clmnName); $value=db__antisql($value); $clmnName2=db__antisql($clmnName2); $value2=db__antisql($value2); if($clmnName=="") $sql = "SELECT COUNT(*) FROM $table"; elseif($clmnName2=="") $sql = "SELECT COUNT(*) FROM $table where $clmnName='$value'"; else $sql = "SELECT COUNT(*) FROM $table where $clmnName='$value' AND $clmnName2='$value2'"; $row_count = $conn->query($sql); list($row_num) = $row_count->fetch_row(); return ($row_num); } //get row data from database::(data_cnnct var, table name,column name, column value)::(row info) function db__getData($conn,$table,$clmnName="",$value="",$clmnName2="",$value2="") { $table=db__antisql($table); $clmnName=db__antisql($clmnName); $value=db__antisql($value); $clmnName2=db__antisql($clmnName2); $value2=db__antisql($value2); if($clmnName=="") $sql = "SELECT * FROM $table"; elseif($clmnName2=="") $sql = "SELECT * FROM $table where $clmnName='$value'"; else $sql = "SELECT * FROM $table where $clmnName='$value' AND $clmnName2='$value2'"; $result = $conn->query($sql); //no data if ($result->num_rows > 0) {}else{return 404;} $i=0; $arr=array(); while($row = $result->fetch_assoc()) { $arr[$i++]=$row; } return ($arr); } //fnct for insert a row to database function db__insertData($conn,$table,$content) { $table=db__antisql($table); $key=array_keys($content); $key=db__antisql($key); $sql="insert INTO $table ("; for($i=0;$iquery($sql) === TRUE)) echo "SQL Insert Error: " . $sql . "
" . $conn->error; } //fnct for update a row to database without check function db__updateData($conn,$table,$content,$index) { $key=array_keys($content); $key=db__antisql($key); $sql="UPDATE $table SET "; for($i=0;$iquery($sql) === TRUE)) echo "SQL Insert Error: " . $sql . "
" . $conn->error; } //push row data from database::(data_cnnct var, table name,column name, column value)::(row info) function db__pushData($conn,$table,$content,$index="",$is_force=1) { if($index) { $index_keys=array_keys($index); if(count($index_keys)==1) $result=db__rowNum($conn,$table,$index_keys[0],$index[$index_keys[0]]); elseif(count($index_keys)==2) $result=db__rowNum($conn,$table,$index_keys[0],$index[$index_keys[0]],$index_keys[1],$index[$index_keys[1]]); else return -1; if($result>0) db__updateData($conn,$table,$content,$index); else if($is_force) db__insertData($conn,$table,$content); } else db__insertData($conn,$table,$content); } //anti sql function db__antisql($str) { return(str_ireplace("'","",$str)); } /***tools***/ //fnct of get usr ip::()::(ip) function getip() { if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) { $ip = getenv("HTTP_CLIENT_IP"); } else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) { $ip = getenv("REMOTE_ADDR"); } else if (isset ($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) { $ip = $_SERVER['REMOTE_ADDR']; } else { $ip = "unknown"; } return ($ip); } /**functions for aplayer**/ //put this function to where you want the aplayer to dispaly function aplayer__element() { echo "
"; } //this should put at the near the need of a body, //the js object name is ap. function aplayer__setup() { echo " "; echo ""; } //this should put at the near the need of a body, //the js object name is ap. function aplayer__setup_mini() { echo " "; echo ""; } //the should put behind the setup function function aplayer__add($name="",$artist="unknown",$url="",$coverurl="",$lrcurl="",$theme="#ebd0c2") { echo ""; } //play a netease playlist function aplayer__netease($playlistid="2012006204",$loadStart=0,$numLimit=10,$theme="#ebd0c2") { if(!$GLOBALS['jquery']) js__jquery(); echo ""; } /**functions for dplayer**/ //put this function to where you want the dplayer to dispaly function dplayer__element() { echo "
"; } //this should put at the near the need of a body, //the js object name is dp. function dplayer__setup() { echo " "; echo " "; echo " "; echo ""; } //this should put at the near the need of a body, //the js object name is dp. function dplayer__setup_once($id) { echo " "; echo " "; echo " "; echo ""; } //this should put behind the setup function function dplayer__add($id="234") { echo ""; } /****API******/ //fnct for dogecloud API function api__dogecloud($platform,$vcode,$ip,$AccessKey,$SecretKey){ $url="https://api.dogecloud.com/video/streams.json?platform=$platform&vcode=$vcode&ip=$ip"; $str="/video/streams.json?platform=$platform&vcode=$vcode&ip=$ip"."\n"; $str = hash_hmac("sha1", $str, $SecretKey); $headerArray =array("Host:api.dogecloud.com","Authorization: TOKEN ".$AccessKey.":".$str); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArray); $output = curl_exec($ch); if($errno = curl_errno($ch)) { $error_message = curl_strerror($errno); echo "cURL error ({$errno}):\n {$error_message}"; } curl_close($ch); return $output; } /****Yimian Video*******/ function video__bodyUp() { if(!isset($_REQUEST['_pjax'])) { yimian__header("Yimian Video","video,Yimian","This is the page for showing video class."); echo " "; yimian__headerEnd(); echo file_get_contents("https://cn.yimian.xyz/video/body_up.html"); } } function video__bodyDown() { if(!isset($_REQUEST['_pjax'])) { echo file_get_contents("https://cn.yimian.xyz/video/body_down.html"); yimian__simpleFooter(); } }