<?php
include('functions.inc.php');
if ($conf['adm_user'] != '' || $conf['adm_password'] != '') {
header("Location: ./");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Auto PPD bot - SETUP</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<noscript><b style="color:red;">Javascript is required.</b></noscript>
<?php
if (isset($_POST['save'])) {
?>
<h2>Updating files:</h2>
<p>
<?php
if ($_POST['conf']['adm_user'] == ''){
echo "<span style=\"font-weight: bold;\" class='message'>User name must not blank.</span> <span class=\"warn\">ERROR! Please go back and put a user name.</span> <a href='javascript:history.go(-1);' class='message'>Back.</a>";
exit;
}
if ($_POST['conf']['adm_password'] == '' || $_POST['conf']['adm_password1'] == ''){
echo "<span style=\"font-weight: bold;\" class='message'>Passwords must not blank.</span> <span class=\"warn\">ERROR! Please go back and put the paswords.</span> <a href='javascript:history.go(-1);' class='message'>Back.</a>";
exit;
}
if ($_POST['conf']['adm_password'] != $_POST['conf']['adm_password1']){
echo "<span style=\"font-weight: bold;\" class='message'>Both the passwords must be same.</span> <span class=\"warn\">ERROR! Please go back and put the paswords carefully.</span> <a href='javascript:history.go(-1);' class='message'>Back.</a>";
exit;
}
(update_config($_POST['conf'], $conf)) ? ok("conf.inc.php") : warn("conf.inc.php");
?>
</p>
<p>Setup is done! <span class="warn">Please log in to your <a href='admin.php'>Admin Panel</a> to configure your ads and other settings.</span></p>
<?php
} elseif (isset($_GET['user'])) {
?>
<form method="post">
<h2>Set your administrator username and password:</h2>
<p>
Username: <br />
<input type="text" name="conf[adm_user]" class="text" /><br />
Password: <br />
<input type="password" name="conf[adm_password]" class="text" /><br />
Password Again: <br />
<input type="password" name="conf[adm_password1]" class="text" /><br />
</p>
<p>
Click continue to update config files.
</p>
<p>
<input type="submit" value="Continue" name="save" class="submit" />
</p>
</form>
<?php
} elseif (isset($_GET['files'])) {
echo "<h2>File permissions:</h2>";
$files = array('config/conf.inc.php', 'store');
if (!fileperm($files)) {
?>
<p class="warn">Wrong files permissions. Fix the errors and try again!</p>
<p><input type="button" value="Try again" onclick="document.location.href='<?php echo $_SERVER['PHP_SELF'] ?>?files=1'"></p>
<?php
} else {
?>
<p>File permissions are looking good. Click below to set administrator password.</p>
<p><input type="button" value="Continue" onclick="document.location.href='<?php echo $_SERVER['PHP_SELF'] ?>?user=1'"></p>
<?php
}
} else {
?>
<h2>Auto PPD bot setup:</h2>
<p>Welcome in Auto PPD bot setup script. Click button below to check files permissions.</p>
<p><input type="button" value="Start!" onclick="document.location.href='<?php echo $_SERVER['PHP_SELF'] ?>?files=1'"></p>
<?php
}
?>
</body>
</html>