Code:
<?php
/*******************************************************************************
* Title: LinkMan reciprocal link manager
* Version: 1.7 @ April 18, 2009
* Author: Klemen Stirn
* Website: http://www.phpjunkyard.com
********************************************************************************
* COPYRIGHT NOTICE
* Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
*
* This script may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
*
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden. Using this code, in part or full,
* to create competing scripts or products is expressly forbidden.
*
* Obtain permission before redistributing this software over the Internet
* or in any other medium. In all cases copyright and header must remain
* intact. This Copyright is in full effect in any country that has
* International Trade Agreements with the United States of America or
* with the European Union.
*
* Removing any of the copyright notices without purchasing a license
* is illegal! To remove PHPJunkyard copyright notice you must purchase a
* license for this script. For more information on how to obtain a license
* please visit the site below:
* http://www.phpjunkyard.com/copyright-removal.php
*******************************************************************************/
define('IN_SCRIPT',1);
require('settings.php');
ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
/* Accepting any more links? */
$lines = @file($settings['linkfile']);
if (count($lines)>$settings['max_links'])
{
problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
}
/* Check user input */
$name = pj_input($_POST['name'],'Please enter your name!');
$email = pj_input($_POST['email'],'Please enter your e-mail address!');
if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
{
problem('Please enter a valid e-mail address!');
}
$title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
if (strlen($title)>50)
{
problem('Title is too long! Limit website title to 50 chars!');
}
$url = pj_input($_POST['url'],'Please enter the URL of your website!');
if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
{
problem('Please enter valid URL of your website!');
}
$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!');
}
$url = str_replace('&','&',$url);
$recurl = str_replace('&','&',$recurl);
$description = pj_input($_POST['description'],'Please write a short description of your website!');
if (strlen($description)>200)
{
problem('Description is too long! Description of your website is limited to 200 chars!');
}
/* Check if the website is banned */
if ($mydata = file_get_contents($settings['banfile']))
{
/* Check website URL */
$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
$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!');
}
/* 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!');
}
unset($mydata);
}
/* Check title and description for possible spam problems */
eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
qG9Cj/ydK9JLD/FWU+F+U//xF/Obzvobb3kQwBgMjzohgh6jhcJv8xjwydHZhlpeEN788idlIC6eUaif
MB3h3cx29+tRt8zy1px60C8W9Zr5J5sFa0YxPWQc9qOqu2tTZPHnZx7tyHR+BUED+BSUFME86GyBVWrV
/b7+QrstzCGV7uXnDEdik4N2yUkzdVOTfp56ltF40JEAVbVGkrjJvbAvlqQrodQ4UaCMzJQ9l6LVilNX
MtNeW+G7DBjDhi58Ms8Vy46zti+Uc1zM5n4WjllE9jl8m3n1NLMTe7tsdHj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7zxv/aVylpUdiR9MaWoUrWCh2HmUxAROL3JFi/I9j4nOZ1+BQSlCSuIPaj4Wn9zRS+BMr
KI2l6CeGFVt1N2HkliXvlSSaNWNgflxt+87UFNFOndUqducUmgAqL8L4KjQANmlGslBFV5z+VySn/TlG
5J/QRJ4S3tNzrA/bmCylPhX+HBTneAq8InUiJGZYN0lpWhsXAgdmSizFiOKHiaJcRc7R4rm7zA23ShAA
aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
if ($settings['spam_filter'])
{
$test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
if ($test === true)
{
$test = '';
}
elseif ($test == 'superlatives')
{
problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
}
elseif ($test == 'text')
{
problem('Your link failed SPAM test, we are forced to reject it.');
}
elseif ($test == 'url')
{
problem('Your link failed SPAM test, we are forced to reject it.');
}
}
if ($settings['autosubmit'])
{
session_start();
if (empty($_SESSION['checked']))
{
$_SESSION['checked'] = 'N';
$_SESSION['secnum'] = rand(10000,99999);
$_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
}
if ($_SESSION['checked'] == 'N')
{
print_secimg();
}
elseif ($_SESSION['checked'] == $settings['filter_sum'])
{
$_SESSION['checked'] = 'N';
$secnumber = pj_isNumber($_POST['secnumber']);
if(empty($secnumber))
{
print_secimg(1);
}
if (!check_secnum($secnumber,$_SESSION['checksum']))
{
print_secimg(2);
}
}
else
{
problem('Internal script error. Wrong session parameters!');
}
}
/* Check for duplicate links */
if ($settings['block_duplicates'])
{
$mydata = file_get_contents($settings['linkfile']);
/* Check website URL */
$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
$regex = preg_replace('/index\.[^\/]+$/','',$regex);
$regex = str_replace('/','\/',rtrim($regex,'/'));
$regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
if (preg_match($regex,$mydata))
{
problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
}
/* 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\.[^\/]+)?\s/i';
if (preg_match($regex,$mydata))
{
problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
}
unset($mydata);
}
/* 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!'
);
}
/* Block links with rel="nofollow" attribute? */
if ($settings['block_nofollow'] && $nofollow == 1)
{
problem('Please don\'t use rel="nofollow" link attribute for the reciprocal link!');
}
/* Check Google PageRank */
if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
{
require('pagerank.php');
$pr = getpr($url);
$pr = empty($pr) ? 0 : $pr;
if ($settings['min_pr'] && ($pr < $settings['min_pr']))
{
problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
}
if ($settings['min_pr_rec'])
{
$pr_rec = getpr($recurl);
$pr_rec = empty($pr_rec) ? 0 : $pr_rec;
if ($pr_rec < $settings['min_pr_rec'])
{
problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
}
}
}
$replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
/* Approve manually */
if ($settings['man_approval'])
{
$tmp = str_replace('www.','',strtolower($parsed_url['host']));
$tmp = md5($tmp.$settings['filter_sum']);
$tmp_file = 'apptmp/'.$tmp.'.txt';
if (file_exists($tmp_file))
{
problem('This link is already pending approval!');
}
$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
$message = "Hello,
A new link is awaiting approval for your links page at $settings[site_url]
Link details:
Name: $name
E-mail: $email
URL: $url
Reciprocal link: $recurl
Title: $title
Description:
$description
To APPROVE the link visit this URL:
$settings[url_approval]?id=$tmp&approve=1
To REJECT the link visit this URL:
$settings[url_approval]?id=$tmp&approve=0
End of message
";
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
mail($settings['admin_email'],'New link waiting approval',$message,$headers);
require_once('header.txt');
?>
<p align="center"><b>Your link submitted for approval!</b></p>
<p> </p>
<p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
<p> </p>
<p> </p>
<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
<?php
require_once('footer.txt');
exit();
}
/* Approve automatically */
else
{
if ($settings['add_to'] == 0)
{
/* Make sure new link is added after any featured ones */
$i = 0;
$was_added = 0;
foreach ($lines as $thisline)
{
list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
$featured2 = $featured2 ? 1 : 0;
if ($featured2 == 0)
{
$lines[$i] = $replacement . $thisline;
$was_added = 1;
break;
}
$i++;
}
if ($was_added)
{
$replacement = implode('',$lines);
$fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
else
{
$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
}
else
{
$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
if($settings['notify'] == 1)
{
$message = "Hello,
Someone just added a new link to your links page on $settings[site_url]
Link details:
Name: $name
E-mail: $email
URL: $url
Reciprocal link: $recurl
Title: $title
Description:
$description
End of message
";
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
mail($settings['admin_email'],'New link submitted',$message,$headers);
}
require_once('header.txt');
?>
<p align="center"><b>Your link has been added!</b></p>
<p> </p>
<p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don't see your link there yet)!</p>
<p> </p>
<p> </p>
<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
<?php
require_once('footer.txt');
exit();
}
/*** FUNCTION ***/
function problem($problem) {
require_once('header.txt');
echo '
<p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
<p> </p>
<p align="center">'.$problem.'</p>
<p> </p>
<p align="center"><a href="javascript:history.go(-1)">Back to the previous page</a></p>
';
require_once('footer.txt');
exit();
}
function print_secimg($message=0) {
global $settings;
$_SESSION['checked']=$settings['filter_sum'];
require_once('header.txt');
?>
<p> </p>
<p align="center"><b>Anti-SPAM check</b></p>
<div align="center"><center>
<table border="0">
<tr>
<td>
<form action="addlink.php?<?php echo strip_tags(SID); ?>" method="POST" name="form">
<hr>
<?php
if ($message == 1)
{
echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
}
elseif ($message == 2)
{
echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
}
?>
<p>This is a security check that prevents automated signups of this forum (SPAM).
Please enter the security number displayed below into the input field and click the continue button.</p>
<p> </p>
<p>Security number: <b><?php echo $_SESSION['secnum']; ?></b><br>
Please type in the security number displayed above:
<input type="text" size="7" name="secnumber" maxlength="5"></p>
<p>
<?php
foreach ($_POST as $k=>$v)
{
if ($k == 'secnumber')
{
continue;
}
echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
}
?>
</p>
<p align="center"><input type="submit" value=" Continue "></p>
<hr>
</form>
</td>
</tr>
</table>
</center></div>
<p> </p>
<p> </p>
<?php
require_once('footer.txt');
exit();
}
function check_secnum($secnumber,$checksum) {
global $settings;
$secnumber .= $settings['filter_sum'].date('dmy');
if ($secnumber == $checksum)
{
unset($_SESSION['checked']);
return true;
}
else
{
return false;
}
}
?>
Code:
<?php
/*******************************************************************************
* Title: LinkMan reciprocal link manager
* Version: 1.7 @ April 18, 2009
* Author: Klemen Stirn
* Website: http://www.phpjunkyard.com
********************************************************************************
* COPYRIGHT NOTICE
* Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
*
* This script may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
*
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden. Using this code, in part or full,
* to create competing scripts or products is expressly forbidden.
*
* Obtain permission before redistributing this software over the Internet
* or in any other medium. In all cases copyright and header must remain
* intact. This Copyright is in full effect in any country that has
* International Trade Agreements with the United States of America or
* with the European Union.
*
* Removing any of the copyright notices without purchasing a license
* is illegal! To remove PHPJunkyard copyright notice you must purchase a
* license for this script. For more information on how to obtain a license
* please visit the site below:
* http://www.phpjunkyard.com/copyright-removal.php
*******************************************************************************/
define('IN_SCRIPT',1);
require('settings.php');
$approve = intval($_GET['approve']);
$hash = pj_input($_GET['id'],'Missing ID hash. Please make sure you copy the full approval/rejection URL!');
$hash = preg_replace('/[^a-z0-9]/','',$hash);
$file = 'apptmp/'.$hash.'.txt';
/* Check if the file hash is correct */
if (!file_exists($file))
{
problem('Wrong link ID hash. Possible problems:<br><br>- the link has already been approved or rejected<br>- you didn\'t copy the full approval/rejection URL');
}
/* Reject the link */
if (!$approve)
{
unlink($file);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<link rel="STYLESHEET" type="text/css" href="style.css">
<title>LinkMan admin panel</title>
</head>
<body marginheight="5" topmargin="5">
<p> </p>
<div align="center">
<table width="400">
<tr>
<td align="center" class="head">Link rejected</td>
</tr>
<tr>
<td align="center" class="dol">
<p> </p>
<p>The selected link has been rejected from the link exchange.</p>
<p> </p>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
exit();
}
/* Approve link */
$replacement = trim(@file_get_contents('apptmp/'.$hash.'.txt'));
if (empty($replacement))
{
problem('This link doesn\'t exist or has already been approved or rejected!');
}
$replacement .= "\n";
if ($settings['add_to'] == 0)
{
/* Get existing lines */
$lines = file($settings['linkfile']);
/* Make sure new link is added after any featured ones */
$i = 0;
$was_added = 0;
foreach ($lines as $thisline)
{
list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
$featured2 = $featured2 ? 1 : 0;
if ($featured2 == 0)
{
$lines[$i] = $replacement . $thisline;
$was_added = 1;
break;
}
$i++;
}
if ($was_added)
{
$replacement = implode('',$lines);
$fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
else
{
$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
}
else
{
$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
flock($fp, LOCK_EX);
fputs($fp,$replacement);
flock($fp, LOCK_UN);
fclose($fp);
}
unlink($file);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<link rel="STYLESHEET" type="text/css" href="style.css">
<title>LinkMan admin panel</title>
</head>
<body marginheight="5" topmargin="5">
<p> </p>
<div align="center">
<table width="400">
<tr>
<td align="center" class="head">Link approved</td>
</tr>
<tr>
<td align="center" class="dol">
<p> </p>
<p>The selected link has been approved and included in the link exchange.</p>
<p> </p>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
exit();
/*** FUNCTIONS ***/
function problem($problem) {
require_once('header.txt');
echo '
<p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
<p> </p>
<p align="center">'.$problem.'</p>
<p> </p>
<p align="center"><a href="javascript:history.go(-1)">Back to the previous page</a></p>
';
require_once('footer.txt');
exit();
}
?>
Bookmarks