Jump to content

[PHP]Please Check Script..


arbitter

Recommended Posts

I've got huge issues with this small (probably basic for you guys) script.

<?php
		$dirs = glob('*',GLOB_ONLYDIR|GLOB_NOSORT);
		foreach($dirs as $dir) {
			$sortedDirs[filemtime($dir)] = $dir;
			}
		ksort($sortedDirs);
		foreach (($sortedDirs) as $map)
			{	$qmap = urlencode($map);
				echo "<tr><td colspan='2' bgcolor='white' width='200' align='center' valign='top' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort='\"><center>$map</td></tr>";
			}

		$month = $_GET["month"];
		echo 	"<tr colspan='2' height='*'><td> </td></tr><tr><td colspan='2'><b><center>Sorteren op:</center></b></td></tr>
				<tr valign='bottom'><td bgcolor='white' width='200' align='center' valign='bottom' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort=ksort'\"><center>Oudste</td>
				<td bgcolor='white' width='200' align='center' valign='bottom' style='cursor:pointer;cursor:hand' onclick=\"location.href='?month=$qmap&sort=krsort'\"><center>nieuwste</td></tr>";
		?>

 

 

$sort = $_GET["sort"];
			if (isset($month)){
				$images = glob($month . '/*.{jpg,gif,jpeg,pjpeg,image,JPEG}', GLOB_BRACE|GLOB_NOSORT);
				if (isset($images)){
					foreach ($images as $image)
						{$sortedimages[filemtime($image)] = $image; }
					if ($sort == 'ksort'){
						ksort($sortedimages);
						foreach (($sortedimages) as $afbeelding)
							{ echo "</br><center><img src=\"$afbeelding\" style=\"max-width: 60%\"></br>";}}
					elseif($sort == 'krsort'){
						krsort($sortedimages);
						foreach (($sortedimages) as $afbeelding)
							{ echo "</br><center><img src=\"$afbeelding\" style=\"max-width: 60%\"></br>";}}
					else{echo "&nbsp";}}}

 

 

 

What I want to do, is that there's a whole list, created with foreach(), of months, and if you click on them, the pictures in that map display. Then, you can click on a button to change the sorting of those pictures, that are open at that moment. I can't find anything wrong witht the script, though it doesn't work. Now it doesn't even display the pictures.

Link to comment
https://forums.phpfreaks.com/topic/189324-phpplease-check-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.