-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpost.php
executable file
·31 lines (22 loc) · 1.01 KB
/
post.php
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
<?php
include('db.php');
$mydata = $mysqli->query("SELECT * from account WHERE uid = '".$_COOKIE['uid']."'");
$row = $mydata->fetch_assoc();
$username = $row['username'];
$name_of_project = $_POST['name_of_project'];
$description = $_POST['description'];
$looking_at = $_POST['looking_at'];
$id = $_POST['id'];
$category = $_POST['categories'];
echo $category;
$dt = new DateTime();
if($id == 0){
// create a new row
$mydata = $mysqli->query("INSERT INTO `project` (`id`, `name_of_project`, `description`, `looking_at`, `username`, `datetime`,`category`) VALUES (NULL, '".$name_of_project."', '".$description."', '".$looking_at."', '".$username."', '".($dt->format('Y-m-d H:i:s'))."','".$category."')");
header("location: /DavisHack_2017/the-network-master/main_page.php");
}
else{
//modify an existing project
$mydata = $mysqli->query("UPDATE project SET name_of_project = '".$name_of_project."', description = '".$description."', looking_at= '".$looking_at."' WHERE id='".$id."'");
}
?>