What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Random Avatar Cache

PHP Random Avatar Cache
Author: Message:
fluffy_lobster
Veteran Member
*****

Avatar
Posts: -2

Posts: 1391
Reputation: 23
36 / Male / Flag
Joined: Nov 2002
RE: PHP Random Avatar Cache
Try:

code:
<?php
$dir = "imgs"; //The folder where all the images are kept
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
$filesnum = count($files);
srand( (double) microtime()*1000000 );
$randnum = rand(0, $filesnum - 1);
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Location: " . $dir . "/" . $files[$randnum]); //redirects the browser to a random file, allowing it to cache
?>

This post was edited on 03-23-2005 at 11:45 AM by fluffy_lobster.
03-23-2005 11:44 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP Random Avatar Cache - by user27089 on 03-23-2005 at 08:07 AM
RE: PHP Random Avatar Cache - by fluffy_lobster on 03-23-2005 at 11:44 AM
RE: PHP Random Avatar Cache - by .Roy on 03-23-2005 at 11:58 AM
RE: PHP Random Avatar Cache - by -dt- on 03-23-2005 at 12:05 PM
RE: PHP Random Avatar Cache - by .Roy on 03-23-2005 at 12:09 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On