Free web development scripts for the webmasterDevelopment Scripts


 social media marketing services
 Site Navigation
Clicky Web Analytics
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 1 user online
 o Most users online: 67
 o Home
  o PHP
   o Random
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Paper Free Invoicing
 o Tutorials
 o Expired Domain Crawler
 o PFB
 o PFB UK
 o OxyScripts

Random Signatures/Avatars (Rated 5)

Description:

This will pick a random image (GIF) from a directory, and display it to the browser.
Its good for having a rolling signature that changes each time you load up the page.
In vBulletin you could call it like this
[IMG]http://www.yourserver/signature.php[/IMG]
Where you called the file below signature.php

Code starts here


<?php
Header
("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Pragma: no-cache");
Header("Content-Type: image/gif");
// Header info, forces no cache and image type of GIF

$dir = "sigs" ; // Define the subdirectory to where we store the images..

srand((double)microtime()*1000000); // Set a random seed up
$i = 0; // Set our counter to 0
$dirHandle = opendir($dir); // Open the images directory
while(($im = readdir($dirHandle))) // Read in image filenames
{
if(
$im != ".." && $im != ".") // Don't read in the 2 directories ".." and "."
{
$image[$i] = $im; // Add that image filename to the array
$i++; // Increment our counter
}
}
closedir($dirHandle); // Close the directory handle
$n = rand(0,(count($image)-1)); // Create a random number from 0 to the size of the array

if(!readfile($dir."/".$image[$n])) // Read in a file and output it to the output buffer..
readfile($dir."error/error.gif"); // If we can't for some reason use the error.gif file in the error directory
?>


Submitted by Devscripts on 13-02-2003 23:34


Recent Additions (from all categories)

(PHP) T Shirt Printing Software

(PHP) Youtube Video Organizer Script

(PHP) MP3z - MP3 Search Engine Script

(PHP) Recipez- PHP Recipe Script

(ASP) Stop image hotlinking and downloading. Web image protection is easy with Image Trapper.

Top Rated Scripts

(Javascripts) Javascript Delayed Redirection Rating: 5

(PHP) Random Links and images with PHP & MySQL Rating: 5

(PHP) RSS/XML news feed headline grabber! Rating: 5

(PHP) Random Signatures/Avatars Rating: 5

(Javascripts) Detecting Client Web Browser Rating: 5

© Copyright 2003 - Devscripts.net  Web Analytics