-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminResourceUpdate.php
More file actions
178 lines (166 loc) · 10.9 KB
/
adminResourceUpdate.php
File metadata and controls
178 lines (166 loc) · 10.9 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
<?php
session_start();
if(
isset($_SESSION['admin_ID'])
&& !empty($_SESSION['admin_ID'])
){
//user already logged in
$id=$_SESSION['admin_ID'];
$resource_ID = $_GET['res_id'];
try{
$conn=new PDO('mysql:host=localhost:3306;dbname=dreamabroad;',"root","");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$loginQuery="SELECT * from adminprofile WHERE admin_ID=$id";
$returnobj=$conn->query($loginQuery);
$temp_profile = $returnobj->fetch(); //Fetching a single row then signle column, single value
//$fName = $temp['firstName'];
$resQuery="SELECT * from resources WHERE resource_ID=$resource_ID";
$returnobj=$conn->query($resQuery);
$temp = $returnobj->fetch();
}
catch(PDOException $e){
echo 'Connection failed: ' . $e->getMessage();
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.css" rel="stylesheet" />
<!-- custom css-->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/higherStudy.css">
<!-- fontawesome-->
<script src="https://kit.fontawesome.com/9b0ecd67ae.js" crossorigin="anonymous"></script>
<!-- roboto font-->
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;700;900;1,300&display=swap" rel="stylesheet">
<!-- raleway font-->
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@100;200;400;600;900&display=swap" rel="stylesheet">
<!-- jquery-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="icon" href="images/icon.png" type="image/x-icon">
<title>Admin Update Resources</title>
</head>
<body>
<!--navigation section-->
<section id="#navbar">
<nav class="navbar navbar-expand-lg" data-aos="fade-right;" data-aos-delay="1500">
<div class="container-fluid navigation">
<a class="navbar-brand" href="adminHome.php"><img class="logo" src="images/munna_logo_white_2.png" alt="">Dream Abroad</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span style="color: white; border: none !important;"><i class="fas fa-bars"></i></span>
</button>
<div class="collapse navbar-collapse justify-content-center" id="navbarNav">
<div class="navbar-nav ml-auto ">
<a class="nav-item nav-link active" href="adminHome.php">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link active" href="adminUserMonitoring.php">User Monitoring <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link active" href="adminHigherStudies.php">Higher Studies section<span class="sr-only">(current)</span></a>
<a class="nav-item nav-link active" href="adminScholarship.php">Scholarships section</a>
<a class="nav-item nav-link active" href="adminResearch.php">Research & Professor section</a>
<a class="nav-item nav-link active" href="adminResources.php">Preparation & Resources section</a>
<a class="nav-item nav-link active" href="adminSoplor.php">SOP/LOR section</a>
</div>
</div>
<!-- Profile button-->
<div class="navbar-nav ml-auto ">
<div class="dropdown dropstart" style="">
<a class="btn btn-secondary dropdown-toggle nav-item nav-link active profileIcon" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false" style="font-size: 1.2em;background-color: transparent; border: rectangular;color: #84B082; "><i class="far fa-user-circle">Profile</i></a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="dropdownMenuLink">
<li><a class="dropdown-item" href="#"><img src="images/admin/admin1.jpg" alt="" style="height: 20px; border-radius: 50%;"> <i><?php echo $temp_profile['admin_name'] ?></i></a></li>
<li><a class="dropdown-item" href="adminChangePassword.php" style="color: skyblue">Change Password</a></li>
<li><a class="dropdown-item" href="adminLogOutProcess.php" style="color: red"><b>Log Out</b></a></li>
</ul>
</div>
</div>
<!-- profile button end-->
</div>
</div>
</nav>
</section>
<!-- Code for add Field -->
<section id="editProfile">
<h1 class="title" style="text-align: center; background-color: #211A1E; color: #84B082;"> Update Resources and Information </h1><br>
<div class="container">
<form action="adminResourceUpdateProcess.php" method='POST' enctype="multipart/form-data">
<!-- Passing research_ID to adminResourceUpdateProcess -->
<input id="resource_ID" name="resource_ID" type="hidden" value="<?php echo $resource_ID ?>"></input>
<!-- categoryName -->
<div class="row form-group form-floating">
<input type="text" class="form-control" placeholder="Category Name" id="categoryName" name="categoryName" value="<?php echo $temp['resourceCategory']?>">
<label for="categoryName"> Category Name</label>
</div><br>
<!-- about -->
<div class="row form-group form-floating">
<textarea class="form-control" placeholder="<?php echo $temp['about']?>" id="about" name="about" value="<?php echo $temp['about']?>" style="height:200px; width=100%; font-size:14pt;"><?php echo $temp['about']?></textarea>
<label for="about"> Description</label>
</div><br>
<!-- nextExamDate-->
<div class="row">
<div class="col-lg-6 form-group form-floating">
<input type="date" class="form-control" placeholder="Next Exam Date" aria-label="Next Exam Date" id="nextExamDate" name="nextExamDate" value="<?php echo $temp['nextExamDate']?>">
<label for="nextExamDate"> Next Exam Date </label>
</div>
</div><br>
<!-- introVedioLink -->
<div class="row form-group form-floating">
<input type="text" class="form-control" placeholder="Intro Vedio Link" id="introVedioLink" name="introVedioLink" value="<?php echo $temp['introVedioLink']?>">
<label for="introVedioLink"> Intro Vedio Link</label>
</div><br>
<!-- officialWebsiteLink -->
<div class="row form-group form-floating">
<input type="text" class="form-control" placeholder="Official Website Link" id="officialWebsiteLink" name="officialWebsiteLink" value="<?php echo $temp['officialLink']?>">
<label for="officialWebsiteLink"> Official Website Link</label>
</div><br>
<!-- gDriveLink -->
<div class="row form-group form-floating">
<input type="text" class="form-control" placeholder="Google Drive Link" id="gDriveLink" name="gDriveLink" value="<?php echo $temp['gDriveLink']?>">
<label for="gDriveLink"> Google Drive Link</label>
</div><br>
<!-- moreLink -->
<div class="row form-group form-floating">
<input type="text" class="form-control" placeholder="More Resource Link" id="moreLink" name="moreLink" value="<?php echo $temp['moreLink']?>">
<label for="moreLink"> More Resource Link</label>
</div><br>
<!-- pdf -->
<div>
<label for="pdf">Upload PDF File:</label>
<input type="file" id="pdf" name="pdf" style="border: none;" value="<?php echo $temp['pdfPath']?>">
</div><br>
<!-- image -->
<div>
<label for="image">Upload Image File:</label>
<input type="file" id="image" name="image" style="border: none;" value="<?php echo $temp['imagePath']?>">
</div><br><br>
<input type="submit" value="Update Resource" class="btn btn-lg" style="background-color: royalblue; color: white"></input>
</form><br>
</div>
</section><br>
<!-- Ending -->
<!-- copyright-->
<section id="copyright" style="background-color:#84B082;">
<div class="container-fluid">
<div class="text-center p-3">
© 2021 Copyright:
<a class="text-white" href="https://dreamsabroad.com/" target="_blank">DREAMS ABROAD</a>
</div>
</div>
</section>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
<!-- MDB -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.js"></script>
</body></html>
<!-- END OF HOMEPAGE HTML CODE -->
<?php
}
else{
//$_SEESION variable isn't set and/or $_SESSION variable is empty
?>
<script>location.assign("adminLogin.php");</script>
<?php
}
?>