This commit is contained in:
2024-06-14 16:58:36 +02:00
parent 235c37f17f
commit 252fe7ce44
19 changed files with 1864 additions and 1668 deletions

View File

@@ -1,12 +0,0 @@
<?php
require 'connect.inc.php';
require 'core.inc.php';
if (loggedin()) {
$name = getuserfield('name');
echo ' You are logged in '. $name.' <a href="logout.php">Log out</a><br>';
} else {
include 'login.php';
}
?>

15
php/index_loged.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
require 'connect.inc.php';
require_once 'core.inc.php';
if (loggedin()) {
$name = getuserfield('name');
// echo ' You are logged in '. $name.' <a href="logout.php">Log out</a><br>';
header('Location: ../index.php');
} else {
include 'login.php';
}
?>

View File

@@ -1,6 +1,6 @@
<?php
require 'connect.inc.php';
require 'core.inc.php';
require_once 'core.inc.php';
if (isset($_POST['email']) && isset($_POST['password'])) {
$email = $_POST['email'];
@@ -20,7 +20,7 @@ if (isset($_POST['email']) && isset($_POST['password'])) {
$user_id = $row['id'];
$_SESSION['user_id'] = $user_id;
header('Location: ../index.html');
header('Location: index_loged.php');
}
} else {
}

View File

@@ -1,8 +1,8 @@
<?php
require 'core.inc.php';
require_once 'core.inc.php';
session_destroy();
header('Location: '. '../login.html');
header('Location: '. '../index.php');
?>

34
php/send_email.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Collect form data
$name = htmlspecialchars($_POST['name']);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$message = htmlspecialchars($_POST['message']);
// Validate email
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "Invalid email format";
exit;
}
// Email details
$to = "veatio8@gmail.com";
$subject = "New Contact Form Submission";
$headers = "From: " . $email . "\r\n" .
"Reply-To: " . $email . "\r\n" .
"X-Mailer: PHP/" . phpversion();
$body = "Name: $name\n";
$body .= "Email: $email\n\n";
$body .= "Message:\n$message";
// Error handling with detailed information
if (mail($to, $subject, $body, $headers)) {
echo "Email sent successfully!";
} else {
// Use error_get_last() to capture the last error
$error = error_get_last()['message'];
echo "Failed to send email. Error: " . $error;
}
}
?>