![]() |
Problem with installing link exchange script
Hi all,
I'm not sure whether this is good question here, but I'll give it a try. I'm trying to install script that handles link exchange. Instalation seems to be pretty easy...for somebody who knows smarty and php. Unfortunatelly, I'm not that person... What they say needs to be done is: Installation for PHP pages 1. Add the following code to .php pages of your website: ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../'); include_once ('linkor.php'); 2. Put the following code in the place where you want links to be displayed: linkor_wyswietl_poz(); I have two questions. - In which .php files should I add the code, so that it would be displayed on each page of my shop - I want to display code where copyright.tpl is. What form "linkor_wyswietl_poz();" should have to make it work properly. I spent a lot of time trying to solve this problem, but at the end of the day I gave up. Thanks for any help. Regards, Maciej |
Re: Problem with installing link exchange script
Quote:
Try to do so: 1. In the end of the file "auth.php" add next lines: PHP Code:
2. Add the code in the template for the output links (for. exmpl in the end of the file "skin1/bottom.tpl" - links will appear at the bottom of the site): PHP Code:
|
Re: Problem with installing link exchange script
Thanks for your help, but still there's something not working properly. Links are displayed always at the top of page no matter to which .tpl file I put the second bit of code.
Some of the page formatting is changed as well. Regards, Maciej |
Re: Problem with installing link exchange script
Quote:
Need source file linkor.php... The problem there. |
Re: Problem with installing link exchange script
I hope it's not too long:
$now = time(); $t24h = 60 * 60 * 24; $lfname = "linkor.txt"; $refferer = $_SERVER['HTTP_HOST']; $VER = "1.7.5 STATIC"; $p_linkor = ''; while(!is_file($p_linkor . 'linkor.txt') && $catd < 20) { $p_linkor .= '../'; $catd++; } $lfname = $p_linkor . $lfname; if(@file_exists($lfname)) { if((filemtime($lfname) + $t24h < $now) || (filesize($lfname) == 0)) { if(is_writable($lfname)) { $newlinks = getpage ("http://get.linkor.pl/download_links.php?linkor=". urlencode($lfname). "&VER=".urlencode($VER). "&referer=".urlencode($refferer), $refferer) ; if ($newlinks) { } else { $newlinks = ''; for ($i = 0; $i < 10; $i++) { $newlinks .= '<a id="L'. $i .'" href="#" title="#'. $i .'" >Linkor.pl</a> 1130882242' . "\n"; } } $lp = @fopen($lfname,'r+'); @flock($lp, LOCK_EX|LOCK_NB); @fwrite($lp, $newlinks); @ftruncate($lp, @ftell($lp)); @fclose($lp); } else { // Blad zapisu do pliku $linkor_links[0][0] = "WE"; $linkor_links[1][0] = "WE"; $linkor_links[2][0] = "WE"; $linkor_links[3][0] = "WE"; $linkor_links[4][0] = "WE"; } } else { } } else { // Nie odnaleziono pliku linkor.txt $linkor_links[0][0] = "FnF"; $linkor_links[1][0] = "FnF"; $linkor_links[2][0] = "FnF"; $linkor_links[3][0] = "FnF"; $linkor_links[4][0] = "FnF"; } if (is_file($lfname)) { if (is_readable($lfname)) { $alllinks = file($lfname); $i = 0; $linkor_links = array(); while( $i < 3) { $numlinks = count($alllinks)-1; //$rand = mt_rand(0, ($numlinks)) ; $rand = lnk_Rand($numlinks); $newlink = explode("\t", trim($alllinks[$rand]) ); if ($utf8 == 1) { $newlink = ISO88592_2_UTF8($newlink); } if ($noweokno == 1) { $newlink = str_replace(' >', " target=\"_blank\" >", $newlink); } if ($css != "") { $newlink = str_replace(' >', " class=\"$css\" >", $newlink); } $linkor_links[] = $newlink; unset($alllinks[$rand]); foreach ($alllinks as $onelink) { $newalllinks[] = $onelink; } $alllinks = $newalllinks; $i++; } $i = 0; while( $i < 2) { $numlinks = count($alllinks)-1; $rand = mt_rand(0, ($numlinks)) ; $newlink = explode("\t", trim($alllinks[$rand]) ); if ($utf8 == 1) { $newlink = ISO88592_2_UTF8($newlink); } if ($noweokno == 1) { $newlink = str_replace(' >', " target=\"_blank\" >", $newlink); } if ($css != "") { $newlink = str_replace(' >', " class=\"$css\" >", $newlink); } $linkor_links[] = $newlink; unset($alllinks[$rand]); foreach ($alllinks as $onelink) { $newalllinks[] = $onelink; } $alllinks = $newalllinks; $i++; } } } function getpage ($pageSpec, $refferer) { $pageSpec = urldecode($pageSpec); if (function_exists('curl_init')) { if (!$agent) $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init($pageSpec); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_REFERER, $refferer); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); $tmp = curl_exec ($ch); curl_close ($ch); unset($ch); } else { $tmp = @file_get_contents($pageSpec); } return $tmp; } if (!function_exists('file_get_contents')) { function file_get_contents($url) { $handle = fopen($url, 'r'); if (!$handle) { return 0; } $string = fread($handle, 4096000); fclose($handle); return $string; } } function linkor_wyswietl_poz($separator=' ') { global $linkor_links; echo $linkor_links[0][0] . $separator . $linkor_links[1][0] . $separator . $linkor_links[2][0] . $separator . $linkor_links[3][0] . $separator . $linkor_links[4][0]; } function linkor_wyswietl_pion() { global $linkor_links; echo $linkor_links[0][0]."<br>". $linkor_links[1][0]."<br>". $linkor_links[2][0]."<br>". $linkor_links[3][0]."<br>". $linkor_links[4][0]; } function iso2utf() { $tabela = Array( "\xb1" => "\xc4\x85", "\xa1" => "\xc4\x84", "\xe6" => "\xc4\x87", "\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" => "\xc4\x98", "\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" => "\xc3\xb3", "\xd3" => "\xc3\x93", "\xb6" => "\xc5\x9b", "\xa6" => "\xc5\x9a", "\xbc" => "\xc5\xbc", "\xac" => "\xc5\xbb", "\xbf" => "\xc5\xba", "\xaf" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" => "\xc5\x83"); return $tabela; } function ISO88592_2_UTF8($tekst) { return strtr($tekst, iso2utf()); } function lnk_Rand($numlinks) { $lnk_UserUrl = $_SERVER['REQUEST_URI']; if ($lnk_UserUrl == "") { $lnk_UserUrl = $_SERVER['SCRIPT_NAME']; if (!$_SERVER['QUERY_STRING'] == "") { $lnk_UserUrl = $lnk_UserUrl . "?" . $_SERVER['QUERY_STRING']; } } $lnk_Seed = hexdec(substr(md5($lnk_UserUrl), -8)) & 0x7fffffff; srand($lnk_Seed); $lnk_RandStart = rand(0, $numlinks); return $lnk_RandStart; } ?> |
Re: Problem with installing link exchange script
Quote:
Change next code in this file: PHP Code:
by this PHP Code:
|
Re: Problem with installing link exchange script
Thank you very much!!!
You've helped me a lot. |
Re: Problem with installing link exchange script
Quote:
What links exchange service you use? I creat a new topic with this decision, it may be someone will need in the future. :) |
All times are GMT -8. The time now is 12:26 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.