-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateproject.php
More file actions
39 lines (38 loc) · 1.45 KB
/
createproject.php
File metadata and controls
39 lines (38 loc) · 1.45 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
<html>
<?php
session_start();
require 'head.php';
?>
<body>
<?php
require 'dbconnect.php';
$title = $_POST["title"];
$shortdescription = $_POST["description"];
$selectedcategory = $_POST["selectedcategory"];
$minfund = $_POST["minfund"];
$maxfund = $_POST["maxfund"];
$enddate = $_POST["enddate"];
$releasedate = $_POST["releasedate"];
$imagename = $_FILES["myimage"]["name"];
$user_name = $_SESSION['email'];
$sqlproject = "INSERT INTO project(title, shortdescription, bannername, postdate, enddate, plannedrelease, minfund, maxfund, owneremail, status, categoryname) values ('".$title."', '".$shortdescription."', '".$imagename."', now(), '".$enddate."', '".$releasedate."', ".$minfund.", ".$maxfund.", '".$user_name."', 'open', '".$selectedcategory."')";
if ($conn->query($sqlproject) === TRUE) {
$projectid = $conn->insert_id;
// echo "Congratulations!! Your project has been created successfully.";
} else {
echo "Error: <br>" . $conn->error;
}
if($imagename != null){
$imgData = addslashes(file_get_contents($_FILES['myimage']['tmp_name']));
$sqlimage = "INSERT INTO media(name, media) VALUES ('{$imagename}', '{$imgData}')";
if ($conn->query($sqlimage) === TRUE) {
// echo "New record created successfully";
} else {
echo "Error: <br>" . $conn->error;
}
}
$redirectTo ='projectdetail.php?projectid='.$projectid.'';
echo "<script type='text/javascript'>document.location.href='{$redirectTo}';</script>";
?>
</body>
</html>