From 20496a4be083d873fc92fd2ba79ec42dee960d5e Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Fri, 14 Nov 2008 16:38:36 +0000 Subject: [PATCH] lol --- JsPHP.php | 110 +++++++++++++++++++++++++++++++++ db.php | 45 ++++++++++++++ img/bar-grey.gif | Bin 0 -> 95 bytes img/bar-life.gif | Bin 0 -> 107 bytes img/bar-mana.gif | Bin 0 -> 163 bytes sync.php | 155 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 310 insertions(+) create mode 100644 JsPHP.php create mode 100644 db.php create mode 100644 img/bar-grey.gif create mode 100644 img/bar-life.gif create mode 100644 img/bar-mana.gif create mode 100644 sync.php diff --git a/JsPHP.php b/JsPHP.php new file mode 100644 index 0000000..1373e5e --- /dev/null +++ b/JsPHP.php @@ -0,0 +1,110 @@ +
"; +progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-life.gif"); +progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-mana.gif"); +progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-life.gif"); +progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-mana.gif"); +for($i=0;$i<=100;$i+=2){ + sleep(1); + progressSetValue($i); + progressSetText($i."%"); + progressSetValue($i/2,1); + progressSetText(($i/2)."%",1); + progressSetValue($i/4,2); + progressSetText(($i/4)."%",2); + progressSetValue($i/3,3); + progressSetText(($i/3)."%",3); + //echo $i."% > "; +} +echo"
"; +redirect("http://google.com"); + +function progressBarInit($width, $height, $imgBar, $imgProggress){ + GLOBAL $progressInit, $progressNextId; + if(!$progressInit){ + echo" + "; + $progressInit = true; + } + $id = $progressNextId; + $progressNextId++; + echo" + +
+
+ +
+
+ "; + flush(); + return $id; +} +function progressSetValue($value,$id=0){ + echo" + + "; + flush(); +} +function progressSetText($text,$id=0){ + echo" + + "; + flush(); +} + +function redirect($url){ + echo" + + "; + flush(); +} +?> \ No newline at end of file diff --git a/db.php b/db.php new file mode 100644 index 0000000..c9f70c4 --- /dev/null +++ b/db.php @@ -0,0 +1,45 @@ +".$GLOBALS['db_database']." DO NOT EXIST!!!"); + } + + function dbdisconnect(){ + @mysql_close(); + } + + function getTableRow($table, $id){ + $sqlSats = "SELECT * FROM ".$table." WHERE id=".$id; + return @mysql_fetch_assoc(runSimpleQuery($sqlSats)); + } + + function getTableCount($table){ + $sqlSats = "SELECT * FROM ".$table; + return @mysql_num_rows(runSimpleQuery($sqlSats)); + } + + function runQueryArray($sqlSats){ + $resultat = array(); + $sql = @mysql_query($sqlSats) + or die("QUERY FAILD!!!."); + + while ($row = mysql_fetch_array($sql,MYSQL_ASSOC) ) array_push($resultat, $row); + return $resultat; + } + + function runSimpleQuery($sqlSats){ + $resultat = @mysql_query($sqlSats) + or die("QUERY FAILD!!!."); + + return $resultat; + } + +?> \ No newline at end of file diff --git a/img/bar-grey.gif b/img/bar-grey.gif new file mode 100644 index 0000000000000000000000000000000000000000..e3315460cfa528a57d540c5fc4c9fd252ceee242 GIT binary patch literal 95 zcmZ?wbhEHbWMmLv*v!BX9UWa!Q4tpxmzS59oSdAUogEPo5fv3xSXh{rmKGl$pOBD{ rk&#hSQW72>-rL)&_>+YJ1av?I$P5M+o)4xbT;3^~jD3ZUEDY8FjBgt9 literal 0 HcmV?d00001 diff --git a/img/bar-life.gif b/img/bar-life.gif new file mode 100644 index 0000000000000000000000000000000000000000..828e1df50c081ecda6925a3a6834effc6ad661bd GIT binary patch literal 107 zcmZ?wbhEHbWM&Xx*v!Bno64w=!ziE0s9eFQRL*F1icz(WQ6Y~}rJ7MLgHf@FQEMWj zY9pgs6QlMNM#Vx##h)w;AfN*xKxQzoNNn&pHfyIwzwfW$Q;KX$64W#ntXuO+$D4)0 F8UU!C8At#C literal 0 HcmV?d00001 diff --git a/img/bar-mana.gif b/img/bar-mana.gif new file mode 100644 index 0000000000000000000000000000000000000000..6ad75b33ef639148e1f20fc0a2b47f4347539da0 GIT binary patch literal 163 zcmZ?wbhEHbWM&XxIKsdn<3B;vy-m=$k>8<4+_OW(twlL%u7Fd$Y|s=bzdpn4&BCrt zis7>)yu0}w>l8w!D@M$c@ag7vs1tT+lJf1751nq9vspf5Is*=%_>%=JqXQyAb~3Ok oELar5!yN11y2fF4fahfw7uh?m`*bEhkauWzHqwylQ)I9P0RL?#qyPW_ literal 0 HcmV?d00001 diff --git a/sync.php b/sync.php new file mode 100644 index 0000000..7330b00 --- /dev/null +++ b/sync.php @@ -0,0 +1,155 @@ + + +
|
+ + + + "; + flush(); + copyFile($_SESSION["id".$_GET["copyid"]]["copy"],$_SESSION["id".$_GET["copyid"]]["to"],$_SESSION["id".$_GET["copyid"]]["date"]); + } + else{ + echo "ERROR"; + } +} +else if($sync){ + session_start(); + $_SESSION['auth'] = $sessionPassword; + $sessionId = 0; + + $remoteFileList = unserialize(file_get_contents($remoteFileSyncURL."?fileList")); + $localFileList = getFileArray($localDir); + + echo "
KOC SYNC: ".$remoteFileSyncURL."
"; + foreach($remoteFileList as $remoteFile){ + $temp = searchFile($remoteFile, $localFileList); + if($temp >= 0){ + if($remoteFile[0] > $localFileList[$temp][0]){ + $_SESSION["id".$sessionId]["copy"] = $remoteFile[2]; + $_SESSION["id".$sessionId]["to"] = $localDir.$localFileList[$temp][1]; + $_SESSION["id".$sessionId]["date"] = $remoteFile[0]; + echo ""; + $sessionId++; + //copyFile($remoteFile[2],$localDir.$localFileList[$temp][1], $remoteFile[0]); + } + else if($remoteFile[0] < $localFileList[$temp][0]){ + echo ""; + } + else{ + echo ""; + } + } + else{ + $_SESSION["id".$sessionId]["copy"] = $remoteFile[2]; + $_SESSION["id".$sessionId]["to"] = $localDir.$remoteFile[1]; + $_SESSION["id".$sessionId]["date"] = $remoteFile[0]; + echo ""; + $sessionId++; + //copyFile($remoteFile[2],$localDir.$remoteFile[1],$remoteFile[0]); + } + echo ""; + } + echo "
Local File Old!
Local File Newer!
Synced!
New File!".$remoteFile[2]." => ".$remoteFile[1]."
"; +} +else { + echo"
Sync disabled for this server!
"; +} + +function copyFile($source,$dest, $lastModDate = null){ + @$file = fopen ($source, "rb"); + if (!$file) { + echo"Failed to copy $source -> $dest!
"; + return false; + }else { + if(!file_exists(dirname($dest))) + mkdir(dirname($dest),0777,true); + $filename = basename($source); + $fc = fopen($dest, "wb"); + echo "$source => $dest
"; + while (!feof ($file)) { + $line = fread ($file, 1028); + fwrite($fc,$line); + echo "#"; + } + fclose($fc); + if($lastModDate != null) touch($dest,$lastModDate); + echo "
"; + return true; + } +} + +$tempFilesArray = array(); + +function getFileArray($foldername) { + GLOBAL $localDir, $skip_filetype, $tempFilesArray; + + $dirhandle = @opendir($foldername); //öppnar mappen + $temp = 0; + if($dirhandle !== false){ //gick det att öppna mappen? + while($filename = readdir($dirhandle)){ //loopar igenom alla filer i mappen + $filepath = $foldername ."/". $filename; + if($temp>1 && is_dir($filepath)){ //är det en mapp? + getFileArray($filepath); + } + else{ // its a file + $filetype = ereg_replace("^.+\\.([^.]+)$", "\\1", $filename); + if (!in_array($filetype, $skip_filetype)) { + $tempFilesArray[] = array(filemtime($filepath),str_replace($localDir, "", $filepath),("http://".$_SERVER['SERVER_NAME'].str_replace("sync.php","",$_SERVER['SCRIPT_NAME']).$filepath),$filename); + } + } + $temp++; + } + } + return $tempFilesArray; +} + +function searchFile($remoteFile, $localFileList){ + if(isset($localFileList)){ + foreach($localFileList as $key => $localFile){ + if($localFile[1] == $remoteFile[1]){ + return $key; + } + } + } + return -1; +} +?>