Advanced search  

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]

Pages: [1]   Go Down

Author Topic: anycontent - random images  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

JohnM-UK

  • Guest
anycontent - random images
« on: September 06, 2006, 09:37:24 pm »

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:

Code: [Select]
<?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?...

Code: [Select]
<?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
();

?>


« Last Edit: September 07, 2006, 12:07:43 am by Nibbler »
Logged

Nibbler

  • Guest
Re: anycontent - random images
« Reply #1 on: September 06, 2006, 09:40:24 pm »

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.
Logged

JohnM-UK

  • Guest
Re: anycontent - random images
« Reply #2 on: September 06, 2006, 10:10:38 pm »

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

Code: [Select]
<?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.
Logged

Nibbler

  • Guest
Re: anycontent - random images
« Reply #3 on: September 06, 2006, 10:21:40 pm »

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

JohnM-UK

  • Guest
Re: anycontent - random images
« Reply #4 on: September 07, 2006, 12:06:22 am »

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

Code: [Select]
<?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>";

?>
Logged

wfs

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 95
Re: anycontent - random images
« Reply #5 on: October 17, 2006, 08:12:28 am »

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.
Logged

wfs

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 95
Re: anycontent - random images
« Reply #6 on: October 17, 2006, 08:15:34 am »

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.