Location: PHPKode > scripts > DNP script > admin/manage-domain.php
<?PHP
/*
    This file is part of DNP Script, an open source domain portfolio manager.
    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/>.
*/

	// Make sure the user is logged in as the admin
	session_start();
	
	if(!$_SESSION['admin']){
		header('Location: index.php');
		die;
	}
?>

<a href="?module=domains&action=new">New Domain</a><br />


<?php
	require('../config.php');
	
	$con = mysql_connect($db_host, $db_user, $db_pass);
	
	if(!$con) {
		die('Could not connect to the database: '. mysql_error());
	}
	
	mysql_select_db($db_name, $con);
	
	$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="action.php?action=delete&id='.$id.'" class="delete-link">Delete</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="action.php?action=delete&id='.$id.'" class="delete-link">Delete</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++;
	}
	
?>
</table>
Return current item: DNP script