Exemplo n.º 1
0
<?php

if (!defined('CPanel') || !isset($_SESSION['user'], $_SESSION['level'], $_GET['load'])) {
    require_once 'lib.misc.php';
    noperms();
    exit;
}
if ($_GET['action'] == 'add') {
    if (!user_level(5)) {
        noperms();
        return;
    }
    if (isset($_POST['user'], $_POST['mail'], $_POST['level'])) {
        if (user_new($_POST['user'], $_POST['mail'], $_POST['level'])) {
            echo "<p>New user <strong>{$_POST['user']}</strong> created with level <strong>{$_POST['level']}</strong></p>\n<p>An e-mail was sent to <strong>{$_POST['mail']}</strong> containing a random generated password</p>\n";
            return;
        } else {
            echo "<p>An error ocurred, check the fields to find what happens</p>\n<p>The e-mail <strong>must</strong> be true</p>\n";
        }
    }
    ?>
<form action="<?php 
    echo htmlentities($_SERVER['REQUEST_URI']);
    ?>
" method="post">
    <label for="user">User:</label><input type="text" name="user" id="user" maxlength="20"<?php 
    if (isset($_POST['user'])) {
        echo ' value="' . $_POST['user'] . '"';
    }
    ?>
 /><br />
Exemplo n.º 2
0
                    break;
                }
            }
        }
    }
    // verif real name existant
    if (!isset($_GET['name']) or empty($_GET['name'])) {
        append_error('You must supply a real name.');
    }
    // verif email existant
    if (!isset($_GET['email']) or empty($_GET['email'])) {
        append_error('You must supply an email address.');
    }
    // si pas d'erreur,
    if (!errors()) {
        $newid = user_new($_GET['login'], $_GET['name'], $_GET['email']);
        if ($newid) {
            $new = user_get_by_id($newid);
            if ($new) {
                // envoi de l'email
                error_reporting(2047);
                mail($_GET['email'], '[igoan] Account registration confirmation', 'This email is a confirmation of your registration to Igoan,
the free directory project.

You have entered the following:
  Name: ' . $_GET['name'] . '
  Login name: ' . $_GET['login'] . '
  Email: ' . $_GET['email'] . '

Your automatically generated password is \'' . $new->get_passwd() . '\'.
You have to login with your newly created account on the Igoan website