-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddShouts.php
More file actions
25 lines (25 loc) · 842 Bytes
/
addShouts.php
File metadata and controls
25 lines (25 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include 'dbconn.php';
if (session_status() == PHP_SESSION_NONE) {
session_start();
if($_SESSION['fname']==''){header('Location:login.php');}
}
if(trim($_POST['shout_content'])!='') {
$user_id = $_SESSION['user_id'];
connect();
$shout_time = (string)(microtime(true))*10000;
$curr_date_time = date("Y-m-d H:i:s");
$u_id=$_SESSION['user_id'];
$contents = $_POST['shout_content'];
$stmt = $conn->prepare("INSERT INTO SHOUT (SHOUT_ID, USER_ID,CONTENT,ADD_DATE) VALUES(?, ?, ?, ?)");
$stmt->bind_param("iiss",
$shout_time,
$u_id,
$contents,
$curr_date_time);
if ($stmt->execute() === FALSE) {
echo "Error<br>" . $conn->error;
}
}
header('Location: shouts.php');
?>