-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnote_add.php
More file actions
43 lines (35 loc) · 1.18 KB
/
note_add.php
File metadata and controls
43 lines (35 loc) · 1.18 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
include "db_conn.php";
if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['username'])) {
$title = $_POST["title"];
$content = $_POST["content"];
$username = $_POST["username"];
if ($title){
if ($content){
if ($username){
// Get the current time in the Philippines
date_default_timezone_set('Asia/Manila');
$currentDateTime = date('Y-m-d H:i:s');
$date = date('Y-m-d', strtotime($currentDateTime));
$time = date('H:i:s', strtotime($currentDateTime));
$sql = "INSERT INTO `notes`(`id`, `title`, `content`, `sender`, `user`, `status`, `date`, `time`)
VALUES ('','$title','$content','','$username','created','$date','$time')";
$result = mysqli_query($conn, $sql);
if ($result){
echo "Success";
} else {
echo "Failed";
}
} else {
echo "Username";
}
} else {
echo "Content";
}
} else {
echo "Title";
}
} else {
echo "Data";
}
?>