29 lines
912 B
PHP
29 lines
912 B
PHP
|
#! /usr/bin/php5
|
||
|
<?php
|
||
|
error_reporting(0);
|
||
|
|
||
|
//define stdin if it's not defined yet
|
||
|
if(!defined("STDIN")) define("STDIN", fopen('php://stdin','r'));
|
||
|
|
||
|
//check for an existing users.db
|
||
|
if(file_exists("users.db")) die("\n(!)Delete your old users.db file before creating the primary admin account(!)\n\n");
|
||
|
|
||
|
//tell, what we're doing here
|
||
|
echo "This script will create the first admin account for the bot.\n";
|
||
|
echo "The username has to be identical to your IRC-nickname, so the bot can recognize you.\n\n";
|
||
|
|
||
|
//ask for username and password
|
||
|
echo "Username: ";
|
||
|
$user = trim(fread(STDIN, 80));
|
||
|
echo "Password (will be displayed): ";
|
||
|
$pass = trim(fread(STDIN, 80));
|
||
|
|
||
|
//create account here
|
||
|
require("modules/userdb.class.php");
|
||
|
$userdb = new userdb();
|
||
|
$userdb -> addUser($user, $pass);
|
||
|
$userdb -> setLevel($user, 9);
|
||
|
unset($userdb);
|
||
|
|
||
|
echo "Admin account created. You can now start the bot!\n";
|
||
|
?>
|