Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/iiita/
Upload File :
Current File : /var/www/html/mmishra/indem/iiita/gallery.php

<?php
//checklogin($user);
$no = $_REQUEST["no"];
if (!$no) $no = 1;

$fp = fopen ("gallery.inc", "r");
if ($fp) {
        $images = array();
        while (!feof($fp)) {
                $i++;
                $line = fgets ($fp, 1024);
                //$images = explode(",", $line);
                if ($line && $line != "\n") $images[$i] = str_replace("\n", "", $line);
        }
}
$i--;
fclose($fp);
if ($no > $i) $no = 1;

if ($action == 'remove') {
        foreach ($images as $img) {
		if ($img != $fname) $str .= $img . "\n";
        }
       	generate_file("gallery.inc", $str);
}
//srand((double)microtime()*1000000);
//$no = rand(0, $i);
$fname = $images[$no];

if (!$fname) $fname = $images[0];
echo "$fname ($no of $i photos)<center>
<img src='images/$fname' width='90%' height='80%'></img><br>";
$no--;
if ($no > 0) echo "[ <a href='$PHP_SELF?conf=$conf&no=$no'>Prev</a> ]";
$no++; $no++;
if ($no <= $i) echo "[ <a href='$PHP_SELF?conf=$conf&no=$no'>Next</a> ]";
if ($user) {
	echo "<div align='right'>[ <a href='$PHP_SELF?conf=uploads&addto_gallery=yes'>Add</a> ]
	[ <a href='$PHP_SELF?conf=$conf&action=remove&no=$no&fname=$fname'>Remove</a> ]
	</div>";
}
echo "</center>";

?>