Jump to content

rtswimmer

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rtswimmer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ive got an array of files, which are used to create thumbnails. I only want 12 thumbnails on each page so ive done this: [code]  $default_dir = "./products/corporate_signs/gallery/images";     $height = 50;     $x = 0;        $no = 0;  //counts number of files     $fpp = 12; // files per page     $thumb = array();                         if(!($dp = opendir($default_dir))) die("Cannot open $dir");     while($file = readdir($dp)) {         if($file != '.' && $file != '..' && stristr($file,"jpg")){ $thumbs[$no] = $file; $no++;    }     }closedir($dp);     $pages = ceil($no / $fpp); // Sets Page numbers             echo"<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";             switch($id){                 case"1" :                     for($i=0; $i<12; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=1&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"2" :                     for($i=12; $i<24; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=2&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"3" :                     for($i=24; $i<36; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=3&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"4" :                     for($i=36; $i<48; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=4&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"5" :                     for($i=48; $i<60; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=5&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"6" :                     for($i=60; $i<72; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=6&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"7" :                     for($i=72; $i<84; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=6&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 case"8" :                     for($i=84; $i<96; $i++){                         if ($x == 0) { echo"\t<tr>\n"; }    $x++;                         if ($i < $no){ echo"\t\t<td height=\"$height\"><a href=\"?id=6&?pic=$i\"><img src=\"./gen.php?$default_dir/$thumbs[$i]\" border=\"0\"></a></td>\n";}                                if ($x == 3){ echo"\t</tr>\n"; $x = 0; }                     }break;                 default :                     header("Location: find.php?id=1");             }echo"</table>";             for($i=1; $i<=$pages; $i++){ echo"<a href=\"find.php?id=$i\">$i<a>"; }//Outputs Page Links [/code] (I know its not very tidy or efficient) But as you can see im only limited to having 96 images, unless i add more case statements. Also i need help on the main images.. when i click the thumbnail i want the full image shown on the page next to the list of thumbnails. I cant seem to get it to work tho [code] switch($pic){         case"1" :             echo "<img src=\"$default_dir/$thumbs[1]\" border=\"0\">"; break;         case"2" :                echo "<img src=\"$default_dir/$thumbs[2]\" border=\"0\">"; break;         default :             echo "Default"; [/code] Like before tho i need the case statement to be dynamic so it doesnt matter how many images there are. Hope that makes sence. Can anyone help me? Cheers RTSwimmer
  2. How can you change the date and time to GMT 0 (London, England) This is what i have but its 6 hours behind (obviously defaults to US time) [code]date("l, F j, Y H:i:s");[/code] Result: Wednesday, March 22, 2006 22:27:27 Ive looked on [a href=\"http://us3.php.net/date\" target=\"_blank\"]here[/a] but i dont understand how to use the 'z' format character Examples would be a great help Cheers - RTSwimmer
  3. Basicaly... Ive got a login form that links to a seperate page which checks the info and redirects to either the members area or an error page. So i want to stop access to the members area if the url is typed in, however allow it if the password is correct. (Does that make sence?) Ive tried to use $_SERVER['HTTP_REFERER']; but because im redirecting from a seperate page the referer is empty and doesnt work. Anyone got any ideas ? Cheers RTSwimmer
×
×
  • 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.