Page 1 of 1
Linkman
Posted: Tue Feb 17, 2009 5:28 am
by MoparBob
Script URL:
http://www.martinsvillehenrycountycarcl ... /links.php
Version of script:
Hosting company:Mine
URL of phpinfo.php: 5.2
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Nothing
Write your message below:
Hello,
I was wondering if there is a way to remove the URL with reciprocal link from the script?
Posted: Tue Feb 17, 2009 5:44 pm
by Klemen
You mean like what, you don't want reciprocal links, just a "free for all links" script?
Posted: Tue Feb 17, 2009 10:31 pm
by MoparBob
Klemen wrote:You mean like what, you don't want reciprocal links, just a "free for all links" script?
Yes sir
Posted: Wed Feb 18, 2009 2:20 pm
by Klemen
You can delete the reciprocal URL field from the form and these block of code from addlink.php:
Code: Select all
$recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
{
problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
}
/* Compare URL and Reciprocal page URL */
$parsed_url = parse_url($url);
$parsed_rec = parse_url($recurl);
if ($parsed_url['host'] != $parsed_rec['host'])
{
problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
}
Code: Select all
$recurl = str_replace('&','&',$recurl);
Code: Select all
/* Check reciprocal link URL */
$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
$regex = preg_replace('/index\.[^\/]+$/','',$regex);
$regex = str_replace('/','\/',rtrim($regex,'/'));
$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
if (preg_match($regex,$mydata))
{
problem('This website has been permanently banned from our link exchange!');
}
Code: Select all
/* Get HTML code of the reciprocal link URL */
$html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
$html = strtolower($html);
$site_url = strtolower($settings['site_url']);
/* Block links with the meta "robots" noindex or nofollow tags? */
if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
{
problem(
'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
htmlspecialchars($meta[0])
);
}
$found = 0;
$nofollow = 0;
if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
foreach($matches as $match)
{
if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
{
$found = 1;
if (strstr($match[3],'nofollow'))
{
$nofollow = 1;
}
break;
}
}
}
if ($found == 0)
{
problem(
'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
'</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
$recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
links page before submitting your link!'
);
}
then just paste this code at the top of the addlink.php file just below define('IN_SCRIPT',1); :
Haven't tested it so make sure you keep backups of your old files.