Location: PHPKode > scripts > DNP script > admin/index.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/>.
*/
	error_reporting(0);
	session_start();
	
	if(!file_exists('../config.php')) {
		echo '
<!DOCTYPE html>
<html>

	<head>
		<title>DNP Script Admin</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="style.css" />
	</head>

	<body>
		<div class="content">
			<div id="header">
				<h1>DNP Script Admin</h1>
			</div>
			<span class="message-warning" id="not-installed">It doesn\'t look like you\'ve installed DNP Script on your server yet. Please visit '.$_SERVER['SERVER_NAME'].'/install to get started.</span>	
		</div>
	</body>
</html>';
		die;
	}

	function userAdmin(){
		if($_SESSION['admin'] != 1) {
			return false;
		}
		return true;
	}

	if(userAdmin()){
	
	echo '
<!DOCTYPE html>
<html lang="en">

	<head>
		<title>DNP Script Admin</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="style.css" />	
	</head>

	<body>
	
		<div id="content">
			<div id="header">
				<h1>DNP Script Admin</h1>
			</div>
			
			<div id="nav">
				<ul id="nav-links">
					<li class="nav-link" id="nav-link2"><a href="?module=domains" class="nav">Manage Domains</a></li>
					<li class="nav-link" id="nav-link3"><a href="?module=settings" class="nav">Site Settings</a></li>
					<li class="nav-link" id="nav-link5"><a href="io.php" class="nav">Logout</a></li>
				</ul>
			</div>
			
			<div id="page">
				';
	switch ($_GET['module']) {
		case "domains":
			include('domains.php');
			break;
		case "settings":
			include('settings.php');
			break;
		default:
			include('domains.php');		
	}
	
	echo '
			</div>
			
			<div id="clear"></div>
			
			<div id="footer">
				<p>Powered by <a href="http://dnpscript.com" target="_blank">DNP Script</a></p>
			</div>
			
		</div>
	</body>
</html>';
	}
	else{
		echo '
<!DOCTYPE html>
<html>

	<head>
		<title>DNP Script Admin</title>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="style.css" />
	</head>

	<body>
		<div id="content">
			<div id="header">
				<h1>DNP Script Admin</h1>
			</div>
			
			<div id="login">
				<form action="io.php" method="post" id="login-form">
					Email:<br /><input type="email" name="email" /><br />
					Password:<br /><input type="password" name="password"/><br />
					<br />
					<input type="submit" />
				</form>
			</div>
			
			<div id="footer">
				<p>Powered by <a href="http://dnpscript.com" target="_blank">DNP Script</a></p>
			</div>
			
		</div>
	
	
	</body>
</html>';
	}
?>
Return current item: DNP script