Skip to content

Commit c093a31

Browse files
committed
All Files are updated
1 parent cc6dd06 commit c093a31

File tree

1,954 files changed

+647877
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,954 files changed

+647877
-0
lines changed

404.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="error-content">
2+
<h3><i class="fas fa-exclamation-triangle text-danger"></i> Oops! Page not found.</h3>
3+
4+
<p>
5+
We could not find the page you were looking for.
6+
Meanwhile, you may <a href="./">return to dashboard</a> or try using the search form.
7+
</p>
8+
9+
</div>

admin_class.php

+352
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
<?php
2+
session_start();
3+
ini_set('display_errors', 1);
4+
Class Action {
5+
private $db;
6+
7+
public function __construct() {
8+
ob_start();
9+
include 'db_connect.php';
10+
11+
$this->db = $conn;
12+
}
13+
function __destruct() {
14+
$this->db->close();
15+
ob_end_flush();
16+
}
17+
18+
function login(){
19+
extract($_POST);
20+
$qry = $this->db->query("SELECT *,concat(firstname,' ',lastname) as name FROM users where email = '".$email."' and password = '".md5($password)."' ");
21+
if($qry->num_rows > 0){
22+
foreach ($qry->fetch_array() as $key => $value) {
23+
if($key != 'password' && !is_numeric($key))
24+
$_SESSION['login_'.$key] = $value;
25+
}
26+
return 1;
27+
}else{
28+
return 2;
29+
}
30+
}
31+
function logout(){
32+
session_destroy();
33+
foreach ($_SESSION as $key => $value) {
34+
unset($_SESSION[$key]);
35+
}
36+
header("location:login.php");
37+
}
38+
function login2(){
39+
extract($_POST);
40+
$qry = $this->db->query("SELECT *,concat(lastname,', ',firstname,' ',middlename) as name FROM students where student_code = '".$student_code."' ");
41+
if($qry->num_rows > 0){
42+
foreach ($qry->fetch_array() as $key => $value) {
43+
if($key != 'password' && !is_numeric($key))
44+
$_SESSION['rs_'.$key] = $value;
45+
}
46+
return 1;
47+
}else{
48+
return 3;
49+
}
50+
}
51+
function save_user(){
52+
extract($_POST);
53+
$data = "";
54+
foreach($_POST as $k => $v){
55+
if(!in_array($k, array('id','cpass','password')) && !is_numeric($k)){
56+
if(empty($data)){
57+
$data .= " $k='$v' ";
58+
}else{
59+
$data .= ", $k='$v' ";
60+
}
61+
}
62+
}
63+
if(!empty($password)){
64+
$data .= ", password=md5('$password') ";
65+
66+
}
67+
$check = $this->db->query("SELECT * FROM users where email ='$email' ".(!empty($id) ? " and id != {$id} " : ''))->num_rows;
68+
if($check > 0){
69+
return 2;
70+
exit;
71+
}
72+
if(isset($_FILES['img']) && $_FILES['img']['tmp_name'] != ''){
73+
$fname = strtotime(date('y-m-d H:i')).'_'.$_FILES['img']['name'];
74+
$move = move_uploaded_file($_FILES['img']['tmp_name'],'assets/uploads/'. $fname);
75+
$data .= ", avatar = '$fname' ";
76+
77+
}
78+
if(empty($id)){
79+
$save = $this->db->query("INSERT INTO users set $data");
80+
}else{
81+
$save = $this->db->query("UPDATE users set $data where id = $id");
82+
}
83+
84+
if($save){
85+
return 1;
86+
}
87+
}
88+
function signup(){
89+
extract($_POST);
90+
$data = "";
91+
foreach($_POST as $k => $v){
92+
if(!in_array($k, array('id','cpass')) && !is_numeric($k)){
93+
if($k =='password'){
94+
if(empty($v))
95+
continue;
96+
$v = md5($v);
97+
98+
}
99+
if(empty($data)){
100+
$data .= " $k='$v' ";
101+
}else{
102+
$data .= ", $k='$v' ";
103+
}
104+
}
105+
}
106+
107+
$check = $this->db->query("SELECT * FROM users where email ='$email' ".(!empty($id) ? " and id != {$id} " : ''))->num_rows;
108+
if($check > 0){
109+
return 2;
110+
exit;
111+
}
112+
if(isset($_FILES['img']) && $_FILES['img']['tmp_name'] != ''){
113+
$fname = strtotime(date('y-m-d H:i')).'_'.$_FILES['img']['name'];
114+
$move = move_uploaded_file($_FILES['img']['tmp_name'],'assets/uploads/'. $fname);
115+
$data .= ", avatar = '$fname' ";
116+
117+
}
118+
if(empty($id)){
119+
$save = $this->db->query("INSERT INTO users set $data");
120+
121+
}else{
122+
$save = $this->db->query("UPDATE users set $data where id = $id");
123+
}
124+
125+
if($save){
126+
if(empty($id))
127+
$id = $this->db->insert_id;
128+
foreach ($_POST as $key => $value) {
129+
if(!in_array($key, array('id','cpass','password')) && !is_numeric($key))
130+
$_SESSION['login_'.$key] = $value;
131+
}
132+
$_SESSION['login_id'] = $id;
133+
if(isset($_FILES['img']) && !empty($_FILES['img']['tmp_name']))
134+
$_SESSION['login_avatar'] = $fname;
135+
return 1;
136+
}
137+
}
138+
139+
function update_user(){
140+
extract($_POST);
141+
$data = "";
142+
foreach($_POST as $k => $v){
143+
if(!in_array($k, array('id','cpass','table','password')) && !is_numeric($k)){
144+
145+
if(empty($data)){
146+
$data .= " $k='$v' ";
147+
}else{
148+
$data .= ", $k='$v' ";
149+
}
150+
}
151+
}
152+
$check = $this->db->query("SELECT * FROM users where email ='$email' ".(!empty($id) ? " and id != {$id} " : ''))->num_rows;
153+
if($check > 0){
154+
return 2;
155+
exit;
156+
}
157+
if(isset($_FILES['img']) && $_FILES['img']['tmp_name'] != ''){
158+
$fname = strtotime(date('y-m-d H:i')).'_'.$_FILES['img']['name'];
159+
$move = move_uploaded_file($_FILES['img']['tmp_name'],'assets/uploads/'. $fname);
160+
$data .= ", avatar = '$fname' ";
161+
162+
}
163+
if(!empty($password))
164+
$data .= " ,password=md5('$password') ";
165+
if(empty($id)){
166+
$save = $this->db->query("INSERT INTO users set $data");
167+
}else{
168+
$save = $this->db->query("UPDATE users set $data where id = $id");
169+
}
170+
171+
if($save){
172+
foreach ($_POST as $key => $value) {
173+
if($key != 'password' && !is_numeric($key))
174+
$_SESSION['login_'.$key] = $value;
175+
}
176+
if(isset($_FILES['img']) && !empty($_FILES['img']['tmp_name']))
177+
$_SESSION['login_avatar'] = $fname;
178+
return 1;
179+
}
180+
}
181+
function delete_user(){
182+
extract($_POST);
183+
$delete = $this->db->query("DELETE FROM users where id = ".$id);
184+
if($delete)
185+
return 1;
186+
}
187+
function save_system_settings(){
188+
extract($_POST);
189+
$data = '';
190+
foreach($_POST as $k => $v){
191+
if(!is_numeric($k)){
192+
if(empty($data)){
193+
$data .= " $k='$v' ";
194+
}else{
195+
$data .= ", $k='$v' ";
196+
}
197+
}
198+
}
199+
if($_FILES['cover']['tmp_name'] != ''){
200+
$fname = strtotime(date('y-m-d H:i')).'_'.$_FILES['cover']['name'];
201+
$move = move_uploaded_file($_FILES['cover']['tmp_name'],'../assets/uploads/'. $fname);
202+
$data .= ", cover_img = '$fname' ";
203+
204+
}
205+
$chk = $this->db->query("SELECT * FROM system_settings");
206+
if($chk->num_rows > 0){
207+
$save = $this->db->query("UPDATE system_settings set $data where id =".$chk->fetch_array()['id']);
208+
}else{
209+
$save = $this->db->query("INSERT INTO system_settings set $data");
210+
}
211+
if($save){
212+
foreach($_POST as $k => $v){
213+
if(!is_numeric($k)){
214+
$_SESSION['system'][$k] = $v;
215+
}
216+
}
217+
if($_FILES['cover']['tmp_name'] != ''){
218+
$_SESSION['system']['cover_img'] = $fname;
219+
}
220+
return 1;
221+
}
222+
}
223+
function save_image(){
224+
extract($_FILES['file']);
225+
if(!empty($tmp_name)){
226+
$fname = strtotime(date("Y-m-d H:i"))."_".(str_replace(" ","-",$name));
227+
$move = move_uploaded_file($tmp_name,'assets/uploads/'. $fname);
228+
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'?'https':'http';
229+
$hostName = $_SERVER['HTTP_HOST'];
230+
$path =explode('/',$_SERVER['PHP_SELF']);
231+
$currentPath = '/'.$path[1];
232+
if($move){
233+
return $protocol.'://'.$hostName.$currentPath.'/assets/uploads/'.$fname;
234+
}
235+
}
236+
}
237+
function save_project(){
238+
extract($_POST);
239+
$data = "";
240+
foreach($_POST as $k => $v){
241+
if(!in_array($k, array('id','user_ids')) && !is_numeric($k)){
242+
if($k == 'description')
243+
$v = htmlentities(str_replace("'","&#x2019;",$v));
244+
if(empty($data)){
245+
$data .= " $k='$v' ";
246+
}else{
247+
$data .= ", $k='$v' ";
248+
}
249+
}
250+
}
251+
if(isset($user_ids)){
252+
$data .= ", user_ids='".implode(',',$user_ids)."' ";
253+
}
254+
// echo $data;exit;
255+
if(empty($id)){
256+
$save = $this->db->query("INSERT INTO project_list set $data");
257+
}else{
258+
$save = $this->db->query("UPDATE project_list set $data where id = $id");
259+
}
260+
if($save){
261+
return 1;
262+
}
263+
}
264+
function delete_project(){
265+
extract($_POST);
266+
$delete = $this->db->query("DELETE FROM project_list where id = $id");
267+
if($delete){
268+
return 1;
269+
}
270+
}
271+
function save_task(){
272+
extract($_POST);
273+
$data = "";
274+
foreach($_POST as $k => $v){
275+
if(!in_array($k, array('id')) && !is_numeric($k)){
276+
if($k == 'description')
277+
$v = htmlentities(str_replace("'","&#x2019;",$v));
278+
if(empty($data)){
279+
$data .= " $k='$v' ";
280+
}else{
281+
$data .= ", $k='$v' ";
282+
}
283+
}
284+
}
285+
if(empty($id)){
286+
$save = $this->db->query("INSERT INTO task_list set $data");
287+
}else{
288+
$save = $this->db->query("UPDATE task_list set $data where id = $id");
289+
}
290+
if($save){
291+
return 1;
292+
}
293+
}
294+
function delete_task(){
295+
extract($_POST);
296+
$delete = $this->db->query("DELETE FROM task_list where id = $id");
297+
if($delete){
298+
return 1;
299+
}
300+
}
301+
function save_progress(){
302+
extract($_POST);
303+
$data = "";
304+
foreach($_POST as $k => $v){
305+
if(!in_array($k, array('id')) && !is_numeric($k)){
306+
if($k == 'comment')
307+
$v = htmlentities(str_replace("'","&#x2019;",$v));
308+
if(empty($data)){
309+
$data .= " $k='$v' ";
310+
}else{
311+
$data .= ", $k='$v' ";
312+
}
313+
}
314+
}
315+
$dur = abs(strtotime("2020-01-01 ".$end_time)) - abs(strtotime("2020-01-01 ".$start_time));
316+
$dur = $dur / (60 * 60);
317+
$data .= ", time_rendered='$dur' ";
318+
// echo "INSERT INTO user_productivity set $data"; exit;
319+
if(empty($id)){
320+
$data .= ", user_id={$_SESSION['login_id']} ";
321+
322+
$save = $this->db->query("INSERT INTO user_productivity set $data");
323+
}else{
324+
$save = $this->db->query("UPDATE user_productivity set $data where id = $id");
325+
}
326+
if($save){
327+
return 1;
328+
}
329+
}
330+
function delete_progress(){
331+
extract($_POST);
332+
$delete = $this->db->query("DELETE FROM user_productivity where id = $id");
333+
if($delete){
334+
return 1;
335+
}
336+
}
337+
function get_report(){
338+
extract($_POST);
339+
$data = array();
340+
$get = $this->db->query("SELECT t.*,p.name as ticket_for FROM ticket_list t inner join pricing p on p.id = t.pricing_id where date(t.date_created) between '$date_from' and '$date_to' order by unix_timestamp(t.date_created) desc ");
341+
while($row= $get->fetch_assoc()){
342+
$row['date_created'] = date("M d, Y",strtotime($row['date_created']));
343+
$row['name'] = ucwords($row['name']);
344+
$row['adult_price'] = number_format($row['adult_price'],2);
345+
$row['child_price'] = number_format($row['child_price'],2);
346+
$row['amount'] = number_format($row['amount'],2);
347+
$data[]=$row;
348+
}
349+
return json_encode($data);
350+
351+
}
352+
}

0 commit comments

Comments
 (0)