<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="icon" type="image/x-icon" href="main/images/favicon.ico">
<link rel="stylesheet" href="app/login/login.css">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css">
</head>
<body>
<form action="../app/login/login.php" method="post">
<h1>Logowanie</h1>
<div class="container">
<label for="username">Użytkownik:</label>
<input type="text" name="username" placeholder="Nazwa Użytkownika" required>
<label for="password">Hasło:</label>
<input type="password" name="password" placeholder="Hasło" id="pass" required>
<i class="fas fa-eye" onclick="see()"></i>
<button type="submit">Zaloguj</button>
<button type="submit">Zarejestruj się</button>
<button type="submit">nie pamiętam hasła</button>
</form>
</div>
<footer class="fixed-bottom text-right pb-3 pr-5">
<small>
<span class="align-middle text-decoration-none">Made with <i class="fas fa-heart"></i> by <a href="https://www.webizo.pl" target="_blank">webizo.pl</span>
</small>
</footer>
<script>
function see() {
var x = document.getElementById("pass");
if (x.type === "password") {
x.type = "text";
}
else {
x.type = "password"
}
}
</script>
</body>
</html>
<?php
session_start();
include "../config/db_conn.php";
if (isset($_POST['uname']) && isset($_POST['password'])) {
function validate($data){
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$uname = validate($_POST['uname']);
$pass = validate($_POST['password']);
$sql = "SELECT * FROM users WHERE user_login='$uname' AND password='$pass'";
$result = mysqli_query($con, $sql);
if(mysqli_num_rows($result) >= 1){
$_SESSION["myuser"] = $data;
header("Location: ../main/selectprofile.html");
exit();
}
}
?>
mogę wysłać całe repo