<?php
define('INSTANTLEDIR', dirname(__FILE__));
define('WWWROOT', substr(INSTANTLEDIR, 0, -9));
define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
require(BASEDIR . 'funcs.inc');
require(BASEDIR . 'config.php');
require(WWWROOT . 'skins/' . $skin . '/header.php');
?>
<!-- BEGIN BODY -->
<table border="0" width="90%">
<tr>
<td align="left">
<!-- BEGIN PAGE CONTENT -->
<?php
if(checkPostForm('instantLEaddLink', $_POST) !== TRUE)
{
echo '<br>';
echo 'Please, go back and try again.';
}
else
{
$_POST['instantLEtitle'] = htmlspecialchars($_POST['instantLEtitle'], ENT_QUOTES, 'UTF-8');
$_POST['instantLEdescription'] = htmlspecialchars($_POST['instantLEdescription'], ENT_QUOTES, 'UTF-8');
$url = htmlspecialchars($_POST['instantLEurl']);
$html = @file_get_contents($url, 'r');
if($html === FALSE)
{
echo "Can't open remote URL!";
}
else
{
if(preg_match('/' . $site_url . '/', $html) === 0)
{
echo "Our URL (<a href=\"$site_url\">$site_name</a>) wasn't found on your page (<a href=\"$url\">$url</a>)!<br><br>
Please make sure you place this exact URL on your page before adding your link!<P>Copy and paste the following code in a GOOD, VISIBLE SPOT on your MAIN PAGE:<P><pre style=font-family:verdana;font-size:11px><a href="$site_url" title="$site_name">$site_name</a></pre>";
}
else
{
$linkCountQuery = dbcom('SELECT COUNT(*) AS linkCount FROM instantle;');
$linkCountArray = mysql_fetch_assoc($linkCountQuery);
if($linkCountArray['linkCount'] > $instantLEmaxLinks)
{
echo 'We are not accepting any more links at the moment. We appologize for the inconvenience!';
}
else
{
# Check for duplicate entry:
$duplicateURLQuery = dbcom("SELECT siteurl FROM instantle WHERE siteurl = '$url' LIMIT 1;");
if(mysql_num_rows($duplicateURLQuery) > 0)
{
echo 'Duplicate link!';
}
else
{
dbcom("INSERT INTO instantle VALUES(NULL, '{$_POST['instantLEname']}', '{$_POST['instantLEemail']}', '{$_POST['instantLEtitle']}', '$url', '{$_POST['instantLEdescription']}', 1);");
if($instantLEnotify == 1)
{
$message="Hello,
Someone just added a new link to your Instant Link Exchange at $site_url
Link details:
Name: {$_POST['instantLEname']}
E-mail: {$_POST['instantLEemail']}
URL: $url
Reciprocal link: $url
Title: {$_POST['instantLEtitle']}
Description:
{$_POST['instantLEdescription']}
End of message
";
$headers = "From: {$_POST['instantLEname']} <{$_POST['instantLEemail']}>\n";
$headers .= "Reply-To: {$_POST['instantLEname']} <{$_POST['instantLEemail']}>\n\n";
mail("$admin_email", "New link submitted", $message, $headers);
}
?>
<p>Your link has been added!</p>
<p>Thank you, your hardlink has been successfully added to our Instant Link Exchange (try reloading our main page if you don't see your link there yet)!</p>
<p>Warning: Removal of our reciprocal link from your page will result in your site being deleted and banned from partnership.</p>
<!-- END PAGE CONTENT -->
<?php
}
}
}
}
}
?>
</td>
</tr>
</table>
<!-- END BODY -->
<?php
require(WWWROOT . 'skins/' . $skin . '/footer.php');
?>