anycontent - random images anycontent - random images
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

anycontent - random images

Started by JohnM-UK, September 06, 2006, 09:37:24 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

JohnM-UK

I've inserted 'anycontent at the bottom of my main page, and I'm trying to test a banner rotation.

Quote'anycontent': inserts php-generated custom content that YOU have coded into the file 'anycontent.php' and displays the content on the index page. It can be used to include banner-rotation scripts, welcome scripts, or similar. Where it appears in the index page is determined by it's placement in the string example below.

I have this code for random images:

<?php 
header
("Content-Type: image/jpg"); 
$sigs = array(); 

$sigs[] = "http://www.oneuk.f2s.com/images/rand/test1.jpg"
$sigs[] = "http://www.oneuk.f2s.com/images/rand/test2.jpg"
$sigs[] = "http://www.oneuk.f2s.com/images/rand/test3.jpg"

mt_srand((double)microtime()*1000000); 
$sig $sigs[mt_rand(0count($sigs)-1)]; 

readfile($sig); 

?>


How would I insert this code? Somewhere in anycontent.php?...

<?php

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

starttable("100%""Welcome");

?>

<tr><td class="tableb" >
This is for any content block - just a test - Edit the file "anycontent.php" to change what is shown here
</td></tr>
<?php
endtable
();

?>




Nibbler

That code is not designed to be used in this way. It is intended to be called as an image, so call it using an img tag.

JohnM-UK

OK, just one thing I used the original code for the script I got, and it worked:

<?php 
header
("Content-Type: image/jpg"); 
$sigs = array(); 

$sigs[] = "http://uberhost.com/siggy.jpg"
$sigs[] = "http://uberhost.com/mysig.gif"
$sigs[] = "http://freehost.net/somegig.png"
$sigs[] = "http://http://img222.exs.cx/img225/3973/milf324f.jpg"

mt_srand((double)microtime()*1000000); 
$sig $sigs[mt_rand(0count($sigs)-1)]; 

readfile($sig); 

?>


But obviously I don't want them ads on my page.

Sorry if I'm asking a daft question here. "so call it using an img tag". How would I do this?

Just trying something else aswell at the mo.

Nibbler

<img src="whateveryoucalledthatscript.php" alt="banner" />

JohnM-UK

Well I fixed it with a completely different script someone came up with for me  :)

<?php

$banners 
= array(=> 'test1.jpg'=> 'test2.jpg'=> 'test3.jpg');

$random rand(1,3);

$banner "http://www.oneuk.f2s.com/images/rand/" $banners[$random];

echo 
"<p style='text-align: center'><img src='" $banner "' alt='' /></p>";

?>

wfs

Hi,

using John's random image script, how do you link the image when it comes up to another page?
pse help - I don't know enough of PHP to amend the script - I tried but nothing works.

thanks.

wfs

Hi again,

I got it working after trying again,
just use <a href="http://yoursite.com/yourpage.php"> in front of the image or the image block.

thanks.