Location: PHPKode > scripts > phpSecurityAdmin > phpsecurityadmin/include/user_add.php
<?php // 6/6/02 4:38PM
	if(isset($_POST['submit'])){
		$vuser=$sec_sys->isValidUsername(trim($id));
		$params=sprintf($sec_sys->PHPSECURITYADMIN_USERNAME_LENGTH,$vuser['min'],$vuser['max']);
		if($vuser['result']<0){
			switch($vuser['result']){
				case -1:	// too short
					$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_USERNAME_SHORT.
						' $params</b></span><br>'."\n";
					break;
				case -2:	// too long
					$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_USERNAME_LONG.
						' $params</b></span><br>'."\n";
					break;
				case -3:	// invalid characters
					$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_USERNAME_CHARS.
						'</b></span><br>'."\n";
					break;
			}
		}else{
			$vpass=$sec_sys->isValidPassword(trim($pass1));
			$params=sprintf($sec_sys->PHPSECURITYADMIN_PASSWORD_LENGTH,$vpass['min'],$vpass['max']);
			if(trim($pass1)==trim($pass2) && $vpass['result']==1){
				$password=trim($pass1);
				$ar=$_POST;
				$ar['pass']=$password;
				if($sec_sys->addUser($ar)){
					include 'include/users.php';
					exit;
				}
				else
					$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_USERNAME_EXSTS.
						'</b></span><br>'."\n";
	
			}else if($vpass['result']==-1){
				$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_PASSWORD_SHORT.
					' '.$params.'</b></span><br>'."\n";
			}else if($vpass['result']==-2){
				$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_PASSWORD_LONG.
					' '.$params.'</b></span><br>'."\n";
			}else
				$ERR='<span style="color: #cc0000;"><b>'.$sec_sys->PHPSECURITYADMIN_PASSWORD_MATCH.
					'</b></span><br>'."\n";
		}
	}
	$sec_sys->securityHeader();
	if(isset($ERR)) echo $ERR;
?>
<h3><?php echo $sec_sys->PHPSECURITYADMIN_NEW_USER ?></h3>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?language=<?php echo $sec_sys->LANGUAGE?>&a=users"><?php echo $sec_sys->PHPSECURITYADMIN_BACK ?></a>
 <form method=post action="<?php echo $_SERVER['PHP_SELF'] ?>?language=<?php echo $sec_sys->LANGUAGE?>&a=user_add">
  <table cellpadding=4 cellspacing=0 border=0>
   <tr>
	<td><?php echo $sec_sys->PHPSECURITYADMIN_NAME_L_F_MI ?></td>
	<td valign=top><input type=text name=lname size=25>
	 <input type=text name=fname size=20>
	 <input type=text name=mname size=2></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_EMAIL ?>:</b></td>
	<td><input type=text name=email size=35></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_PHONE ?>:</b></td>
	<td><input type=text name=phone size=20></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_USERNAME ?>:</b></td>
	<td><input type=text name=id size=20></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_PASSWORD ?>:</b></td>
	<td><input type=password name=pass1 size=20></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_VERIFY ?></b></td>
	<td valign=top><input type=password name=pass2 size=20></td>
   </tr>
   <tr>
	<td><b><?php echo $sec_sys->PHPSECURITYADMIN_PROFILE ?>:</b></td>
	<td>
	 <select name=profile>
<?php
	$profiles=$sec_sys->getProfiles();
    while(list($id,$name)=@each($profiles))
		echo '	  <option value='.$id.'>'.$name.'</option>'."\n";
?>
	 </select>
	</td>
   </tr>
   <tr>
	<td colspan=2><input type=submit name=submit value="<?php echo $sec_sys->PHPSECURITYADMIN_CREATE_USER ?>"></td>
   </tr>
  </table>
 </form>
Return current item: phpSecurityAdmin