header information

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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/
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post 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]
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Well, readfile is designed for passing on files, echo for strings. I'd use the functions for what it's intended for.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post 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
Post Reply