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. <?php
  2. session_start();
  3. include "config.php"; // gets the config file to connect to database
  4. if($logged[userlevel] == 6) { // checks if the users level is 6 and if they are logged in
  5. switch ($_GET['remove']) {
  6. default:
  7. 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
  8. break;
  9.  
  10. case yes:
  11. $remove = mysql_query("DELETE FROM `members` WHERE `userlevel` = '1'"); // removes them from database
  12. echo "All the unactive members have been removed from the database!"; // hey! it worked! :D
  13. break;
  14.  
  15. case no:
  16. echo "You can leave this page and go back to your site."; // if you said no you get this! :O
  17. break;
  18. }
  19. } else {
  20. echo "You are not logged in, or you are not a admin."; // you are not logged in / an admin. :)
  21. }
  22. // THE END!!!!! :D
  23. ?>


Simple enough! Enjoy!
Diablosblizz's Avatar
Views:
3,229
Rating:
Posted on Wednesday 25th June 2008 at 03:49 PM
DanielXP
DanielXP's Avatar
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's Avatar
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's Avatar
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's Avatar
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's Avatar
Pretty easy, but thanks! :)
Posted on Friday 27th July 2007 at 09:00 PM
SkillMaster
SkillMaster's Avatar
Thats a nice script. :)