Location: PHPKode > scripts > OekakiPoteto > oekakipoteto/compress.php
<?
include('config.php');
include('dbconn.php');
include('flagchk.php');
$result = mysql_query("SELECT usrname,usrpass, usrflags FROM ".$OekakiPoteto_MemberPrefix."oekaki WHERE usrname='$OekakiU'");
$row = mysql_fetch_array($result);
$usrflags = $row[usrflags];
if($OekakiPass != $row[usrpass]){
header('index.php');
exit;
}
if (!check_flag('O')) {
	header('Location: error.php?error='.urlencode("You do not have the credentials to access the control panel."));
exit;
}
mysql_close($dbconn);
if($lock != "1"){
		$handle = opendir($OPpics);
		$i = 0;
		while ($file = readdir($handle)) 
		{
			if(substr($file,-4) == ".png"){
               			$files[$i] = substr($file,0,-4);
				$i++;
			}

		}
		closedir($handle);
		header('Location: compress.php?lock=1&current=0&max='.$i);
		exit;
}
		
		@set_time_limit(3600);

		$limit = $current + 200;
		if($limit > $max){
			$limit = $max;
		}

		if($current == $max){
			header('Location: index.php');
			exit;
		}

		$i = 0;

		$handle = opendir($OPpics);
		while ($file = readdir($handle)) 
		{
			if(substr($file,-4) == ".png"){
               			$files[$i] = substr($file,0,-4);
				$i++;
			}

		}
		closedir($handle);

		while($current < $limit){
			$image_filename = $OPpics.'/'.$files[$current].".png";
			$image_filenamejpg = $OPpics.'/'.$files[$current].".jpg";
			@$img = imagecreatefrompng($image_filename);
			@imagejpeg($img,$image_filenamejpg, $jpgcompressqual);
			$current++;
		}
				
		header('Location: compress.php?lock=1&current='.$current.'&max='.$max);
		exit;
	
?>
Return current item: OekakiPoteto