programmingsite : code , tutorials and scripts
Navigation

home


ASP
ASP.net
C
C++
C#
PHP
Java
JavaScript
Powershell
VB.net

Visual Basic


Resources
code
tutorials
training

Ads
Products

 

 

Remotely hosted scripts




Remotely hosted scripts

OK you have a set of affiliate links but damn you havesites that do not allow PHP for example free hosts or you wish to create a simple scheme where links or content is displayed on other peoples sites . How do you do this , well with a bit of JavaScript and PHP , no problem.

Our basic script is based heavily on our clickbank script but we have made a few adaptations .

<?php
//change these
$server = "localhost";
$user = "username";
$password = "password";
$database = "database";
$tablename = "links";

//queries , connections to the MySQL database
$connection = mysql_connect("$server","$user","$password");
$db = mysql_select_db("$database",$connection);
//all entries
//$sql = "SELECT * FROM links";
//random entries
$sql = "SELECT * FROM links ORDER BY RAND() LIMIT 3";
$result = mysql_query($sql,$connection);
$numrows = mysql_num_rows($result);

//html output related
$clickbanktxt = "http://hop.clickbank.net/?";
//change the$ partnerid to your own ID
$partnerid = "shedboy/";
$target = "_blank";

while($row = mysql_fetch_array($result))
{
?>

document.write("<a target = '_new' href='<?php echo $clickbanktxt . $partnerid .$row[1]; ?>'><?php echo $row[2]; ?></a>");
document.write("<br>");
<?php
}
mysql_close($connection);
?>

The big change is the lines of JavaScript , we use these to outpur our links on a page . Now all we have to do is place the following line of code on the page where we want the links to appear , note this does not have to be on the same site even. Change the url in your own script.

<script language = "Javascript" src="http://tutorials.programmingsite.co.uk/remoteclick.php"></script>



Here is this in action


Of course here is an example on a plain old HTML page

html page example

try it on your own site





Products
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals
Asp Studio 2005
Xtra PHP
Online PHP Script Encoder
Comparison

Links
Make money selling software
Uk shopping
UK price comparison
US price comparison
free articles
free stuff
Gambling resources
Software directory
XBox cheats and more
Sexy free wallpapers
Hosting resources
Nintendo Wii info
Beginners PHP
Health and fitness
Domain names
Dating site
Nintendo DS resources
Dropshippers
Maxi directory
Perfume and fragrances
PC shopping, tips and info
Magazine superstore

Ads