Page 2 of 2

Posted: Tue Nov 04, 2003 3:42 pm
by JAM
LiLpunkSkateR wrote:so why not just have the person using your advertising service go:

Code: Select all

<?PHP include ("http://www.example.com/script.php?id=4858") ?>
and on script.php have something that randomly picks and displays it using the correct tags

Code: Select all

<?PHP 
display[0] = <img src="http://www.example.com/pic.gif">;
display[1] = <img src="http://www.example.com/pic2.jpg">;
display[2] = <flash tags = "http://www.example.com/flash.swf">;
display[3] = <a href="http://www.example.com/redirect.php?link=39">;

echo $display[random];
?>

sorry if im totally off base, but this is my first time trying something like this and it seems like it should work..
Had to mention it, that yes, this works, so you are very right. I was blindly refering to the way I'm used to it. Worth looking more into and commenting if I missed something.

http://phpdn.jam.nu/IncludeAdvertFile/

Posted: Wed Nov 05, 2003 7:40 am
by kendall
JAM,

Well i think my way out of this would be to

include(adfile.php)
// get random file from databse
// determine what kind of file it is (either html, gif, jpeg or swf)
header(Content Tye: $type) based on type conditions
and echo $file

what if i readfile() how does that handle it?

will let you know how its progressing

Kendall[/php_man]

Posted: Wed Nov 05, 2003 8:57 am
by JAM
Well, readfile is designed for passing on files, echo for strings. I'd use the functions for what it's intended for.

Posted: Wed Nov 05, 2003 9:33 am
by kendall
JAM,

well i got this to work

Code: Select all

$file_type = strstr($file,'.');
if($file_type == '.gif' || $file_type == '.jpg'){
	echo '<a href="ad_system.php?ID='.$id.'"><img src="'.LINK.$file.'" border="0"></a>';
}elseif($file_type == '.html' || $file_type == '.htm'){
	readfile($DOCUMENT_ROOT.'/images/advertisements/'.$file,1);
}elseif($file_type == '.swf'){
	header('Content-Type: application/x-shockwave-flash');
	readfile($DOCUMENT_ROOT.'/images/advertisements/'.$file,1);
}
needs some cleaning but i'll get to dat
but the flash part does quite work...how are you suppose to do it?

Kendall