Commit 93b64d57 authored by Ayush's avatar Ayush

Minor fix

parent bf95b9eb
...@@ -11,21 +11,14 @@ if (isset($postData) && !empty($postData)) { ...@@ -11,21 +11,14 @@ if (isset($postData) && !empty($postData)) {
$lang = trim($request->language); $lang = trim($request->language);
$path = '../users/' . $username . '/' . trim($request->path) . '/' . $filename . $lang; $path = '../users/' . $username . '/' . trim($request->path) . '/' . $filename . $lang;
// if (file_exists($path)) { $sql1 = "SELECT n_files from users where username = '$username'";
// $msg = "file already exists"; $sql2 = "UPDATE users SET n_files = n_files+1 WHERE username = '$username'";
// clearstatcache(); $result = mysqli_query($mysqli, $sql1)->fetch_all()[0];
// echo json_encode($msg); if ($result == 10) {
// } $msg = "maximum limit(10) reached";
// else { echo json_encode($msg);
// $sql1 = "SELECT n_files from userdata where username = $username"; } else {
// $sql2 = "UPDATE userdata SET n_files = n_files+1 WHERE username = $username "; if (mysqli_query($mysqli, $sql2)) {
// $result = mysqli_query($mysqli, $sql1);
// if($result == 10){
// $msg = "maximum limit(10) reached";
// echo json_encode($msg);
// }
// else{
// if($result = mysqli_query($mysqli, $sql2)) {
$myfile = fopen($path, "w"); $myfile = fopen($path, "w");
fwrite($myfile, $data); fwrite($myfile, $data);
fclose($myfile); fclose($myfile);
...@@ -33,13 +26,9 @@ if (isset($postData) && !empty($postData)) { ...@@ -33,13 +26,9 @@ if (isset($postData) && !empty($postData)) {
$msg = "file successfully uploaded"; $msg = "file successfully uploaded";
clearstatcache(); clearstatcache();
echo json_encode($msg); echo json_encode($msg);
// } } else {
// else{ http_response_code(404);
// http_response_code(404); }
// } }
// }
// }
} }
?> ?>
...@@ -49,11 +49,11 @@ export class HomeComponent implements OnInit { ...@@ -49,11 +49,11 @@ export class HomeComponent implements OnInit {
} }
openForm(): void { openForm(): void {
document.getElementById("popupForm").style.display = "block"; document.getElementById('popupForm').style.display = 'block';
} }
closeForm(): void { closeForm(): void {
document.getElementById("popupForm").style.display = "none"; document.getElementById('popupForm').style.display = 'none';
} }
resetForm(): void { resetForm(): void {
...@@ -71,15 +71,18 @@ export class HomeComponent implements OnInit { ...@@ -71,15 +71,18 @@ export class HomeComponent implements OnInit {
} }
submitForm() { submitForm() {
this.questiontoPost.start_time = this.questiontoPost.start_time.split('T').join(' ');
this.questiontoPost.end_time = this.questiontoPost.end_time.split('T').join(' ');
this.questionService.uploadQues(this.questiontoPost).subscribe( this.questionService.uploadQues(this.questiontoPost).subscribe(
(event: any) => { (event: any) => {
if (typeof (event) === 'object') { if (typeof (event) === 'object') {
this.questiontoPost = null; this.questiontoPost = null;
(document.getElementById('quesform') as HTMLInputElement).value = ''; (document.getElementById('quesform') as HTMLInputElement).value = '';
} }
}
);
this.resetForm(); this.resetForm();
this.closeForm(); this.closeForm();
} }
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment