PDA

View Full Version : Help with a php insert


xwing777
01-16-2003, 02:00 AM
Ok tried everything i found via searching many sites but havent got anything to work. I have this ad rotator (whick works great when clicked directly-->ad.php3 (http://headhurt.com/phpbb/ads/ad.php3) ) but if i try to add it to the overall header (on a phpbb forum) it does nothing (i currently have it in an IFRAME..ugh!) I would greatly appreciate if anyone could show how to use this without IFRAMES as they are aweful for many reasons. Here the actual php file im using and it need to be called up to show the inc files which are really HTML files with the ad code:
<?
srand ((double) microtime() * 1000000);


$randomnumber = rand(0,14);
$include0 = "0.inc";
$include1 = "1.inc";
$include2 = "2.inc";
$include3 = "3.inc";
$include4 = "4.inc";
$include5 = "5.inc";
$include6 = "6.inc";
$include7 = "7.inc";
$include8 = "8.inc";
$include9 = "9.inc";
$include10 = "10.inc";
$include11 = "11.inc";
$include12 = "12.inc";
$include10 = "13.inc";
$include11 = "14.inc";
$include12 = "15.inc";

if ($randomnumber== "0") {
include ("$include0");

} else if ($randomnumber== "1") {
include("$include1");

} else if ($randomnumber== "2") {
include("$include2");

} else if ($randomnumber== "3") {
include("$include3");

} else if ($randomnumber== "4") {
include("$include4");

} else if ($randomnumber== "5") {
include("$include5");

} else if ($randomnumber== "6") {
include("$include6");

} else if ($randomnumber== "7") {
include("$include7");

} else if ($randomnumber== "8") {
include("$include8");

} else if ($randomnumber== "9") {
include("$include9");

} else if ($randomnumber== "10") {
include("$include10");

} else if ($randomnumber== "11") {
include("$include11");

} else if ($randomnumber== "12") {
include("$include12");

} else if ($randomnumber== "13") {
include("$include10");

} else if ($randomnumber== "14") {
include("$include11");

} else if ($randomnumber== "15") {
include("$include12");

} else {

echo ("ERROR: A random num is being generated out of range, or not at all ");
}
?>

Jeewhizz
01-16-2003, 02:11 AM
You'll have to type it directly into the phpbb header for it to be parsed.... and here's a shorter version of your code :)



srand ((double) microtime() * 1000000);
$randomnumber = rand(0,14);
include($randomnumber.".inc");



Jee :)

xwing777
01-16-2003, 02:25 AM
Ok, thanks for the quick response. I have a index.php file in the phpbb root directory and in the theme directory i have overall_header.tpl.
Where do i put this at and how do i get it to show in the tpl file (that doesnt work with php but only html type code)?