mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 09:48:55 +00:00
67 lines
1.4 KiB
PHP
Executable File
67 lines
1.4 KiB
PHP
Executable File
<?php
|
|
require_once realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install.php');
|
|
|
|
use nntmux\Install;
|
|
use nntmux\Users;
|
|
|
|
$page = new InstallPage();
|
|
$page->title = "Setup Admin User";
|
|
|
|
$cfg = new Install();
|
|
|
|
if (!$cfg->isInitialized()) {
|
|
header("Location: index.php");
|
|
die();
|
|
}
|
|
|
|
$cfg = $cfg->getSession();
|
|
|
|
if ($page->isPostBack()) {
|
|
$cfg->doCheck = true;
|
|
|
|
$cfg->ADMIN_USER = trim($_POST['user']);
|
|
$cfg->ADMIN_PASS = trim($_POST['pass']);
|
|
$cfg->ADMIN_EMAIL = trim($_POST['email']);
|
|
|
|
if ($cfg->ADMIN_USER == '' || $cfg->ADMIN_PASS == '' || $cfg->ADMIN_EMAIL == '') {
|
|
$cfg->error = true;
|
|
} else {
|
|
$user = new Users();
|
|
if (!$user->isValidUsername($cfg->ADMIN_USER)) {
|
|
$cfg->error = true;
|
|
$cfg->ADMIN_USER = '';
|
|
} else {
|
|
$usrCheck = $user->getByUsername($cfg->ADMIN_USER);
|
|
if ($usrCheck) {
|
|
$cfg->error = true;
|
|
$cfg->ADMIN_USER = '';
|
|
}
|
|
}
|
|
if (!$user->isValidEmail($cfg->ADMIN_EMAIL)) {
|
|
$cfg->error = true;
|
|
$cfg->ADMIN_EMAIL = '';
|
|
}
|
|
|
|
if (!$cfg->error) {
|
|
$cfg->adminCheck = $user->add($cfg->ADMIN_USER, $cfg->ADMIN_PASS, $cfg->ADMIN_EMAIL, 2, '', '');
|
|
if (!is_numeric($cfg->adminCheck)) {
|
|
$cfg->error = true;
|
|
} else {
|
|
$user->login($cfg->adminCheck, "", 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!$cfg->error) {
|
|
$cfg->setSession();
|
|
header("Location: ?success");
|
|
die();
|
|
}
|
|
}
|
|
|
|
$page->smarty->assign('cfg', $cfg);
|
|
$page->smarty->assign('page', $page);
|
|
|
|
$page->content = $page->smarty->fetch('step6.tpl');
|
|
$page->render();
|