コード例 #1
0
        }
        //check secret answer field
        if (!empty($_POST['secretAnswer'])) {
            $secretAnswer = strtolower(trim($_POST['secretAnswer']));
            $createUser = $createUser & true;
            //create if all fields so far are valid
        } else {
            $message .= 'Please enter a secret answer.<br />';
            $secretAnswerLabelStyle .= 'Highlight';
            $createUser = false;
        }
        $authLevel = $_POST['authLevel'];
        //don't bother checking the select input
        if ($createUser) {
            $user = new User($username, $password, $secretQuestion, $secretAnswer, $authLevel);
            if (user_createUser($user)) {
                $message = 'The user was added successfully.';
            } else {
                $message = 'This user already exists.';
                $createUser = false;
            }
        }
    }
    ?>
			<form action="addUser.php" method="post" name="AddUserForm" onsubmit="return validateForm();">
			<div id="divStatus"><?php 
    print $message;
    ?>
</div>
			<br />
			<table>
コード例 #2
0
if (!empty($userName) && !empty($passWord) && !empty($module) && !empty($location) && !empty($secretQuestion) && !empty($secretAnswer)) {
    //create download directory if it doesn't exist
    if (!file_exists($location)) {
        mkdir($location);
    }
    $installed = true;
    require_once 'lib/configuration.php';
    // set up the configuration.xml
    $configuration = new Configuration($location, $module, 0, 0, 6, 4, 10, 60000, 60000);
    // write out the configuration.xml
    if (!config_setConfiguration($configuration)) {
        $message .= "The configuration XML file could not be written.<br />";
        $installed = false;
    }
    //Check to see if the user information provided can be used to create a site admin
    if (user_createUser(new User($userName, $passWord, $secretQuestion, $secretAnswer, "Admin")) === 'file error') {
        $message .= "The users XML file could not be written.<br />";
        $installed = false;
    }
    //check to see if the torrents.xml file is able to be written
    if (!torrent_createFile()) {
        $message .= "The torrents XML file could not be written.<br />";
        $installed = false;
    }
} else {
    if ($_POST) {
        $message = "Please fill out the install form completely.<br />";
    }
}
if ($installed) {
    ?>