Using .htaccess 












Using .htaccess/.htpasswd Password Protection 


php5
php5
Coding Tips 






Uploads and Downloads 

php5
php5
php5
Mail 



php5


Working with Images 


Frequently Requested Website Functionality 
php5
php5

php5 see it on this page
php5








Using PHP 
php5
php5
php5


Website Managment 







php5

php5
Other Tips 







Auto Password Change and Email Notification
This script will change your .htpasswd password to a new random password (with encryption) and send an email to notify you of the change. You can run this script automatically using cron at what ever interval you like, or run it manually.
<?php
$filename = "/www/X/XXXXXX/.htpasswd"; // the location of your .htpasswd file
$username = "XXXXXXX"; // the username specified in the .htaccess file
$length = "10"; // length of the password
$emailaddress = "you@yourdomain.com"; // email address
// change nothing below this line
// generate password
$spec_charset = array("!","@","#","$","%","^","&","*","_","+"."?","=");
$chars = array();
unset($pass);
for ($i = 1; $i <= $length; $i++) {
for ($i = 48; $i <= 57; $i++) { $chars[] = chr($i); } // numbers
for ($i = 65; $i <= 90; $i++) { $chars[] = chr($i); } // upper
for ($i = 97; $i <= 122; $i++) { $chars[] = chr($i); } // lower
foreach ($spec_charset as $i) { $chars[] = $i; } // special
for ($i = 1; $i <= $length; $i++) { $pass .= $chars[rand(0, count($chars)-1)]; }
}
// build & write .htpasswd file
$encrypted = crypt($pass);
$output = "$username:$encrypted\n";
file_put_contents($filename,$output);
// notify
$message = "Your password has been changed to $pass\n";
mail($emailaddress, "Password Notification" , $message, "From: Website <>");
?>