Delete user from profile page

Started by rickandmary, July 22, 2012, 01:17:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rickandmary

This allow you to delete a users account from userdetails.
add to userdetails.php

if ($CURUSER["class"] < UC_ADMINISTRATOR)
   print("<input type=hidden name=deluser>");
else
  print("<tr><td class=rowhead>Delete User</td><td colspan=2 align=left><INPUT TYPE=CHECKBOX NAME=deluser></td></tr>");


add to file modtask.php

//delete user
if (!empty($_POST["deluser"])){
   $res=@mysql_query("SELECT * FROM users WHERE id = $userid") or sqlerr(__FILE__, __LINE__);
   $user = mysql_fetch_array($res);
   $username = $user["username"];
   $email=$user["email"];
   mysql_query("DELETE FROM users WHERE id = $userid") or sqlerr(__FILE__, __LINE__);
   $deluserid=$CURUSER["username"];
   write_log("User account $username was deleted by $deluserid");
barf();
  }


credit to author