Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 654
0 Users 5 Guests Online

Remove all unactive members from database

Nothing much here, just copy and paste this into a file!

I called it remove.php, but you can call it what you want:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
session_start
();
include 
"config.php"// gets the config file to connect to database 
if($logged[userlevel] == 6) { // checks if the users level is 6 and if they are logged in
switch ($_GET['remove']) {
default:
echo 
"<center>Would you like to remove the unactive members in the database?<BR><a href='?remove=yes'>Yes</a> | <a href='?remove=no'>No</a>"// asking if you want to remove them, yes or no
break;

case 
yes:
$remove mysql_query("DELETE FROM `members` WHERE `userlevel` = '1'"); // removes them from database
echo "All the unactive members have been removed from the database!"// hey! it worked! :D
break;

case 
no:
echo 
"You can leave this page and go back to your site."// if you said no you get this! :O
break;
}
} else {
    echo 
"You are not logged in, or you are not a admin."// you are not logged in / an admin. :)
}
// THE END!!!!! :D
?>


Simple enough! Enjoy!
Diablosblizz
Views:
2353
Rating:
Posted on Wednesday 25th June 2008 at 03:49 PM
DanielXP
DanielXP
user level is really it sets from 1 (not verified) to 2 (what is)
Posted on Monday 23rd June 2008 at 05:28 PM
ilyas-shezad
ilyas-shezad
nice script.
theres an easier way to do this though.

After activation a users Userlevel is set to 1 from 0. all those that are not activated will be deleted at userlevel 0.
Posted on Friday 18th January 2008 at 12:51 AM
ShadowMage
ShadowMage
haha yeah. that's why after a set amount of time you could make a different level to delete.
Posted on Thursday 17th January 2008 at 03:45 PM
Thomas
Thomas
Wouldn't this just delete all the users with a ;evel of one from the database? O_o
Posted on Saturday 28th July 2007 at 02:29 PM
Diablosblizz
Diablosblizz
Pretty easy, but thanks! :)
Posted on Friday 27th July 2007 at 09:00 PM
SkillMaster
SkillMaster
Thats a nice script. :)