Post mo yung full code for thorough help. Also use password_hash kaysa md5.
yan po bag0ng error po
Post mo yung full code for thorough help. Also use password_hash kaysa md5.
!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login</title>
<link href="
You do not have permission to view the full content of this post.
Log in or register now." rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<div class="container d-flex justify-content-center align-items-center">
<body>
<h1 class="text-center p-3">BUREAU OF SOILS & WATER MANAGEMENT </h1>
</body>
</head>
<body bgcolor="#f5f5f5">
<div class="container d-flex justify-content-center align-items-center"
style="min-height: 100vh">
<form class="border shadow p-3 rounded"
action="Login1/check-login.php"
method="post">
<h1 class="text-center p-3">BSWM LOGIN</h1>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?=$_GET['error'] ?>
</div>
<?php } ?>
<div class="mb-3">
<label for="username"
class="form-label">User name</label>
<input type="text"
class="form-control"
name="username"
id="username">
</div>
<div class="mb-3">
<label for="password"
class="form-label">Password</label>
<input type="password"
name="password"
class="form-control"
id="password" aria-describedby="PasswordHelp">
<div id="PasswordHelp" class="form-text">Reminder! We'll never share your Password with anyone.</div>
</div>
<div class="mb-0">
<label class="form-label">Select User Type:</label>
</div>
<select class="form-select mb-3"
name="role"
aria-label="Default select example">
<option selected value="user">User</option>
<option value="admin">Admin Encoder</option>
</select>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</body>
</html>
Post mo yung full code for thorough help. Also use password_hash kaysa md5.
<?php
include "../db_com.php";
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['role'])) {
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$username = test_input($_POST['username']);
$password = test_input($_POST['password']);
$role = test_input($_POST['role']);
if (empty($username)) {
header("Location: ../index.php?error=UserName is Required");
}else if (empty($password)) {
header("Location: ../index.php?error=Password is Required");
}else {
// Hashing the password
$password = md5($password);
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) === 1) {
// the user name must be unique
$row = mysqli_fetch_assoc($result);
echo "<pre>";
print_r($row);
}
}
}else {
header("Location: ../index.php");
}
Post mo yung full code for thorough help. Also use password_hash kaysa md5.
<?php
$sname = "localhost";
$uname = "root";
$password = ""
$db_name = "my_db";
$conn = mysqli_connect($sname, $uname, $password, $db_name);
if (!$conn) {
echo "Connection Failed!";
exit();
}
Post mo yung full code for thorough help. Also use password_hash kaysa md5.
YAN NA po lahat ng code po pacensya na po sir medjo po nagsisimula palang po kasi ako kaya wla pa po ako masyado alam po