0byt3m1n1
Path:
C:
/
wamp64
/
www
/
crop
/
Crops
/
[
Home
]
File: admin-login.php
<!DOCTYPE html> <html> <head> <title>Admin Login</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; } .container { width: 300px; margin: 0 auto; padding: 20px; background-color: #ffffff; border-radius: 5px; box-shadow: 0 0 30px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #333333; } form { margin-top: 20px; } label { display: block; margin-bottom: 5px; color: #333333; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; border: 1px solid #cccccc; border-radius: 3px; } input[type="submit"] { width: 100%; padding: 10px; background-color: #007bff; color: #ffffff; border: none; border-radius: 3px; cursor: pointer; } input[type="submit"]:hover { background-color: #0056b3; } .error-message { color: #ff0000; margin-top: 10px; } </style> </head> <body style="background-color:#d3f5a4;"> <div class="container"> <h1>Admin Login</h1> <form method="POST" action="admin-login.php"> <label for="username">Username:</label> <input type="text" id="username" name="username" required> <label for="password">Password:</label> <input type="password" id="password" name="password" required> <input type="submit" value="Login"> </form> <p>forgot Password? <a href="adminforgot.php">Click here</a> to reset.</p> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "crops"; $conn = new mysqli($servername, $username, $password, $dbname); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $username = $_POST['username']; $password = $_POST['password']; // Query the database to check if the username and password match // Replace 'your_table_name' with the actual name of your table $query = "SELECT * FROM admin WHERE username = '$username' AND password = '$password'"; // Execute the query using your database connection $result = mysqli_query($conn, $query); if ($result && mysqli_num_rows($result) > 0) { header('Location: list.php'); exit; } else { // Invalid username or password echo '<p class="error-message">Invalid username or password. Please try again.</p>'; } } ?> </div> </body> </html>