FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Two Scripts that I need!





assex
Hi,
I need two scripts which I'm not getting...
First of all, isn't there some way to display the date using PHP? I really need some help regarding that:
HOW DO YOU YOU DISPLAY A DATE LIKE THIS:
Friday, March 17, 2006

Secondly, how do you use PHP to display one out of 50+ random images in such a way that if someone clicked on those images, a new pop-up window would appear. For example, I have 50 web pages on my Web Site and I want to randomly display a link to any one of them and make that page pop-up in a new window as soon as somebody clicks it. PLEASE HELP ME HERE!!!!!

Thanks a lot.....
AftershockVibe
The date part is easy...

Code:
date('l, F j, Y');

More info for dates can be found here;
http://uk.php.net/date

The second part is a lot trickier. What you'll need to do is number all your images somehow - an array or database or by filename. Filename is the easiest so you'll have pic1.jpg, pic2.jpg etc

Then generate a random number between 1 and [whatever] using PHP's rand() function.

The following will display 1 random picture from 50
Code:

$ImageNo = rand(1, 50);

echo '<img src="pic' . $ImageNo . '.jpg" />';


Modify as appropriate, hope this helps!
assex
Thanks a lot for your help AftershockVibe but I have a request. Could you give me an example of one entire page like this? Not 50 images because that's a bit too much but 10 images, say pic1.jpg, pic2.jpg and so on....
Can you show me the filename thing in one web page? Could you send me that Web Page somehow? Help would be appreciated. In fact, if I really, really like your help, I may give you some FRI$. How many do you want?
PLEASE HELP ME!!!!
carstentje
assex wrote:
Hi,
I need two scripts which I'm not getting...
First of all, isn't there some way to display the date using PHP? I really need some help regarding that:
HOW DO YOU YOU DISPLAY A DATE LIKE THIS:
Friday, March 17, 2006

Secondly, how do you use PHP to display one out of 50+ random images in such a way that if someone clicked on those images, a new pop-up window would appear. For example, I have 50 web pages on my Web Site and I want to randomly display a link to any one of them and make that page pop-up in a new window as soon as somebody clicks it. PLEASE HELP ME HERE!!!!!

Thanks a lot.....


if you look @ www.pixeltolife.com and then go to PHP it's very easy to get an script with random images,
you can give the images an link so if you would click on it, it automatic goes to that directory/link
Matte52
You can find scripts that work without no problems on: ttp://www.hotscripts.com
NG
there is a new image showing script but it displays only 10 images but if you want it please pm me Smile
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.