<html> 
<head> 
<title>Bildegalleri</title>
<link type="text/css" rel="stylesheet" title="Default" href="../styles/main.css" /> 
</head> 
<body> 
<script type="text/javascript" language="JavaScript">
<!--
function op(hvem, side)
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(side + '?id='+ hvem, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=400');");
}
//-->
</script>
<div align="center"> 
<? 
extract($_GET);
//---------------------------------------------------------------------------------------- 
//Versjon 3.0 
//Skrevet av Sindre Mathisen 
//---------------------------------------------------------------------------------------- 
class Paging { 
    var $x; 
    var $display = 6; //antall poster per side
    var $height = "100px";
    var $width = "100px";
    var $per_linje = 3; //Hvor mange som skal være per linje
    var $XX = '<br>Ingen resultater funnet<br>'; 
    var $counter, $number, $pages, $i, $query2,$query, $result2, $result, $num_record; 
    function DoPaging($startrow, $prevrow, $nextrow) { 
    $global_db = mysql_connect('localhost', 'brukernavn', 'passord'); 
    mysql_select_db('sindrem', $global_db); 
    $this->Query = "SELECT * from tbl_bilde"; 
    $this->result = mysql_query($this->Query); 
    $this->num_record = mysql_num_rows($this->result); 
    if (empty($startrow)) { 
        $startrow=0; 
    } 
    $this->Query2 = "SELECT * from tbl_bilde ORDER BY ID DESC LIMIT $startrow, $this->display"; 
    $this->result2 = mysql_query($this->Query2); 
    $this->counter = 0; 
    $this->number = mysql_num_rows($this->result2); 
    $this->i = 0; 
    $teller = 0; 
    if ($this->number == 0) : 
        print("<br><center><P><b>Det er mest sannsynlig ingen poster registrert i denne kategorien.</b></p></center>"); 
    elseif ($this->number > 0) : 
     print "<table border=\"0\" class=\"nyheter\" width=\"100%\">";      
       while ($this->i < $this->number): 
         $id = mysql_result($this->result2,$this->i,"id"); 
         
         if($teller == $this->per_linje)
         {
             print "<tr>";
         }
         
         print "\n\n<td><a href=\"#\" onclick=\"op($id,'se.php');\"><img border=\"0\" height=\"$this->height\" width=\"$this->width\" src=\"vis_bilde.php?id=$id\"></a></td>";
         if($teller == $this->per_linje)
         {
             print "</tr>";
                        $teller = 0;
         }
        $teller ++;
        $this->i++; 
       endwhile; 
     print "</table>"; 
    endif; 
    if ($startrow != 0) { 
    $prevrow = $startrow - $this->display; 
    print("<a href=\"$PHP_SELF?startrow=$prevrow&id=$id\">Forrige</a>\n");
    } 
    $this->pages = intval($this->num_record / $this->display); 
    if ($this->num_record % $this->display) { 
        $this->pages++; 
    } 
    if ($this->pages > 1) { 
        for ($i=1; $i <= $this->pages; $i++) { 
            $nextrow = $this->display * ($i - 1); 
            if(!$this->number == 0) 
            { 
            print("<a href=\"$PHP_SELF?startrow=$nextrow&id=$id\">$i</a>\n  "); 
        } 
        } 
    } 
    if (!(($startrow / $this->display) == $this->pages - 1) && $this->pages != 1) 
    { 
        if(!$this->number == 0) 
        { 
            $nextrow = $startrow + $this->display; 
            print("<a href=\"$PHP_SELF?startrow=$nextrow&ID=$id\">Neste</a>\n");
        } 
    } 
    if ($this->num_record < 1) { 
        print("$this->XX"); 
    } 
  } 
} 
$p_obj =& new Paging; 
$p_obj->DoPaging(&$startrow,&$prevrow,&$nextrow); 
?> 
</center> 
</body> 
</html>