Some PHP Help - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Some PHP Help (/showthread.php?tid=53276) Some PHP Help by Val on 11-25-2005 at 03:49 AM
Hey guys im a total php newbie so im wondering how to make a script for random images in a dir. Like some people have in the avatars (i.e Chromy ) i thinks its easy to make so if someone could please give me kinda tutorial so i can do it myslef and no bother anyone. RE: Some PHP Help by Ash_ on 11-25-2005 at 03:52 AM
use scan dir to scan for all gif files. (scandir and substr). then load them all into an array get a random namber thats not bigger then count($array); and use that image. RE: Some PHP Help by Val on 11-25-2005 at 03:56 AM
quote:www.php.bet? i think its .net anyways i have no clue what you just said after all im a total php newbie RE: Some PHP Help by Ash_ on 11-25-2005 at 04:07 AM
quote: lol, you aint gonna learn if i give you the code are you? code:that code gets and displays all contents of a folder. code:prints f. so you could go. code:now all the images in the folder are in the $images array. now we get a random number. code:all code. code: its not the cleanest way to write it but i should work (not at home at the moment) [/code] RE: Some PHP Help by Val on 11-25-2005 at 04:14 AM thank you, but i should save it as a .php file right? RE: Some PHP Help by Ash_ on 11-25-2005 at 04:15 AM yup. RE: Some PHP Help by Val on 11-25-2005 at 04:24 AM
quote: hmm.... whenever i try to do this i get this error: --------------------------------------- Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@valspy.louhabs.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. ----------------------------------- or this one ----------------------------------- Fatal error: Call to undefined function: scandir() in /home2/louhabs/public_html/valspy/images/random.php on line 3 ----------------------------------- do you know how to solve this? RE: Some PHP Help by Ash_ on 11-25-2005 at 04:27 AM
what version of php are you running. code: RE: Some PHP Help by Val on 11-25-2005 at 04:35 AM
quote:well i know how to do that, ive made one a while ago here it is: http://valspy.louhabs.com/php.php version 4.3.10 EDIT: verstion to version, I hate you Lou! RE: Some PHP Help by Mike on 11-25-2005 at 12:57 PM I think scandir(); works only for PHP 5... RE: Some PHP Help by -dt- on 11-25-2005 at 02:17 PM
quote:Thats correct. in php4 you could use this function insted code:</code> |