Hamid <?php include("/images/randomimages/$image"); ?>
works fine - all the code works OK - apart from the seed issue. A *********************************** Angela K Hilton Web & E-Learning Officer ISD, UMIST Tel: 0161 306 3109 *********************************** -----Original Message----- From: Hamid Hossain [mailto:[EMAIL PROTECTED] Sent: 13 February 2004 10:45 To: [EMAIL PROTECTED] Subject: RE: [PHP] mt_strand Hi Angela, I don't understand why you are using the following line: <?php include("/images/randomimages/$image"); ?> You have to use somthing like: <img src="/images/randomimages/<?= $image ?>"> The other part of your code looks fine to me. Regards, Hamid ----------------------- Check Amazon.com's Latest PHP books: http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/ browse/-/295223 Start Accepting CreditCard at your site in minutes: http://www.2checkout.com/cgi-bin/aff.2c?affid=106720 Download Alexa Tool Bar to stop Pop-ups for FREE: http://download.alexa.com/?amzn_id=zawraqclassif-20 Download Ready-Made Templates for your site: http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad ----------------------- ----Original Message Follows---- From: "Angela K Hilton" <[EMAIL PROTECTED]> To: "PHP-General" <[EMAIL PROTECTED]> Subject: [PHP] mt_strand Date: Fri, 13 Feb 2004 10:37:47 -0000 Hi All I could do with some pointers in using mt_strand. I understand that because my server has <PHP4.2.0 random number generators need to be seeded using mt_strand or mt_rand. I have the following code [created with the help of this list]: <?php $imgdir = /images/randomimages/"; if ($handle = opendir($imgdir)) { while (false !==($file = readdir($handle))) { if ($file != "." && $file != "..") { $random[] = $file; } } closedir($handle); } $image = $random[mt_rand(0, count($random)-1)]; ?> <?php include("/images/randomimages/$image"); ?> and have found the following in the PHP manual: <?php // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } mt_srand(make_seed()); $randval = mt_rand(); ?> However - I'm not 100% sure how to incorporate it into my code - I have tried a few things but each time I break the code. Any help will be appreciated. Thanks Ange *********************************** Angela K Hilton Web & E-Learning Officer ISD, UMIST Tel: 0161 306 3109 *********************************** _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php