示例#1
0
文件: process.php 项目: javzero/admin
     $Password = md5(htmlentities($_POST['password']));
     $PasswordFilter = ",password='******'";
 }
 $Image = $_POST['newimage'];
 $User = htmlentities(strtolower($_POST['user']));
 $FirstName = htmlentities($_POST['first_name']);
 $LastName = htmlentities($_POST['last_name']);
 $Email = htmlentities($_POST['email']);
 $ProfileID = $_POST['profile'];
 $Status = $_POST['status'] == "on" ? 'A' : 'I';
 $Groups = $_POST['groups'] ? explode(",", $_POST['groups']) : array();
 $Menues = $_POST['menues'] ? explode(",", $_POST['menues']) : array();
 $Dir = array_reverse(explode("/", $Image));
 if ($Dir[1] != "default" && $ID != $Admin->AdminID) {
     $Temp = $Image;
     $Image = $Edit->ImgGalDir() . $Dir[0];
     // echo $Image;
     // echo "<br><br>".$ID."/".$Admin->AdminID;
     copy($Temp, $Image);
 }
 $Insert = $DB->execQuery('update', 'admin_user', "user='******'" . $PasswordFilter . ",first_name='" . $FirstName . "',last_name='" . $LastName . "',email='" . $Email . "',status='" . $Status . "',profile_id='" . $ProfileID . "',img='" . $Image . "'", "admin_id=" . $ID);
 //echo $DB->lastQuery();
 $DB->execQuery('delete', 'relation_admin_group', "admin_id = " . $ID);
 $DB->execQuery('delete', 'menu_exception', "admin_id = " . $ID);
 for ($i = 0; $i < count($Groups); $i++) {
     $Values .= $i == 0 ? $ID . "," . $Groups[$i] : "),(" . $ID . "," . $Groups[$i];
 }
 $DB->execQuery('insert', 'relation_admin_group', 'admin_id,group_id', $Values);
 $Values = "";
 for ($i = 0; $i < count($Menues); $i++) {
     $Values .= $i == 0 ? $ID . "," . $Menues[$i] : "),(" . $ID . "," . $Menues[$i];
示例#2
0
 public function Update()
 {
     $ID = $_POST['id'];
     $Edit = new AdminData($ID);
     if ($_POST['password']) {
         $Password = md5(htmlentities($_POST['password']));
         $PasswordFilter = ",password='******'";
     }
     $Image = $_POST['newimage'];
     $User = htmlentities(strtolower($_POST['user']));
     $FirstName = htmlentities($_POST['first_name']);
     $LastName = htmlentities($_POST['last_name']);
     $Email = htmlentities($_POST['email']);
     $ProfileID = $_POST['profile'];
     $Groups = $_POST['groups'] ? explode(",", $_POST['groups']) : array();
     $Menues = $_POST['menues'] ? explode(",", $_POST['menues']) : array();
     $Dir = array_reverse(explode("/", $Image));
     if ($Dir[1] != "default" && $ID != $this->AdminID) {
         $Temp = $Image;
         $Image = $Edit->ImgGalDir() . $Dir[0];
         copy($Temp, $Image);
     }
     $Update = $this->execQuery('update', 'admin_user', "user='******'" . $PasswordFilter . ",first_name='" . $FirstName . "',last_name='" . $LastName . "',email='" . $Email . "',profile_id='" . $ProfileID . "',img='" . $Image . "'", "admin_id=" . $ID);
     //echo $this->lastQuery();
     $this->execQuery('delete', 'relation_admin_group', "admin_id = " . $ID);
     $this->execQuery('delete', 'relation_admin_menu', "admin_id = " . $ID);
     foreach ($Groups as $Group) {
         if (intval($Group) > 0) {
             $Values .= !$Values ? $ID . "," . $Group : "),(" . $ID . "," . $Group;
         }
     }
     $this->execQuery('insert', 'relation_admin_group', 'admin_id,group_id', $Values);
     //echo $this->lastQuery();
     $Values = "";
     foreach ($Menues as $Menu) {
         if (intval($Menu) > 0) {
             $Values .= !$Values ? $ID . "," . $Menu : "),(" . $ID . "," . $Menu;
         }
     }
     $this->execQuery('insert', 'relation_admin_menu', 'admin_id,menu_id', $Values);
 }