[PHPLIB] phplib-generated-tracked javascript banners From: Giancarlo Pinerolo (ping <email protected>)
Date: 01/30/00

Hi,
I am playing with this:

have a remote page that includes a piece of JAvascript dynamically
generated by php-phplib.

In practice I wanted to try a remote banner server that can easily
be included from anywhere with

<script src="http://mybanner-server.com/JSbanner.php">
</script>

This way the ad can be included from anywhere without needing to have
php installed there.

I found yahoo and IBM use this method

The Javascript is somehow dinamically generated, and a cookie is left by
phplib running on the banner server.

It would be nice to have some JS helper class that, for example, takes a
file, chops newlines and backslashes quotes and output the appropriate
'document.writes' for it.

The 2 files

1) including page (this can be anywhere, even on local filesystem)
-----------------------------------------------------------------

</html>
<center>
<h1>remote JS-php adserver/tracker</h1>
<script src="http://mybanner-server.com/JSbanner.php"></script>
</center>
</html>

2) included phplib script: (JSbanner.php on mybanner-server.com
------------------------------------------------

                          
<%
// a cookie is released/accessible by phplib
// on mybanner-server.com domain

include("prepend.php3");
page_open(array("sess" => "Example_Session"));
$sess->register("JSAD_bag");

if (!$JSAD_bag) $JSAD_bag=0;

$JSAD_bag++;

page_close()
%>

// here starts the Javascript
document.write('<table border=1 width=400 bgcolor=\"#fecada\">');
document.write('<td><center><h4>Hi, I am now showing off on page <%=
$GLOBALS[REMOTE_ADDR] %><br>');
document.write(' nice to find you have already seen<br>');
document.write('<%=$JSAD_bag%> ads serverd from me: <%=$HTTP_HOST%>');
<% if(JSAD_bag == 10)
        {
        %>
        document.write('<br>on the 10th time you got a <b>bonus!</b>');
        <%
        }
        %>
document.write('</table></h4></center>');

Giancarlo
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.