<?php
/*
This file is part of DNP Script, an open source domain portfolio script.
Copyright (C) 2011 Robert Picard
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require('config.php');
$con = mysql_connect($db_host, $db_user, $db_pass)
or die('Could not connect to the database: '.mysql_error());
mysql_select_db($db_name, $con);
$title = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='title'"), 0, 'value');
$description = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='description'"), 0, 'value');
$analytics = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='analytics'"), 0, 'value');
$email = mysql_result(mysql_query("SELECT * FROM dnp_settings WHERE name='email'"), 0, 'value');
$spam_email = str_replace('@', ' [AT] ', $email);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="style.css" />
<meta name="description" content="<?php echo $description; ?>" />
<?php
if($analytics) {
echo "
<script type=\"text/javascript\">
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>";
}
?>
</head>
<body>
<div id="content">
<hgroup>
<h1><a href="index.php"><?php echo $title; ?></a></h1>
<h2 id="tagline"><?php echo $description; ?></h2>
</hgroup>
<?php
$query = "SELECT * FROM dnp_domains";
$result = mysql_query($query);
$num = mysql_num_rows($result);
$i = 0;
while($i < $num) {
$id = mysql_result($result, $i, 'id');
$domain = mysql_result($result, $i, 'domain');
$registrar = mysql_result($result, $i, 'registrar');
$expiry = mysql_result($result, $i, 'expiry');
$price = mysql_result($result, $i, 'price');
if(!$price) {
echo '
<section id="domain-listing">
<p><b>'.$domain.'</b> - <a href="mailto:'.$email.'?Subject='.$domain.'" class="contact-link" title="Click to start a message in your default mail application.">Inquire</a></p>
<p>Registered at <b>'.$registrar.'</b> and expires <b>'.$expiry.'</b>.</p>
</section>';
}
else if($price) {
echo '
<section id="domain-listing">
<p><b>'.$domain.'</b> - <a href="mailto:'.$email.'?Subject='.$domain.'" class="contact-link" title="Click to start a message in your default mail application.">Inquire</a></p>
<p>Registered at <b>'.$registrar.'</b> and expires <b>'.$expiry.'.</b></p>
<p>The asking price is <em>'.$price.'.</em></p>
</section>';
}
$i++;
}
?>
<div id="footer">
<p>Contact me at <?php echo $spam_email; ?>.</p>
<p>Powered by <a href="http://dnpscript.com" target="_blank">DNP Script</a></p>
</div>
</div>
</body>
</html>