init
This commit is contained in:
42
.hta_slug/admin/delete-user.php
Normal file
42
.hta_slug/admin/delete-user.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$stmt = $conn->prepare("DELETE FROM users WHERE id = :id");
|
||||
$stmt->bindParam(':id', $_POST['id']);
|
||||
$stmt->execute();
|
||||
echo '<script>window.location.href = "/admin/users";</script>';
|
||||
exit();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="delete-div">
|
||||
<form method="post">
|
||||
<p style="font-size: 20px; padding: 10px 0px 10px 0px;">Confirm to Delete id <?php echo $_GET['id']; ?>? </p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
|
||||
<input type="submit" name="submit" id="submit" value="YES" style="background: linear-gradient(90deg, rgba(111, 107, 255, 0.91) 0%, rgba(68, 55, 128, 0.91) 100%); text-align: center; padding: 9px 20px 9px 20px; color: #fff; border-radius: 6px; cursor: pointer;" />
|
||||
<a href="/admin/users" style="border:3px solid #443780; text-align: center; padding: 10px 20px 10px 20px; color: #443780; border-radius: 6px;">NO</a>
|
||||
</form>
|
||||
</div>
|
||||
<style>
|
||||
.delete-div{
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #E6E5F4;
|
||||
max-width: 500px;
|
||||
min-width: 400px;
|
||||
padding: 30px 50px 30px 50px;
|
||||
border-radius: 9px
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user