Location: PHPKode > projects > Skills Evaluator - Free HR evaluation software > skills-evaluator_1.3/http/a_add_user.php
<?php include "config.php"; include "functions.php"; ?>
 
 <!-- include core java - ajax functions file, here will be used to open in same page content edit and delete options -->
 <script src="functions.js" type="text/javascript"></script>

<?php if ($_SESSION["user"][5]<=4)
{
echo "No access";
die();
}
$current_file=current_file();
$sw=clean($_GET['sw']);
//////////////////////////////////////
//start of page add new code
//////////////////////////////////////

if($sw=='add_user'){



if (isset($_SESSION["user"][0])) $usr=user($_SESSION["user"][0]);
 
if ($usr[5]>=5) {//permission check
 ?>
 
 <form id="save_user" name="save_user" method="post" action="<?php echo $current_file."?sw=save_user" ?>">
 
  	    <table width="100%" border="0" cellspacing="4" cellpadding="4">
		<tr>
		  <td colspan="2"><p align="right"><?php echo "<a class='q_link' href='javascript:ajaxpage(\"".customfc('help_msg.php')."?id=1000\", \"content_edit\");'>x</a></p>" ?>
         </td>
          </tr>
		  		<tr>
		  <td colspan="2">
<b><?php echo $lang['Add_User'] ?></b>
         </td>
          </tr>
          <tr>
		  <td><font class="q_text">
            <?php echo $lang['name'] ?>:</font></td>
            <td><input type="text" name="name" value=""/>*
         </td>
          </tr>
		   <tr>
		  <td><font class="q_text">
            <?php echo $lang['Real_Name'] ?>:</font></td>
            <td><input type="text" name="real_name" value=""/>
         </td>
          </tr>
		     <tr>
		  <td><font class="q_text">
            <?php echo $lang['User_Password'] ?>:</font></td>
            <td><input type="text" name="pass" value=""/>*
         </td>
          </tr>
		  		     <tr>
		  <td><font class="q_text">
            <?php echo $lang['E-mail'] ?>:</font></td>
            <td><input type="text" name="email" value=""/>*
         </td>
          </tr>
		 <tr>
		  <td><font class="q_text">
            <?php echo $lang['Level'] ?>:</font></td>
            <td><select name="level">
              <option value="1" selected="selected">1 (Simple User)</option>
			  <option value="2" >2</option>
			  <option value="3" >3</option>
			  <option value="4" >4</option>
			  <option value="5" >5 (Super Admin)</option>
            </select>
            </td>
		  		  </tr>
 <tr>
		  <td colspan="2">
		  <font class="q_text_sm">(<?php echo $lang['fields_with_ast_must_completed'] ?>)</font><br>
		<input type='submit' name='Submit' value="<?php echo $lang['Save'] ?>" />
</td>
          </tr>
        </table>
 		</form>
<?php } 

}

//////////////////////////////////////
//start of user save new code
//////////////////////////////////////

if($sw=='save_user'){

if (isset($_SESSION["user"][0])) $usr=user($_SESSION["user"][0]);
 
if ($usr[5]>=5) {//permission check

$config=config();

$name=clean($_POST['name']);
$real_name=clean($_POST['real_name']);
$pass=clean($_POST['pass']);
$email=clean($_POST['email']);
$level =clean($_POST['level']);
 if (!$config[0][1]) $ip=$_SERVER["REMOTE_ADDR"]; else $ip="-";
 if (!$config[1][1]) $check_email=$email; else $check_email="-";

if (!is_user($name, $check_email, $ip) && !is_user_temp($name, $check_email, $ip)){
 if (admin_add_user($name,$real_name,$pass,$email,$level)){
 echo "<meta http-equiv='refresh' content='5;url=".$_SERVER['HTTP_REFERER']."'>";

//use function system_mesages($message,$folder_level_from_root,$show_back,$message_type)
system_mesages($lang['User_Added'],'',1,0); 

 }else system_mesages($lang['an_sql_error_occurred'],'',1,1); 
}else{include $template."/header.php"; 
 echo "<meta http-equiv='refresh' content='5;url=".$_SERVER['HTTP_REFERER']."'>";
 system_mesages($lang['taken'],'',1,1);} 

 } 

}
 ?>
Return current item: Skills Evaluator - Free HR evaluation software