Admin Management interface-Administrator admin [2]

Source: Internet
Author: User
Tags sql error

In this chapter we begin the design of the background management interface, this section mainly operates the Administrator module.


A Front-end new management
Html
<form id= "Manage_add" style= "margin:0;padding:5px 0 0
25px;color: #333; " >
<p> Admin Account: <input type= "text" name= "manager" class= "TextBox"
Style= "width:200px;" ></p>
<p> admin Password: <input type= "password" name= "password" class= "textbox"
Style= "width:200px;" ></p>
<p> Assigning permissions: <input id= "auth" class= "textbox" Name= "Auth"
Style= "WIDTH:205PX;" ></p>
</form>
New management pop-up window
$ (' #manage_add '). Dialog ({
WIDTH:350,
Title: ' New Management ',
Iconcls: ' Icon-user-add ',
Modal:true,
Closed:true,
Buttons: [
{
Text: ' Submit ',
Iconcls: ' Icon-add-new ',
Handler:function () {
if ($ (' #manage_add '). Form (' Validate ')) {
$.ajax ({
URL: ' addmanager.php ',
Type: ' POST ',
Data: {
Manager:
$.trim ($ (' input[name= "manager"]). Val ()),

Auth: $ (' #auth '). Combotree (' GetText '),
Password:
$.trim ($ (' input[name= ' password "] '). Val ()),
},
Beforesend:function () {
$.messager.progress ({
Text: ' Attempting to commit ... ',
});
},
Success:function (data, Response, status) {
$.messager.progress (' close ');
if (Data > 0) {
$.messager.show ({
title: ' Hint ',
msg: ' New management succeeded! ',
});
$ (' #manage_add '). Dialog (' Close '). Form (' Reset ');
$ (' #manage '). DataGrid (' reload ');
} else {
$.messager.alert (' Warning action ', ' unknown operation,
please resubmit! ', ' warning ');
}
}
});
}
},
},
{
Text: ' Cancel ',
Iconcls: ' Icon-redo ',
Handler:function () {
$ (' #manage_add '). Dialog (' Close '). Form (' Reset ');
},
}
],
});
//Manage account number
$ (' input[name= "manager"]). Validatebox ({
Required:true,
Validtype: ' length[2,20] ',
Missingmessage: ' Please enter a management name ',

Invalidmessage: ' Management name in 2-20 bits ',
});
//Manage Password
$ (' input[name= ' password "]). Validatebox ({
Required:true,
Validtype: ' length[6,30] ',
Missingmessage: ' Please enter admin password ',
invalidmessage: ' Manage password in 6-30 bit ',
} ';
//Assign Permissions
$ (' #auth '). Combotree ({
URL: ' nav.php ',
Required:true,
Lines:true,
Multiple:true,
Checkbox:true,
Onlyleafcheck:true,
Onloadsuccess:function (node, data) {
var _this = this;
if (data) {
$ (data). Each (function (index, value) {
if (this.state = = ' closed ') {
$ (_this). Tree (' ExpandAll ');
}
});
}
},
});
//Click add
Manage_tool = {
Add:function () {
$ (' #manage_add '). Dialog (' Open ');
$ (' input[name= "manager"]). focus ();
},
};
Two. Server-side new
//addmanager.php
<?php
require ' config.php ';

$manager = $_post[' manager '];
$auth = $_post[' auth ');
$password = SHA1 ($_post[' password ');
$date = time ();
mysql_query ("INSERT into Easyui_admin (manager,password,auth,date)
VALUES (' $manager ', ' $password ', ' $auth ', ' $date ') ') or Die (' SQL Error! ‘);
Echo Mysql_affected_rows ();
Mysql_close ();
?>

Admin Management interface-Administrator admin [2]

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.