Added (Check Duplicates Before Adding New User)

master
Abanoub Hany 2024-07-01 20:37:33 +03:00
parent 0d1a392f42
commit 5507b7af91
1 changed files with 21 additions and 17 deletions

View File

@ -1,9 +1,8 @@
<?php <?php
session_start(); session_start();
$config = include 'config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$config = include 'config.php';
$username = $_POST['username']; $username = $_POST['username'];
$password = $_POST['password']; $password = $_POST['password'];
@ -21,27 +20,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<html> <html>
<head> <head>
<title>Login</title> <title>Login</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
</head> </head>
<body> <body>
<div class="container mt-5"> <div class="container mt-5">
<h2 class="mb-4 text-center">Login</h2> <div class="row justify-content-center">
<div class="col-md-4">
<h2 class="text-center mb-4">Login</h2>
<?php if (isset($error)): ?> <?php if (isset($error)): ?>
<div class="alert alert-danger"><?php echo $error; ?></div> <div class="alert alert-danger"><?php echo $error; ?></div>
<?php endif; ?> <?php endif; ?>
<form method="post" action="login.php"> <form method="post" action="login.php">
<div class="mb-3"> <div class="mb-3">
<label for="username" class="form-label">Username</label> <label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required> <input type="text" class="form-control" id="username" name="username" required placeholder="Enter username">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="password" class="form-label">Password</label> <label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required> <input type="password" class="form-control" id="password" name="password" required placeholder="Enter password">
</div> </div>
<button type="submit" class="btn btn-primary w-100">Login</button> <button type="submit" class="btn btn-primary w-100">Login</button>
</form> </form>
</div> </div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
</body> </body>
</html> </html>