Include file

PythonPython Forum LeaderThe Royal RAM
I have a script called show.php and when called like show.php?id=15 then a number from a database is shown...

Ok what I want to do is have a piece of javascript which users can copy and paste and put onto their sites... The when their page is visited it sort of inserts this show.php?id=15 script into the page so it shows the number on their site...

Anyone know how?

Thans

The Royal Ram

Comments

  • ChroderChroder Senior Member The Royal RAM
    Just make PHP output some javascript that will write the number.

    [php]<?php
    //...get num from database, assume its in $num

    echo 'document.write("' . $num . '");';

    ?>[/php]

    Then the code snippet you tell them:
    [html]<script type="text/javascript" src="http://yourserver.com/show.php?id=15"></script>[/html]
  • PythonPython Forum Leader The Royal RAM
    ok thanks :)

    The Royal Ram

  • spotbb.comspotbb.com Beginner Link Clerk
    Would this also work if I wanted to include HTML???

    I have this, and would like to put this in phpadsnew on members forums but it isnt working:

    [PHP]<?
    include("CONFIG FILE");
    ?>
    <link href="http://www.thespothq.com/adcode.css"; rel="stylesheet" type="text/css">
    <table width="728" border="0" cellpadding="0" cellspacing="1" bgcolor="#003371">
    <tr>
    <td height="18" align="center" bgcolor="#003371" class="whitetableheads"><div align="center">Bored? Play Games Online Now at TheSpotHQ.com</div></td>
    </tr>
    <tr>
    <td align="center" bgcolor="#FFFFFF"><table border="0" cellpadding="2" cellspacing="2">
    <?php
    // catlist query
    $make2 = mysql_query("SELECT * FROM **REMOVED** ORDER BY RAND() LIMIT 5")
    or die(mysql_error()); ?>
    <?php $i=1; while($randg = mysql_fetch_array($make2)) {
    if($i == 1) echo "<tr>\n"; ?>
    <td width="130" valign="top" bgcolor="#003371"><table width="130" height="96" border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
    <tr>
    <td height="94" valign="top"><table width="125" height="92" border="0" cellpadding="0" cellspacing="1">
    <tr>
    <td height="28" align="center" background="http://www.thespothq.com/images/tbbac.gif"; class="whitetableheads"><div align="center">
    <span class="indexwhitehead"><a href="http://www.thespothq.com/playnow.php?gameid=<?= $randg;?>" class="indexwhitehead">
    <?= $randg;?>
    </a></span></div></td>
    </tr>
    <tr>
    <td height="61" align="center"><? $gamid = $randg;
    $thumbs = mysql_query("SELECT * FROM `thumbnails` WHERE `gameid` = '$gamid'");
    $thumb = mysql_fetch_array($thumbs);
    ?>
    <a href="http://www.thespothq.com/playnow.php?gameid=<?= $randg;?>" class="playnowlink"><img src="http://www.thespothq.com/thumbs/<?= $thumb; ?>" width="70" height="57" border="0"/></a></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    <?php $i++; if($i == 6) { echo "</tr>\n"; $i=1; } } ?>
    </table></td>
    </tr>
    </table>
    [/PHP]
    Free Forum Hosting www.spotbb.com
    Bored?? Play Games www.thespothq.com
Sign In or Register to comment.