Location: PHPKode > scripts > Banner Rotator with admin panel > banner-rotator-with-admin-panel/chbanner.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org">
<title>Banner rotator Control Panel</title>
<link rel="stylesheet" href="stylecp.css" type="text/css" media=
"screen">
</head>
<body>
	<!-- http://TheAleksandar.com -->

<div id="page">
<div id="header"></div>
<div id="menulinks"><a href="chpass.php">Change password</a>
<a href="chbanner.php">Banner images</a> <a href="chadsense.php">Banner link URLs</a> <a href=
"banneroveral.php">Main page</a></div>

<div id="mainarea">
<div id="contentarea">
<h2>Upload new banner</h2>
<br>
<form method="post" action="chbanner2.php" enctype=
"multipart/form-data">Upload banner:<br>
<input type="file" name="fajlbaner"><br>
<input type="submit" value="Upload"><br></form>
<br>
<br>
<hr>
<h2>Use already uploaded banners</h2>
<br>
<form method="post" action="chbanner3.php">To use picture from
server as <b>banner 1</b> enter its caption here.<br>
(You can copy &amp; paste banner caption from the list below.)<br>
<input type="text" name="fajl2"> <input type="submit" value=
"Use this banner"><br></form>
<br>
<br>
<form method="post" action="chbanner32.php">To use picture from
server as <b>banner 2</b> enter its caption here.<br>
(You can copy &amp; paste banner caption from the list below.)<br>
<input type="text" name="fajl22"> <input type="submit" value=
"Use this banner"><br></form>
<br>
<br>
<form method="post" action="chbanner33.php">To use picture from
server as <b>banner 3</b> enter its caption here.<br>
(You can copy &amp; paste banner caption from the list below.)<br>
<input type="text" name="fajl23"> <input type="submit" value=
"Use this banner"><br></form>

<br>
<br>





<hr>
<h2>Delete banner</h2>
<br>
<form method="post" action="chbanner4.php">To delete banner from
server enter its caption here.<br>
(You can copy &amp; paste banner caption from the list below.)<br>
<input type="text" name="fajl3"> <input type="submit" value=
"Delete this banner"><br></form>
<hr>
<h2>Banners on server</h2>
<?php
function dirList ($directory) 
{

    // create an array to hold directory list
    $results = array();

    // create a handler for the directory
    $handler = opendir($directory);

    // keep going until all files in directory have been read
    while ($file = readdir($handler)) {

        // if $file isn't this directory or its parent, 
        // add it to the results array
        if ($file != '.' && $file != '..')
            $results[] = $file;
    }

    // tidy up: close the handler
    closedir($handler);

    // done!
    return $results;

}




$lista=dirList("./banners");



echo "<table>";
echo "<tr>";
for ($i=0; $i<count($lista); $i++)
{
$imeoveslike=$lista[$i];

if (($i % 4)==0){
echo "</tr>";
echo "<tr>";
}
echo "<td>";
echo '<img src="./banners/'.$lista[$i].' " width=200> <br>';
echo "Caption: ".$lista[$i]."<br>";
echo "</td>";
}

echo "</tr>";
echo "</table>";

                



?></div>
</div>
<div id="footer">
<p align="center"><a href="#">Go to top of the page</a></p>

</div>
</div>
</body>
</html>
Return current item: Banner Rotator with admin panel