Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/projekt/snake_oil_seller/php/
about_us.php
add_to_cart.php
admin.php
buy_cart.php
config.php
contact.php
create_products.php
create_tables.php
createtable.php
dbconnection.php
delete_post.php
delete_tables.php
deletepost.php
deletetable.php
entry.php
header.php
insert_posts.php
insertposts.php
leaderboard.php
log_in.php
log_out.php
main.php
my_account.php
question_maker.php
quiz_form.php
quiz_list.php
quiz_maker.php
result.php
select_posts.php
selectposts.php
shop.php
shop_item.php
shopping_cart.php
sign_in.php
title_card.php
update_posts.php
updateposts.php
user_verified.php
verify_page.php
log_in.php
74 lines ASCII Windows (CRLF)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
<?php
// Initierar sessionen
session_start();
/** @var PDO $dbconn*/
include ("dbconnection.php");
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Log in</title>
<link href="../css/snake_oil.css" rel="stylesheet">
<link href="../css/log-sign_in.css" rel="stylesheet">
</head>
<body>
<!-- Titel -->
<?php include "title_card.php";?>
<?php
$message = "";
if (!empty($_POST['username']) && !empty($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$stmt = $dbconn->prepare("SELECT username, email, usertype, password FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
if ($user && password_verify($password, $user["password"])) {
$_SESSION["username"] = $username;
$_SESSION["email"] = $user["email"];
$_SESSION["usertype"] = $user["usertype"];
$_SESSION["is_verified"] = "no";
header("Location: verify_page.php");
} else {
$message = "Wrong username or password";
}
}
?>
<!-- Logga In Ruta-->
<main>
<h1><strong>Log in:</strong></h1>
<form method="post" action="" id="form">
<table>
<tr>
<td><span style="display:flex; justify-content: right;">Username:</span></td>
<td><input type="text" name="username" size=40 maxlength=100 placeholder="Username"></td>
</tr>
<tr>
<td><span style="display:flex; justify-content: right;">Password:</span></td>
<td><input type="password" name="password" size=40 maxlength=100 placeholder="Password"></td>
</tr>
<tr>
<td><span style="display:flex; justify-content: right;">* = Obligatory:</span></td>
<td><button type="submit">Log in</button></td></tr></td>
</tr>
</table>
</form>
</main>
<!--Tillbaka-->
<div id="exit_div">
<h4>Back</h4>
<span>
<a href="log_out.php">Website</a>
<a href="sign_in.php">Create account</a>
</span>
</div>
</body>
</html>