Beispiel #1
0
 public static function autoGenerateUser($pack)
 {
     if (isset($pack->group_name) && strlen($pack->group_name)) {
         //derive from group_name
         $exists = true;
         while ($exists) {
             $pack->user_name = $pack->group_name . util::rand_string(5);
             $exists = dbconnection::queryObject("SELECT * FROM users WHERE user_name = '{$pack->user_name}'");
         }
         $pack->password = $pack->group_name;
     } else {
         //populate with garbage
         $exists = true;
         while ($exists) {
             $pack->user_name = util::rand_string(10);
             $exists = dbconnection::queryObject("SELECT * FROM users WHERE user_name = '{$pack->user_name}'");
         }
         $pack->password = util::rand_string(10);
         //this is legit probably never going to be recoverable...
     }
     if (!isset($pack->display_name)) {
         $pack->display_name = "";
     }
     //explicitly set display_name so default doesn't get set to the gibberish user_name
     $pack->transient = 1;
     return users::createUser($pack);
 }
			<?php 
include "src/common/header.php";
?>
		</div>
	
		<div id="main">
			<div class="col">
				<?php 
$users = new users();
if (isset($_POST['submit'])) {
    $prenom = ucfirst(strtolower($_POST['prenom']));
    $nom = strtoupper($_POST['nom']);
    $mail = strtolower($_POST['mail']);
    $login = strtolower($_POST['login']);
    $password = $_POST['password'];
    $users->createUser($nom, $prenom, $mail, $login, $password);
    if ($id = $users->verif($login, $password)) {
        $_SESSION['id'] = $id;
        echo "<script>window.location='cadeaux.php';</script>";
    }
}
?>
				<form method="post">
					<table>
						<tr><td colspan="2">Nouveau utilisateur</td></tr>
						<tr>
							<td>Mail : </td>
							<td><input type="text" name="mail"/></td>
						</tr>
						<tr>
							<td>Pr&eacute;nom : </td>