Registration approval, bulk deletion

Source: Internet
Author: User

First, registration audit

(1) The database should have a table to save the registrant (the database in the table is not much to say)

(2) Write the registration page and the Registration processing page

These two pages have also been written many times, it is important to note that:

1. Have permission settings in the table (whether to let registered users log in column) This column is not displayed on the registration page

2. The Permissions column on the registration processing page can be set to a value of 0 (0 for no login, 1 for login)

There's no point in the other areas that the code will not write.

(3) login page and landing processing page

Login page There is nothing to write, but also write a lot of times, login processing page to pay attention to the authority of the judgment

if (!empty ($pwd) &&!empty ($attr) && $attr [0][0]== $pwd)  {//judging by Status $isok = "Select isOK from Renyuan Where Username= ' {$uid} ' "; $zt = $db->query ($isok);   Call the encapsulated class if ($zt [0][0]) {echo "Login succeeded!) ";} Else{echo "did not pass the audit! ";}} else{//password does not echo "password is incorrect!" ";}

(4) Since there are login rights, there is a natural administrator to modify permissions

1. Administrator changes, to the registry of all the people to traverse out, plus the permissions of the column also to traverse out, to facilitate the administrator to modify it

The code is not shown here, direct: It is through the permission column is 0, has passed the permission column is 1 (this is the time of the traversal to add a judgment condition, let you show this)

  $ZT = $v [5];  The index number is 5 is the column of permissions, assigned to $ZT  $str = "";    Give a null value, determine when to modify  if ($zt)  {      $str = "<span style= ' Color:green ' > passed </span>;  }  else  {      $str = "<a href= ' shtongguo.php?uid={$v [0]} ' > through </a>";  This is going to write the processing page through.  }           

2. Processing pages passed and rejected (passed through to be passed)

Normal is OK, just modify the statement:

$sql = "Update Renyuan set isok=1 where Username= ' {$uid} '";  The permission is 1, through, the opposite permission is 0 does not pass, that is, in the rejected processing page can write permission is 0

Second, bulk Delete

(1) To have a check box to select

Add this column to the table and add the column as you traverse, and finally add a Delete button

You can add a Select all check box, also written many times, directly

Click the Select all, the following check box is selected, is a JS

function Xuanze () {//Select All button of var zt = document.getElementById ("QX"). checked;//let all the checkboxes in the following check state change var ck = Document.getelementsbyclassname ("CK"), for (Var i=0;i<ck.length;i++) {if (ZT) {ck[i].setattribute ("checked", " Checked ");   The Add attribute is checked}else{ck[i].removeattribute ("checked");  Remove attribute}}}

(2) The deleted processing page has been written many times.

Note that the character stitching

$str = Implode ("', '", $ck);   The spelling character $str = "in (' {$str} ')"; $sql = "Delete from Renyuan where username {$str}";

(3) Prompt box when deleting

1. Simple whether to delete the prompt box

<input type= "Submit" value= "delete" onclick= "return Sctishi ()" Onclick= "return confirm (' OK to delete? ')/>   

2. Prompt for the selected item's Delete box

<input type= "Submit" value= "delete" onclick= "return Sctishi ()"  />   

Can write JS

function Sctishi () {//Find all checked items var ck = document.getelementsbyclassname ("ck"); var str = ""; for (Var i=0;i<ck.length;i++)    //Popup selected value {if (ck[i].checked)   {str + = ck[i].value+ ",";  The value of each check box   }}return confirm ("OK to delete the following data:" +str+ "");   Delete a Bullet box}        

Registration approval, bulk deletion

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.