Server : LiteSpeed System : Linux in-mum-web1002.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u811747229 ( 811747229) PHP Version : 8.0.30 Disable Function : NONE Directory : /home/u811747229/domains/lakshiagrichem.com/public_html/admin/ |
<?php
include("../db.php");
session_start();
// *************************************** checking *****************************************
if(empty($_SESSION["admin_email"])){
header("location:../index.php");
}
// *************************************** users *****************************************
$id=$_GET["id"];
$select="SELECT * FROM users WHERE id='$id'";
$result=mysqli_query($conn,$select);
$row=mysqli_fetch_assoc($result);
// *************************************** update *****************************************
if(isset($_POST["Submit"])){
$type=$_POST["type"];
if(empty($type)){
$err="Select Something";
}
$update="UPDATE users SET type='$type' WHERE id='$id'";
mysqli_query($conn,$update);
header("location:home.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lakshi Agrichem Admin Dashbord</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<link rel="shortcut icon" href="../assets//images/LOGO.png" type="image/svg+xml">
<link rel="stylesheet" href="update_user.css">
</head>
<body>
<div class="nine">
<h1>Update User<span>Agro chem</span></h1>
</div>
<div class="fd">
<p style="color: red;"><?php if(isset($err)){ echo $err; } ?></p>
<form action="<?php htmlspecialchars($_SERVER["PHP_SELF"]) ?>" method="post">
<div class="mb-3">
<label for="disabledTextInput" class="form-label">User :</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="<?php echo $row["username"]; ?>" disabled>
</div>
<div class="mb-3">
<label for="disabledTextInput" class="form-label">Email :</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="<?php echo $row["email"]; ?>" disabled>
</div>
<select name="type" class="form-select" aria-label="Default select example">
<option selected value="user">user</option>
<option value="admin">admin</option>
</select>
<input type="submit" name="Submit" value="Submit" class="btn btn-primary">
<a href="home.php" type="button" class="btn btn-outline-secondary">Cancle</a>
</form>
</div>
</body>
</html>