jun 14
This commit is contained in:
@@ -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
15
php/index_loged.php
Normal 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';
|
||||
}
|
||||
?>
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -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
34
php/send_email.php
Normal 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user