<?php

include "include/include_pre.php";
requireSignin(TRUE);
requireLevel(0);
$conn = connect_db($db_server, $db_username, $db_password, $db_dbname);
// define variables and set to empty values
$inputId = "";
if ($_SERVER["REQUEST_METHOD"] == "GET") {
    $inputId = testInput($_GET["id"]);
}
// die();
$sql = "DELETE FROM users\n          WHERE id={$inputId};";
// echo $sql;
if ($conn->query($sql) === TRUE) {
    header("Location: admin_users_view.php?success=true&command=delete");
    die;
} else {
    // echo "Error: " . $sql . "<br>" . $conn->error;
    if (strrpos($conn->error, "Duplicate") !== false) {
        echo "Duplicate";
    } else {
        echo $conn->error;
    }
}
Пример #2
0
<?php

include "include/include_pre.php";
requireSignin(false);
requireLevel(100);
$conn = connect_db($db_server, $db_username, $db_password, $db_dbname);
$current_user = getCurrentUser();
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php 
include 'include/include_head.php';
?>

    <title><?php 
echo $s_title;
?>
</title>

  </head>
  <body>
    <?php 
include "include/include_body.php";
?>
    <div class="container">
      <h1>
        <?php 
echo $s_dashboard;
?>
        <small><?php