Jump to content

Recommended Posts

Hi there, i am creating a help desk system using PHP, MySQL and i have an admin part of the system which adds, deletes and updates users to the system.

But instead of deleting the users i want to be able to disable them and then re-enable them instead of deleting as i would lose their details and would have to add the users again. This i feel would save me time.

 

This is the delete script.

 

<?php

require "connect.php";

$employeeID = $_GET['employeeID'];

$query =  "delete from employee where employeeID = ".$employeeID;

$result = mysql_query($query, $connection)

or die ("Unable to perform query<br>$query");

header("Location: displayEmployeeAdmin.php");

exit();

?>

 

And this is the script which reads the above when i delete a user.

 

<td width="130"><div align="center" class="style7"><a href="EditUserForm.php?employeeID=<?php echo $row['employeeID'];?>"><?php echo $row['firstname'];?></div></td>

    <td width="130"><div align="center" class="style7"><?php echo $row['surname'];?></div></td>

    <td width="130"><div align="center" class="style7"><?php echo $row['username'];?></div></td>

    <td width="130"><div align="center" class="style7"><?php echo $row['password'];?></div></td>

<td><a href="deleteUser.php?employeeID=<?php echo $row['employeeID'];?>">[delete]</a></td>

 

 

The actual deleting of the user is on the last line of the above script.

 

Can anyone help me with the disable and re-able code ?

 

Any Help be appreciated.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/83254-disabling-and-enabling-users/
Share on other sites

Well your DB Table

 

Users

  username    active

        test        1

 

$active = mysql_query("SELECT users.active FROM users WHERE users.username = '$username');

 

if($active == 1){

echo "Welcome user";

} else {

echo "Sorry this account is inactive";

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.