-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
21 lines (17 loc) · 728 Bytes
/
process.php
File metadata and controls
21 lines (17 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
include 'database.php';
// Check if form submitted
if(isset($_POST['user']) && isset($_POST['message'])){
$user = mysqli_real_escape_string($conn, $_POST['user']);
$message = mysqli_real_escape_string($conn, $_POST['message']);
$date = mysqli_real_escape_string($conn, $_POST['date']);
// Set timezone
date_default_timezone_set('Europe/Sarajevo');
$date = date('h:i:s a', time());
$query = "INSERT INTO shouts (user, message, date) VALUES ('$user', '$message', '$date')";
if(!mysqli_query($conn, $query)){
echo 'Error: ' . mysqli_error($conn);
} else {
echo '<li>' . $date . ' - ' . '<strong>'.ucwords($user) . ':</strong> ' . $message . '</li>';
}
}