-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddmodwork.php
More file actions
95 lines (92 loc) · 2.73 KB
/
Copy pathaddmodwork.php
File metadata and controls
95 lines (92 loc) · 2.73 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
<?php
session_start();
?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<body>
<?php
if(isset($_POST)){
$modulename = addslashes($_POST['title']);
$name = $_SESSION["course"];
$description = addslashes($_POST['details']);
$uploadOk = 1;
$pi = $_FILES["Image"];
if($pi['name'] != NULL){
$target_dir = "report/";
$target_file = $target_dir . basename($_FILES["Image"]["name"]);
$uploadOk = 1;
$type = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$check = getimagesize($_FILES["Image"]["tmp_name"]);
if (move_uploaded_file($_FILES["Image"]["tmp_name"], $target_file)) {
$uploadOk = 1;
}
else{
$uploadOk = 0;
?>
<script type="text/javascript">
Swal.fire({
title: 'There was some error in uploading your image or video!',
type: 'warning',
allowOutsideClick: false,
animation: false,
customClass: {
popup: 'animated fadeInRight'
}
})
</script>
<?php
}
}
if($uploadOk == 1){
$con = new mysqli("localhost","root","","learndb");
$ins="insert into coursetb values ('$modulename','$name','$description','$target_file','$type')";
$result=$con->query($ins);
if($con->connect_error){
?>
<script type="text/javascript">
Swal.fire({
title: 'There was some Connection Error!!',
type: 'warning',
allowOutsideClick: false,
animation: false,
customClass: {
popup: 'animated fadeInRight'
}
})
</script>
<?php
}
else if(!$result){
?>
<script type="text/javascript">
Swal.fire({
title: 'We could not insert your data try again!!',
type: 'warning',
allowOutsideClick: false,
animation: false,
customClass: {
popup: 'animated fadeInRight'
}
})
</script>
<?php
}
else{
?>
<script type="text/javascript">
Swal.fire({
title: 'Added successfully!!',
type: 'success',
allowOutsideClick: false,
animation: false,
customClass: {
popup: 'animated fadeInRight'
},
onAfterClose: function(){
location.assign("adminpage.php");
}
});
</script>
<?php
}
}
}