Using .htaccess 












Using .htaccess/.htpasswd Password Protection 





Coding Tips 








Uploads and Downloads 



Mail 
see it on this page





Working with Images 


Frequently Requested Website Functionality 
see it on this page

see it on this page
see it on this page
see it on this page











Using PHP 




Website Managment 








Other Tips 









Photo Album
This is a basic photo album script. You see the first photo and then flip through them using the left and right arrow keys.
<?php
// the file name text is used as the description
// the file name cannot contain single quotes or the code will not work
$directory = "./"; // relative path to the directory with the image files
$imageArray = glob($directory.'*.jpg');
$number = count($imageArray)-1;
?>
<script type="text/javascript">
<?php
echo "var images = new Array(";
foreach($imageArray as $file) {
if ($switch) echo ",";
$switch = true;
echo "'".$file."'";
}
echo ");";
echo "albumCount = ".$number.";";
echo "directoryLength = ".strlen($directory).";";
echo "subtractLength = ".strlen($directory)."+4;";
$firstImage = $imageArray[0];
$firstText = substr($imageArray[0],strlen($directory),strlen($imageArray[0])-strlen($directory)-4);
?>
count = 0;
function next() {
count++;
if (count > albumCount) count = 0;
display();
}
function back() {
count--;
if (count < 0) count = albumCount;
display();
}
function display() {
document.getElementById('pic').style.backgroundImage = "url("+images[count]+")";
document.getElementById('picText').innerHTML = images[count].substr(directoryLength,images[count].length-subtractLength);
}
document.onkeyup = KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if (KeyID == 37) back();
if (KeyID == 39) next();
}
</script>
<div id="pic" style="position: relative; margin: 0px auto; text-align: left; width: 600px; height: 400px; border: solid 1px black; background-color: black; background-image: url(<?php echo $firstImage; ?>); background-position: bottom center; background-repeat: no-repeat;">
<div id="picText" style="position: absolute; bottom: 0px; left: 0px; background: black; color: white; font: normal 12px/22px Arial, sans-serif; overflow: hidden; text-indent: 10px; width: 100%; height: 22px; opacity: .6;">
<?php echo $firstText; ?>
</div>
</div>




