-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojectAddition.php
More file actions
155 lines (125 loc) · 6.09 KB
/
Copy pathprojectAddition.php
File metadata and controls
155 lines (125 loc) · 6.09 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
session_start();
include 'databaseConnection.php';
if ($error != null) {
echo '<p> cant connect to DB<br>';
}
else{
if (!isset($_SESSION['userID'])) {
echo "<script>alert('You are not logged in, please login or sign up first');</script>";
echo "<script>window.location = 'index.php';</script>";
exit();
}
if(!isset($_SESSION['userType']) || $_SESSION['userType']=="client") {
echo "<script> alert('You do not have access to this page');</script>";
echo "<script>window.location = 'clientHomepage.php';</script>";
}
$designerID = $_SESSION['userID'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="projectAddition.css?v=<?php echo time(); ?>">
<link rel="stylesheet" href="basic.css?v=<?php echo time(); ?>">
<title>Design Consultation page </title>
</head>
<body>
<header id="topBar">
<a href="designerHomePage.php"><img class="logo" alt="logo" src="images/lightBeigeLogo.png" ></a>
<a id="logout" href="logout.php">Log-out</a>
</header>
<main>
<div id="grid-home2">
<div id="textWrapper">
<p class="text">
<strong id="welcome"> Add a new project </strong>
</p>
</div>
</div>
<div class="info">
<h1>New Project</h1>
<form action="projectAdditionPHP.php" method="post" enctype="multipart/form-data">
<div class="item">
<label for="name">Project Name:</label> <br>
<input type="text" id="name" name="name" placeholder="Enter your project's name" required>
</div> <br>
<label for="image">Upload file:</label><br>
<input type='file' id='image' name='image'> <br><br>
<div class="item">
<label for="name">Design Category:</label> <br>
<select id="category" name="category">
<?php
$sql='SELECT * FROM designcategory';
$result= mysqli_query($connection, $sql);
while($row= mysqli_fetch_assoc($result))
{echo '<option name="'.$row['category'].'" value="'.$row['category'].'">'.$row['category'].'</option>';}
?>
</select>
</div> <br>
<div class="item">
<label for="description">Project Description:</label> <br>
<textarea id="description" name="description" placeholder="Enter a description for your project. Don't be afraid to get into details!" rows="8" cols="50" required></textarea>
</div> <br>
<input type='submit' value='Send' id="submitButten1" name="submitButten1">
</form>
</div>
</div>
<?php
// if (isset($_POST['submitButten1'])) {
// if (isset($_POST['name']) && isset($_POST['category']) && isset($_POST['description']) && isset($_FILES["image"]) && $_FILES["image"]["error"] == 0) {
// $pName = $_POST['name'];
// $description = $_POST['description'];
// $category = $_POST['category'];
//
// // Prepare the query to insert data
// $queryCat = "SELECT id FROM designcategory WHERE category='$category'";
// $result = mysqli_query($connection, $queryCat);
// $row = mysqli_fetch_assoc($result);
// $categoryID = $row['id'];
//
// // Generate unique filename for the uploaded image
// $path_parts = pathinfo($_FILES["image"]["name"]);
// $extension = $path_parts['extension'];
// $filenewname = $pName . "_" . uniqid() . "." . $extension;
// $folder = "images/" . $filenewname;
//
// // Move uploaded file to the desired location
// if (move_uploaded_file($_FILES['image']['tmp_name'], $folder)) {
// // Insert data into database
// $sql = "INSERT INTO designportoflioproject (designerID, projectName, projectImgFileName, description, designCategoryID) VALUES (?, ?, ?, ?, ?)";
// $stmt = $connection->prepare($sql);
// $stmt->bind_param("isssi", $designerID, $pName, $filenewname, $description, $categoryID);
// if ($stmt->execute()) {
// echo '<script>alert("Project added successfully.");</script>';
// echo '<script>window.location = "designerHomePage.php";</script>';
// exit();
// } else {
// echo '<script>alert("Failed to add project.");</script>';
// }
// } else {
// echo '<script>alert("Failed to upload image.");</script>';
// }
// } else {
// echo '<script>alert("Failed to submit the form.");</script>';
// }
//}
?>
</main>
<footer>
<p>Contact Us |Phone: 0116753695 |Email: <a id="email" href="mailto:LuminousDesign@LuminousDesign.com">LuminousDesign@LuminousDesign.com</a></p>
<p>Follow Us</p>
<div class="social-media-icons">
<a href=""><img src="images/x.png" alt="x icon" ></a>
<a href=""><img src="images/f.png" alt="facebook icon"></a>
<a href=""><img src="images/insta.png" alt="instagram icon"></a>
<a href=""><img src="images/in.png" alt="linkedIn icon"></a>
<a href=""><img src="images/p.PNG" alt="pintrest icon"></a>
<a href=""><img src="images/t.png" alt="tiktok icon"></a>
</div>
<p>© 2024 Luminous Design, All Rights Reserved.</p>
</footer>
</body>
</html>