Additions and deletions in database processing

Source: Internet
Author: User

<?PHP//Administrator entity class    classManagemodelextendsmodel{Private $id; Private $admin _user; Private $admin _pass; Private $level; Private $limit; Private $last _ip; //interceptors (__set)         Public function__set ($_key,$_value){            $this-$_key=tool::mysqlstring ($_value); }        //interceptors (__get)         Public function__get ($_key){            return $this-$_key; }        //Set Admin login count, IP, time         Public functionSetlogincount () {$_sql="UPDATE cms_manage SET login_count=log In_count+1, last_ip= '$this->last_ip ', Last_time=now () WHERE ad Min_user= '$this->admin_user ' LIMIT 1"; returnParent::aud ($_sql); }        //get Administrator Total records         Public functiongetmanagetotal () {$_sql="SELECT COUNT (*) from Cms_manage"; returnParent::total ($_sql); }        //Query Login Administrator         Public functionGetloginmanage () {$_sql="SELECT M.admin_user, L.level_name F                                ROM cms_manage m, cms_level l WHERE M.admin_user= '$this->admin_user ' and m.admin_pass= '$this->admin_pass ' and L.id=m.level LIMIT 1"; returnParent::one ($_sql); }        //querying a single administrator         Public functionGetonemanage () {$_sql="SELECT ID, admin_user, Admin_pass,                            Level from Cms_manage WHERE Id= '$this->id ' OR admin_user= '$this->admin_user ' OR level= '$this->level ' LIMIT 1"; returnParent::one ($_sql); }        //Query All Administrators         Public functionGetallmanage () {$_sql="SELECT m.id, M.admin_user,                                M.login_count, M.last_ip, M.last_time,                                L.level_name from Cms_manage m,                                Cms_level l WHERE l.id=m.level ORDER by M.id DESC$this->limit "; returnParent::all ($_sql); }        //New Admin         Public functionAddmanage () {$_sql="INSERT into Cms_manage (Admin_user,                                                Admin_pass, Level,                                      Reg_time) VALUES ('$this->admin_user ', '$this->admin_pass ', '$this->level ', Now ())"; returnParent::aud ($_sql); }        //Modify Administrator         Public functionUpdatemanage () {$_sql= "UPDATE cms_manage SET admin_pass= ' /c1>$this->admin_pass ', level= '$this->level ' WHERE id= '$this->id ' LIMIT 1"; returnParent::aud ($_sql); }        //Remove Administrator         Public functionDeletemanage () {$_sql="DELETE from Cms_manage WHERE Id= '$this->id ' LIMIT 1"; returnParent::aud ($_sql); }    }

Additions and deletions in database processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.