开发者

How to make a banner code in javascript and php [closed]

开发者 https://www.devze.com 2023-01-12 05:17 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Example client put this on their website

<script type="text/javascript" src="http://domain.com/banner.php?bid=123&affid=88"></script>

In my banner.php how do I implement it?

I try to get the banner id & affid using $_GET but it's not working..

Let me know the clue how to display the banner on my client site using this way.

my banner.php

<?php
define('X', true);
include_once('includes/connection.php');

$banner_id = intval($_GET['bid']);
$aff_id = intval($_GET['affid']);

$select = 'SELECT images FROM affbanners WHERE id='.$banner_id;
$query  = $db->rq($select);
$display = $db->fetch($query);

?> 

 <a href="http://domain.com/aff?id=<?php echo $aff_id; ?>"><img src="http://domain.com/images/<?php echo $display['images']; ?>" height="250" width="250" /></a>

I dunno how to make it work actual开发者_开发技巧ly.


What you have done is:

<script type="text/javascript" src="http://domain.com/banner.php?bid=123&affid=88"></script>

So the script at banner.php should send a javascript: so enclose your output in `document.write method i.e.

document.write('<a href="http://domain.com/aff?id=<?php echo $aff_id; ?>"><img src="http://domain.com/images/<?php echo $display["image"]; ?>" height="250" width="250" /></a>');

and send and set the header in php like:

header("Content-type: text/javascript"); 


<?php echo $display['image']; ?>

Should be

<?php echo $display['images']; ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消