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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.