Example #1
0
 public function editUser($UID, $data)
 {
     if ($data['permitssion']) {
         if (!$this->editPermitssion($UID, $data['permitssion'])) {
             return false;
         }
     }
     if ($username = $data['username']) {
         $newdata['username'] = $username;
     }
     if ($usertype = $data['usertype']) {
         $newdata['usertype'] = get_usertype($usertype);
     }
     if ($data['oldpassword'] && $data['newpassword']) {
         $map['user_id'] = $UID;
         $map['password'] = md5($data['oldpassword']);
         if ($this->where($map)->select()) {
             $newdata['password'] = md5($data['newpassword']);
         }
     }
     if ($this->create($newdata)) {
         if (!$this->where('user_id=' . $UID)->data($newdata)->save()) {
             return false;
         }
     } else {
         return $this->getError();
     }
     return true;
 }
 public function addUser()
 {
     check_login();
     if (IS_POST) {
         $User = D('User');
         $data['username'] = I('post.username');
         $data['loginname'] = I('post.loginname');
         $data['password'] = md5(I('post.password'));
         $data['usertype'] = I('post.usertype');
         $data['usertype'] = get_usertype($data['usertype']);
         $flag = $User->addUser($data);
         if ($flag == 1) {
             $this->success('添加成功');
         } else {
             if ($flag == 0) {
                 $this->error('添加失败');
             } else {
                 $this->show($flag);
             }
         }
     }
     $this->display();
 }
Example #3
0
    <form class="form-horizontal" method="post" name="registerform" action="#">
        <div class="form-group">
            <input required="" type="text" class="form-control fname"
                   value="<?= $fname == 'default' ? '' : ucfirst($fname) ?>" placeholder="First name">
        </div>
        <div class="form-group">
            <input required="" type="text" class="form-control lname"
                   value="<?= $lname == 'default' ? '' : ucfirst($lname) ?>" placeholder="Last name">
        </div>
        <div class="form-group">


            <select required="" id="usertype" style="width:100%" class="populate usertype">

                <optgroup label="Available User types">
                    <option selected="" class="text-info" value="<?=$usr_type?>"><?=ucwords(get_usertype($usr_type,'title'))?></option>
                    <?php
                    $usertypes=get_active_usertypes();
                    foreach($usertypes as $type)
                    {
                        ?>
                        <option value="<?=$type['id']?>"><?=ucwords($type['usertype'])?></option>
                    <?php


                    }
                    ?>
                </optgroup>

            </select>
Example #4
0
					onclick="this.style.border='none'" name="search_token"/>
				<!-- <input type="submit" value="Search" /> -->
			</form>
			<a href="advanced_search.php" 
				style="margin-top: 5px; height: 30px; display: inline-block;">Advanced search</a>
		</div>
		<div class="top-strip-right"
			style="margin-top: 5px; height: 30px; ">
			<?php 
    // check for login status and if logged in,
    // replace the following div content with Currently logged in user's name
    // and provide a button to logout
    if ($user_loggedin == true) {
        ?>
			<span title="<?php 
        echo $current_user_fullname . '(' . get_usertype($current_user["usertype"]) . ')';
        ?>
">
			Welcome <?php 
        echo $current_user_fullname;
        ?>
 </span>
			<span style="width: 20px; display: inline-block; "></span>
			<a href="logout.php">Logout</a> 
			<?php 
    } else {
        ?>


			<a href="login_f.php?nh" id="login_link">Login</a> | 
			<a href="register.php?nh">Register</a> 
Example #5
0
	<div id="edit_profile_header">
		<h1>Edit your profile</h1>
	</div>


<form class="classic" method="POST" 
	action="edit_profile_action.php" >
	<fieldset>
		<legend>Review / update your profile</legend>

		<div>

			<p>
				<label>Usertype</label>
				<label><?php 
echo get_usertype($current_user["usertype"]);
?>
</label>
			</p>

			<p>
				<label>Firstname</label>
				<input type="text" id="firstname" name="firstname" 
					value="<?php 
echo $current_user["firstname"];
?>
" />
				<span class="error" id="error_firstname"></span>
			</p>

			<p>