#!/usr/bin/php
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
 <head>
  <title>DSemu - Screenshots</title>
  <link rel='stylesheet' type='text/css' href='index.css'>
  <script type='text/javascript' src='tree.js'></script>
 </head>
 <body>
  <div id='outer'>
   <h1>DSemu: The Nintendo DS/GBA emulator</h1>
   <div id='menu'>
    <ul>
     <li><a href='index.cgi'>Home</a></li>
     <li>Download: <a href='dsemu-0.4.9.zip'>Emulator</a>, <a href='dsemu-demos.zip'>Demos</a></li>
     <!--<li><a href='code.html'>Source</a></li>-->
     <li class='cur'>Screenshots</li>
     <li><a href='http://dsemu.1emulation.com/'>Forum</a></li>
     <!--<li><a href='compat.html'>Compatibility</a></li>-->
    </ul>
   </div>
  <div id='ad'>
<script type="text/javascript"><!--
google_ad_client = "pub-2619534444109891";
google_ad_width = '160';
google_ad_height = '600';
google_ad_format = "160x600_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "91AFBD";
google_color_bg = "E8E8F0";
google_color_link = "718F9D";
google_color_url = "000000";
google_color_text = "909090";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  </div>
  <div id='content'>
   <div id='inner'>
    <ul id='shots'>
<?php
$link = mysql_connect("localhost", "two9a", "oopsilon");
mysql_select_db("dsemu");

$query=$_SERVER['QUERY_STRING'];
if($query) $result=mysql_query("select entry,img,hacker,caption from shots where entry<='$query' order by entry desc limit 8");
else $result=mysql_query("select entry,img,hacker,caption from shots order by entry desc limit 8");

//if(!$result) die(mysql_error());

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  $curentry=$row['entry'];
  echo "<li>".$row['caption']." (".$row['hacker'].")<br>\n";
  echo "<img src='/shots/".$row['img'].".png' alt='".$row['caption']."'></li>";
};

$curcount=mysql_num_rows($result);
mysql_free_result($result);

$result=mysql_query("select count(entry) as cnt from shots");
list($count)=mysql_fetch_row($result);
mysql_free_result($result);
mysql_close($link);

$index=$curentry+$curcount-1;
if($count && $index<$count) {
  if(($index+8)<$count)
    echo "<dt><a href='/shots.cgi?".($index+8)."'>Less</a></dt>\n";
  else
    echo "<dt><a href='/shots.cgi'>Less</a></dt>\n";
}
$index=$curentry-1;
if($index>0) echo "<dt><a href='/shots.cgi?$index'>More</a></dt>\n";

?>
    </ul>
   </div>
  </div>
  <div id='foot'>
   Content &copy; Imran Nazar, 2004-5.
  </div>
  </div>
 </body>
</html>
