// Check file size if ($_FILES["img"]["size"] > 1000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if ($d = \Cloudinary\Uploader::upload($_FILES["img"]["tmp_name"], array("crop" => "limit", "width" => "2000", "height" => "2000", "eager" => array(array("width" => 200, "height" => 200, "crop" => "thumb", "gravity" => "face"))))) { print_r($d); if ($insert_id = App::registerImage($d['public_id'], $d['url'], $d)) { $user->setProfilePicture($insert_id); } Tools::redirect("../../profile.php?status=1"); } else { echo "Sorry, there was an error uploading your file."; Tools::redirect("../../profile.php?status=2"); } } //redirect_to("../../add_teacher.php?status=1"); } elseif (Tools::valuePost("edit_profile")) { //redirect_to("../../add_teacher.php?status=2"); } Tools::redirect("../../profile.php?status=6");
<?php require_once "includes/functions_no_session.inc"; $stat_message = ""; if ($id = Tools::isUserLogged()) { Tools::redirect("index.php"); } if ($u = Tools::valuePost("user") and $p = Tools::valuePost("pass") and Tools::valueGet("login") == 1) { if (Tools::signin($u, $p)) { Tools::redirect("index.php"); } else { Tools::redirect("signin.php?status=1"); } } if ($value = Tools::valueGet('status')) { if ($value == 1) { $stat_message = "<div class=\"alert animated fadeIn alert-danger text-center\">Wrong Username or Password!</div>"; } elseif ($value == 2) { $stat_message = "<div class=\"alert animated fadeIn alert-danger text-center\">Missing Credentials!</div>"; } elseif ($value == 3) { $stat_message = "<div class=\"alert animated fadeIn alert-success text-center\">Signup successful, login with your email or chosen username!</div>"; } elseif ($value == 4) { $stat_message = "<div class=\"alert animated fadeIn alert-success text-center\">Password successfully reset login with new password.</div>"; } } ?> <!DOCTYPE html> <html class="signin no-js" lang="en"> <head> <title>Grade Access - SIGN IN</title>
<?php require_once "../../includes/functions.inc"; if ($school->addTeacher(Tools::valuePost("title"), Tools::valuePost("first_name"), Tools::valuePost("last_name"), Tools::valuePost("email"), Tools::valuePost("phone"), Tools::valuePost("subject"), Tools::valuePost("class"))) { Tools::redirect("../../add_teacher.php?status=1"); } else { Tools::redirect("../../add_teacher.php?status=2"); }
<?php require_once "../../includes/functions.inc"; if (Tools::valuePost("current_password") and Tools::valuePost("new_password")) { $cur_pass = Tools::valuePost("current_password"); $new_pass = Tools::valuePost("new_password"); if ($user->changePassword($cur_pass, $new_pass)) { Tools::redirect("../../ch_pass.php?status=2"); } else { Tools::redirect("../../ch_pass.php?status=1"); } }
$user->clearChatNotification($chat->getID()); foreach ($messages as $id) { $message = new Message($id); $sender = new User($message->getSenderID()); $time = strtotime($message->getTime()); $new_message .= "\n <div id=\"{$id}\" class=\"animated fadeIn chatbox-user right\">\n <a href=\"javascript:;\" class=\"chat-avatar pull-right\"> \n <img src=\"img/faceless.jpg\" class=\"img-circle\" title=\"user name\" alt=\"\">\n </a>\n\n <div class=\"message\">\n <div class=\"panel\">\n <div class=\"panel-heading\">\n {$sender->getFullName()}\n </div>\n\n <div class=\"panel-body\">\n <p>{$message->getMessage()}</p>\n </div>\n </div>\n\n <small class=\"chat-time\">\n <i class=\"ti-time mr5\"></i>\n <span data-livestamp=\"{$time}\"></span>\n <i class=\"ti-check text-success\"></i>\n </small>\n\n </div>\n </div>"; } echo $new_message; } } elseif (Tools::valuePost("action") == "send_chat") { /*SEND NEW CHAT MESSAGE TO THE SERVER*/ if (!empty(Tools::valuePost("message"))) { echo $chat->sendMessage($user->getID(), Tools::valuePost("message")); } } } elseif (Tools::valuePost("action") == "notification") { /*CHECK NEW CHAT MESSAGES FROM THE SERVER*/ $chats = $user->checkMessages(); if ($chats) { $count = count($chats); foreach ($chats as $id) { $chat = new Chat($id); $message_row = $chat->getLastMessage(); $sender = new User($message_row['from_user_id']); $time = strtotime($message_row['time']); $end_product[] = array("count" => $count, "id" => $id, "notifications" => "New message", "name" => $sender->getFullname(), "img" => $sender->getProfilePictureURL(), "timestamp" => $time, "message" => $message_row['message'], "url" => "message.php?chat_id={$id}"); } $end_product = json_encode($end_product); echo $end_product; } }
<?php include "../../includes/functions.inc"; if ($_POST['action'] == "insert") { $stu_id = Tools::valuePost("studId"); $reg = Tools::valuePost("regNo"); $class_id = $teacher->getClassID(); $fname = Tools::valuePost("firstName"); $lname = Tools::valuePost("lastName"); $dob = Tools::valuePost("dob"); $sex = Tools::valuePost("sex"); if (Tools::valuePost("studId")) { echo $class->updateStudent($stu_id, $reg, $class_id, $fname, $lname, $dob, $sex); } else { echo $class->addStudent($reg, $class_id, $fname, $lname, $dob, $sex); } echo mysqli_insert_id($conn); } elseif ($_POST['action'] == "delete") { $class->deleteStudent(Tools::valuePost("studId")); } elseif ($_POST['action'] == "check_reg") { if ($school->findStudentByRegNo(Tools::valuePost("regId"))) { echo 1; } else { echo 0; } }
<?php require_once "../../includes/functions.inc"; $att = null; echo Tools::valuePost("attendance"); if (Tools::valuePost("attendance") == "true") { $att = 1; echo "present"; } elseif (Tools::valuePost("attendance") == "false") { $att = 0; echo "absent"; } if ($id = Tools::valuePost("studId")) { $student = new Student($id); $student->setAttendance($att); }
<?php include "../../includes/functions.inc"; if (Tools::valuePost("action") == "set") { $scores = Tools::valuePost("scores"); $scores = explode(",", $scores); //print_r($raw_scores); $assID = 'NULL'; if (Tools::valuePost("assID")) { //THIS IS TO UPDATE EXISTING ASSESSMENTS $assessment = new Assessment(Tools::valuePost("assID")); //$assessment->getClassID(); $ass_class = new SchoolClass($assessment->getClassID()); $subjects = $ass_class->getSubjectsID(); $assessment->setScores($scores); } else { //THIS IS TO INSERT NEW ASSESSMENTS $student = new Student(Tools::valuePost("student")); if ($ass_id = $student->addAssessment($user->getID(), Tools::valuePost("year"), Tools::valuePost("term"))) { $assessment = new Assessment($ass_id); $assessment->setScores($scores); echo $ass_id; } } } if (Tools::valuePost("action") == "delete") { $assessment = new Assessment(Tools::valuePost("id")); $assessment->delete(); }
<?php require_once "../../includes/functions.inc"; if (Tools::valuePost("action") == "save_rules") { $data = Tools::valuePost("data"); $school->setRules($data); echo "Rules and Regulations Successfully saved!"; } if (Tools::valuePost("action") == "save_news") { if ($id = Tools::valuePost("id") and $title = Tools::valuePost("title") and $content = Tools::valuePostAllowTags("content")) { $newsletter = new Newsletter($id); if ($newsletter->update($title, $content)) { echo "Newsletter saved"; } } else { echo "Please do not leave any field empty"; } } if (Tools::valuePost("action") == "create_news") { if ($title = Tools::valuePost("title") and $content = Tools::valuePostAllowTags("content")) { if ($school->addNews($title, $content)) { echo "Newsletter saved"; } } else { echo "Please do not leave any field empty"; } }
require_once "../../includes/functions.inc"; print_r($_POST); if (Tools::valuePost("action") == "edit") { foreach ($_POST['id'] as $key) { $level = Tools::cleanString($_POST['class'][$key]); $arm = Tools::cleanString($_POST['arm'][$key]); $sort = Tools::cleanString($_POST['sort'][$key]); if ($level and $arm and $sort) { $class = new SchoolClass(Tools::cleanString($key)); $class->update($level, $arm, $sort); } else { Tools::redirect("../../classes.php?status=1"); } } Tools::redirect("../../classes.php"); } elseif (Tools::valuePost("action") == "new") { foreach ($_POST['id'] as $key => $value) { print_r($_POST); $level = Tools::cleanString($_POST['class'][$key]); $arm = Tools::cleanString($_POST['arm'][$key]); if ($level and $arm) { if ($school->addClass($level, $arm)) { Tools::redirect("../../classes.php?status=2"); } } else { Tools::redirect("../../classes.php?status=3"); } } Tools::redirect("../../classes.php"); }
<?php require_once "../../includes/functions.inc"; if ($sch_name = Tools::valuePost('sch_name') and $sch_phone = Tools::valuePost('sch_phone') and $current_session = Tools::valuePost('current_session') and $current_term = Tools::valuePost('current_term') and $owner = Tools::valuePost('owner') and $owner_rank = Tools::valuePost('owner_rank') and $assistant = Tools::valuePost('assistant') and $assistant_rank = Tools::valuePost('assistant_rank') and $location = Tools::valuePost('location')) { $school->setSchoolInfo($sch_name, $sch_phone, $current_session, $current_term, $owner, $owner_rank, $assistant, $assistant_rank, $location); Tools::redirect("../../school_data.php?status=1"); } else { Tools::redirect("../../school_data.php?status=2"); }
<?php require_once "../../includes/functions.inc"; $student = new Student(Tools::valuePost("studId")); $check; if (Tools::valuePost("type")) { $check = "1"; } else { $check = "0"; } if (Tools::valuePost("behaviour")) { echo $student->setBehaviour($user->getID(), Tools::valuePost("behaviour"), $check); } if (Tools::valuePost("referer") == "modal_profile") { Tools::redirect("../../profile.php?guid=" . $student->getID()); }
<?php include "../../includes/functions_no_session.inc"; if ($subdomain = Tools::valuePost("subdomain")) { if ($school_id = App::findSubdomain($subdomain)) { $title = Tools::valuePost('title'); $type = "parent"; $name = Tools::valuePost('name'); $email = Tools::valuePost('email'); $phone = Tools::valuePost('phone'); $password = Tools::valuePost('pass'); $name = explode(" ", $name); $pass = password_hash($password, PASSWORD_DEFAULT); if (!App::findEmail($email)) { if (!App::findPhone($phone)) { $school = new School($school_id); if ($id = $school->addUser($title, $name[0], $name[1], $email, $phone, $type, $pass)) { ParentClass::register($id); if (Tools::signin($email, $password)) { Tools::redirect("../../index.php?subpage=tour"); } } else { Tools::redirect("../../signup.php?status=4"); } } else { Tools::redirect("../../signup.php?status=3"); } } else { Tools::redirect("../../signup.php?status=2"); } } else {