commit 20496a4be083d873fc92fd2ba79ec42dee960d5e Author: Ziver Koc Date: Fri Nov 14 16:38:36 2008 +0000 lol 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 0000000..e331546 Binary files /dev/null and b/img/bar-grey.gif differ diff --git a/img/bar-life.gif b/img/bar-life.gif new file mode 100644 index 0000000..828e1df Binary files /dev/null and b/img/bar-life.gif differ diff --git a/img/bar-mana.gif b/img/bar-mana.gif new file mode 100644 index 0000000..6ad75b3 Binary files /dev/null and b/img/bar-mana.gif differ 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; +} +?>