Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/projekt/snake_oil_seller/php/
about_us.php
admin.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
verify_page.php
72 lines UTF-8 Windows (CRLF)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Verification</title>
<link href="../css/snake_oil.css" rel="stylesheet">
<link href="../css/log-sign_in.css" rel="stylesheet">
</head>
<body>
<?php
session_start();
?>
<h2>Verifiera ditt konto</h2>
<?php
include ('dbconnection.php');
if (isset($_POST['email']) && isset($_POST['password']) && !empty($_POST['email']) && !empty($_POST['password'])) {
// Hämtar email och lösenord från formuläret
$email = $_POST['email'];
$password = $_POST['password'];
$username = $_SESSION['username'];
// Kontrollerar lösenordet med det i databasen
$sql = "SELECT password FROM users WHERE username = ?";
$stmt = $dbconn->prepare($sql);
$data = array($username);
$stmt->execute($data);
$res = $stmt->fetch(PDO::FETCH_ASSOC);
$hash = $res["password"];
}
// Skickar verifieringskod via mail
if (isset($_POST['email']) && isset($_POST['password']) && !empty($_POST['email']) && !empty($_POST['password'])) {
if (password_verify($password, $hash)) {
$subject = 'Snake Oil Seller Account Verification';
$message = 'Welcome to Snake Oil Seller! In order to verify that it is you that is trying to log in please press the "Verify Account" button below.';
if(mail($email, $subject, $message) && $_SERVER['SERVER_NAME'] != "localhost") {echo "mail skickats";}
if ($_SERVER['SERVER_NAME'] == "localhost") {
echo "Du är på localhost, använd denna länk för att fortsätta: <a href='user_verified.php' style='text-decoration: underline;'>- Verifiera konto -</a>";
}
}
}
?>
<!-- Skapa Konto Ruta -->
<main>
<form method="post" action="" id="form">
<table>
<tr>
<td><span style="display:flex; justify-content: right;">E-mail*:</span></td>
<td><input type="text" name="email" size=40 maxlength=100 placeholder="kristiantyrann@gmail.com"></td>
</tr>
<tr>
<td><span style="display:flex; justify-content: right;">Skriv om lösenord*:</span></td>
<td><input type="password" name="password" size=40 maxlength=30 placeholder="XxRIPTheGoatxX"></td>
</tr>
<tr>
<td><span style="display:flex; justify-content: right;">* = obligatoriskt:</span></td>
<td><button type="submit">Skicka verifierings kod</button></td>
</tr>
</table>
</form>
</main>
<!--Tillbaka-->
<div id="exit_div">
<h4>Tillbaka</h4>
<a href="log_out.php">Startsida</a>
</div>
</body>
</html>