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
contact.php
73 lines ASCII Windows (CRLF)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?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>Contact</title>
<link href="../css/snake_oil.css" rel="stylesheet">
<link href="../css/main.css" rel="stylesheet">
</head>
<body>
<!-- Titel -->
<?php include "title_card.php";?>
<!-- Rubriker -->
<?php include "header.php";?>
<!-- Hantera mail skickandet -->
<?php
$message_status = "";
if ($is_logged_in && !empty($_POST["subject"]) && !empty($_POST["message"])) {
$subject = $_POST["subject"];
$message = $_POST["message"];
$to = "kitfos23@varmdogymnasium.se";
$full_message =
"From user: " . $username . "\n\n" .
"Subject: " . $subject . "\n\n" .
"Message:\n" . $message;
$headers = "From: no-reply@snakeoil.local";
if (mail($to, $subject, $full_message, $headers)) {
$message_status = "Message sent successfully";
} else {
$message_status = "Failed to send message";
}
}
?>
<!-- Kontakt -->
<div id="container_contact">
<h5>Contact</h5>
<?php
if ($is_logged_in) {
echo "
<form method='post'>
<p>Subject</p>
<input type='text' name='subject' placeholder='Short message summary' required>
<p>Message</p>
<textarea name='message' rows='6' placeholder='What do you wish to talk about?' required></textarea>
<button type='submit'>Send</button>
</form>
<p>$message_status</p>";
} else {
echo "<p>You must be logged in to send a message.</p>";
}
?>
</div>
</body>
</html>