inherit
46674
0
Jan 3, 2006 23:36:02 GMT -8
WildBill
61
June 2005
wildbill
|
Post by WildBill on Jun 24, 2005 0:54:05 GMT -8
How do I use ripway to make this code work? 1. Create a new directory in you public_html named something like "avatars". 2. Create a text file called "avatar.txt". 3. Paste the following into avatar.txt: <?php $dh = opendir("."); while (false !== ($file = readdir($dh))) { if (preg_match('/.(jpg|gif|png)$/i', $file) and $file != "avatar.gif") { $filelist[] = $file; } } srand((double)microtime()*1000000); $picnum = rand(0, sizeof($filelist) - 1); header("Location: " . $filelist[$picnum]); closedir($dh); ?> 4. Create another new text file, this time called ".htaccess". That is the actual file name, not just an extension. In .htaccess, paste the following: <FilesMatch avatar.gif> SetHandler application/x-httpd-php </FilesMatch> 5. Upload avatar.txt and .htaccess to the directory you created. 6. Rename avatar.txt to avatar.gif. 7. Upload images (jpg, gif, png) to your avatars directory. 8. Make sure file permissions for avatar.gif are set to 644 and the avatars folder is set to 755 (not sure if this makes a difference or not). 9. load www.yoursite.com/avatars/avatar.gif
|
|