-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate_Job.php
More file actions
319 lines (253 loc) · 9.49 KB
/
Copy pathCreate_Job.php
File metadata and controls
319 lines (253 loc) · 9.49 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<?php
@include 'config.php';
session_start();
$creator_id = $_SESSION['user_id'];
if(!isset($creator_id)){
//header('location:Login.php');
echo "<script> window.location.href='Login.php'</script>";
};
if(isset($_POST['logout'])){
session_unset();
session_destroy();
//header('location:index.php');
echo "<script> window.location.href='index.php'</script>";
}
if(isset($_POST['next'])){
$targetDirectory = "uploads/";
$targetFile = $targetDirectory . basename($_FILES["mp3File"]["name"]);
$uploadOk = 1;
$mp3FileType = strtolower(pathinfo($targetFile, PATHINFO_EXTENSION));
/// Check file size (you can adjust this limit)
if ($_FILES["mp3File"]["size"] > 5000000) {
$message[] = 'Sorry, your file is too large.';
$uploadOk = 0;
}
// Allow only specific file formats
if ($mp3FileType != "mp3") {
$message[] = 'Sorry, only MP3 files are allowed.';
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$message[] = 'Sorry, your file was not uploaded.';
} else {
// Move the file to the specified directory
if (move_uploaded_file($_FILES["mp3File"]["tmp_name"], $targetFile)) {
$message[] = "The file " . htmlspecialchars(basename($_FILES["mp3File"]["name"])) . " has been uploaded.";
} else {
$message[] = "Error: " . $_FILES["mp3File"]["error"];
}
}
$new_audio_name=htmlspecialchars(basename($_FILES["mp3File"]["name"])) ;
if($_POST['song_name']==""){
$message[] = 'Please enter song name';
}elseif($_POST['song_writter']==""){
$message[] = 'Please enter song writers';
}elseif($_POST['singers']==""){
$message[] = 'Please enter singers';
}
elseif($new_audio_name==""){
$message[] = 'Please import the mp3 file';
}
else{
$song_name = $_POST['song_name'];
$song_writter = $_POST['song_writter'];
$singers = $_POST['singers'];
$job_query = mysqli_query($conn, "SELECT * FROM `jobs` WHERE song_name = '$song_name' ") or die(mysqli_error($conn));
if(mysqli_num_rows($job_query) > 0){
$message[] = 'Job placed already!';
}else{
//header("location:Create_Job_Step_2.php?music=$new_audio_name&song_name=$song_name&song_writter=$song_writter&singers=$singers");
echo "<script> window.location.href='Create_Job_Step_2.php?music=$new_audio_name&song_name=$song_name&song_writter=$song_writter&singers=$singers'</script>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="css/Nevigation.css" />
<link rel="stylesheet" href="css/footer.css" />
<link rel="stylesheet" href="css/glass-menu.css" />
<link rel="stylesheet" href="css/Common.css" />
<link rel="stylesheet" href="css/Create_Job.css" />
<link rel="stylesheet" href="ChatBot/botstyle.css">
<script src="ChatBot/botscript.js" defer></script>
<link rel="icon" href="images/icon.ico" type="image/x-icon" />
<title>MoodWave</title>
</head>
<body id="swup" class="transition-fade">
<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>
<form action="" method="POST" enctype="multipart/form-data">
<!--Navigation bar start-->
<center>
<section class="navigation_section">
<nav class="Navigation_Bar">
<ul>
<li><a id="index" href="#"><img src="images/Logo.png" alt="MoodWave_logo"/></a></li>
<li class="features"><a id="Need_Help" href="#">HELP</a></li>
<li><a id="About_us" href="#" class="ABOUT transition-fade" >ABOUT US</a></li>
<li>
<button name="logout">Logout</button>
</li>
</ul>
</nav>
</section>
</center>
<!--Navigation bar end-->
<br><br><br><br><br><br><br><br>
<div class="about">
<!-- partial:index.partial.html -->
<section class="Land" >
<div class="Main_topic_sides" >
CREATE NEW JOB<br />
</div>
<div class="container_mp3">
<div class="card_mp3">
<div class="drop_box">
<header>
<h4>Upload Song</h4>
</header>
<p>Files Supported: mp3</p>
<input type="file" id="fileInput" name="mp3File" onchange="handleFileSelect(event)" accept=".mp3">
<label for="fileInput" class="btn">Choose File</label>
</div>
</div>
</div>
<br><br>
<center>
<div class="Important">- Important Details -</div>
<br><br>
<div class="create_job_form-field">
<label for="create_job_inputField" class="create_job_input-label">Song Name *</label>
<input type="text" name="song_name" id="create_job_inputField" class="create_job_input-field" placeholder="Type your song name here..." required/>
</div>
<div class="create_job_form-field">
<label for="create_job_inputField" class="create_job_input-label">Writer *</label>
<input type="text" name="song_writter" id="create_job_inputField" class="create_job_input-field" placeholder="Writer of the Song..." required />
</div>
<div class="create_job_form-field">
<label for="create_job_inputField" class="create_job_input-label">Singer(s) *</label>
<input multiple type="text" name="singers" id="create_job_inputField" class="create_job_input-field" placeholder="You can add more than one singer..." required/>
</div>
<br><br>
<div class="button_holder">
<div>
<button class="middle_button_Creator_main" name="next"><i class="fa-solid fa-arrow-right"></i></button>
</div>
</div>
<br><br>
</center>
</form>
</div>
<button class="chatbot-toggler">
<span class="material-symbols-outlined">mode_comment</span>
<span class="material-symbols-outlined">close</span>
</button>
<div class="chatbot">
<header>
<h2>Moody</h2>
<span class="close-btn material-symbols-outlined">close</span>
</header>
<ul class="chatbox">
<li class="chat incoming">
<span class="material-symbols-outlined">smart_toy</span>
<p>Hi there 🖐️ <br> How can I help you today?</p>
</li>
</ul>
<div class="chat-input">
<textarea name="" id="" cols="20" rows="2" placeholder='Enter a message...'></textarea>
<span id="send-btn" class="material-symbols-outlined">send</span>
</div>
</div>
<script>
let counter = 0;
function increment() {
counter++;
}
function decrement() {
counter--;
}
function get() {
return counter;
}
const inc = document.getElementById("increment");
const input = document.getElementById("input");
const dec = document.getElementById("decrement");
inc.addEventListener("click", () => {
increment();
input.value = get();
});
dec.addEventListener("click", () => {
if (input.value > 0) {
decrement();
}
input.value = get();
});
</script>
<!--Need-->
<script src="JS/vanilla-tilt.min.js"></script>
<script>
VanillaTilt.init(document.querySelectorAll(".card"), {
max: 25,
speed: 400,
glare: true,
"max-glare": 1,
});
</script>
<script src="JS/Script.js"></script>
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
AOS.init();
</script>
<!--Loader script end-->
<script src="https://unpkg.com/swup@4"></script>
<script>
const swup = new Swup();
</script>
<script>
function handleFileSelect(event) {
const fileInput = event.target; // Get the file input element
const fileName = fileInput.files[0].name; // Get the name of the selected file
const header = document.querySelector('.drop_box header h4'); // Get the h4 element
// Update the content of the h4 element with the file name
header.textContent = fileName;
}
</script>
<script>
document.getElementById("About_us").addEventListener("click", function(event) {
event.preventDefault();
window.location.href = 'About_us.php';
});
document.getElementById("Need_Help").addEventListener("click", function(event) {
event.preventDefault();
window.location.href = 'Need_Help.php';
});
document.getElementById("index").addEventListener("click", function(event) {
event.preventDefault();
window.location.href = 'index.php';
});
</script>
</html>