<?php

 

// # THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION.

// # PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED.

 

// # MODIFY THE VARIABLES BELOW:

// # Enter your user key below (provided to you by linknami.com):

$UserKey = "25925:1999";

 

// # The following variable defines how many columns are used to display categories

$CategoryColumns = "3";

 

// # The following variable defines how many links to display per page

$LinksPerPage = "25";

 

// # The following variable defines whether links are opened in a new window

// # (1 = Yes, 0 = No)

$OpenInNewWindow = "1";

 

// # The following variable determines whether the search function is enabled

// # for your links page (1 = Yes, 0 = No)

$AllowSearch = "0";

 

// # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE!

// ----------------------------------------------

$ThisPage = $_SERVER["PHP_SELF"];

$HOST = $_SERVER["HTTP_HOST"];

 

// # NOTICE!!!!!

// # If your links page states "Script Name Undefined." when you run this,

// # your web host is probably running an older version of PHP.  To correct

// # this problem, remove the two forward slashes from the line below:

// $ThisPage = $PHP_SELF

 

$PostingString = "UserKey=" .$UserKey . "\r\n";

$PostingString .= "&ScriptName=" .$ThisPage . "\r\n";

$PostingString .= "&CatCols=" .$CategoryColumns . "\r\n";

$PostingString .= "&LinksPerPage=" .$LinksPerPage . "\r\n";

$PostingString .= "&OpenInNewWindow=" .$OpenInNewWindow . "\r\n";

$PostingString .= "&AllowSearch=" .$AllowSearch;

$PostingString .= "&ThisPage=" .urlencode($ThisPage);

$PostingString .= "&HOST=" .urlencode($HOST);

$PostingString .= "&ran_code=PHtUxemto6v5UmdGZAgE";

 

$QueryString = "script=php";

foreach ($_GET as $key => $value) {

        $value = urlencode(stripslashes($value));

        $QueryString .= "&$key=$value";

}

 

// congfigure our headers

$header = "POST http://www.linknami.com/autolink_gen.php?" . $QueryString . " HTTP/1.0\r\n";

$header .= "Content-Type: application/x-www-form-urlencoded\r\n";

$header .= "Content-Length: " . strlen($PostingString) . "\r\n\r\n";

 

// open a connection to Linknami

$fp = fsockopen ('www.linknami.com', 80, $errno, $errstr, 30);

 

if (!$fp) {

        // HTTP ERROR

        echo "Error processing request";

} else {

        // send form headers, form post

        fputs ($fp, $header . $PostingString);

 

        // set our returned header flag to true, these we want to ignore

        // initialize our body variable

        $bHeader = true;

        $sData = "";

 

        while (!feof($fp)) {

                $res = fgets ($fp, 8192);

                $res = ereg_replace("[\r\n]", "", $res);

                // if we have an empty line, we are now past the headers.

                // set the flag so we can start retrieving data

                if (strlen($res) == 0) $bHeader = false;

 

                if ($bHeader == false) $sData .= $res;

        }

        echo $sData;

 

        fclose ($fp);

}

?>