// checks for Login if ($retval == 4) { die("Invalid Login Details supplied"); } else { switch ($retval) { case 1: $tablename = "student"; break; case 2: $tablename = "faculty"; break; case 3: $tablename = "admin"; break; } updater($tablename, $username, $oldpassword, $newpassword); } function updater($tablename, $username, $oldpassword, $newpassword) { if (!($connect = mysqli_connect("localhost", "root", "", "ita_project"))) { die("Error in connecting to the database"); } $query = "update " . $tablename . " set password = '******' where uname = '" . $username . "' and password = '******'"; if (!($result = mysqli_query($connect, $query))) { die("Error in updating"); } else { die("Password updated"); } } function checkLogin($username, $password) {
} else { //there is some error echo $error; } } else { //it is a resubmission case and it will be handled by the code later below } } else { //form submitted by post method //file upload form to be displayed if (isset($_POST['submit'])) { //form has been submitted if ($_FILES['new_file']['tmp_name'] != '') { //files has been sent to server for verification from the form //check for file validation if (updater($paper_id)) { //file successfully uploaded through the updater helper //from here file is sent to updater helper for verifying and saving file echo '<br>file successfully updated'; //show the updated info of the paper $db = new Database(); $db->connect(); $paper_exists = $db->select('papers', '*', null, 'id = ' . $paper_id); if ($paper_exists) { //paper exists and is unique $paper_array = $db->getResult(); $subject_id = $paper_array[0]['sub_id']; //check if subject exists in db if ($db->select('subjects', '*', null, 'id = ' . $subject_id)) { //subject id for generating subject info $subject_array = $db->getResult();
function works($redisql) { initer($redisql); inserter($redisql); selecter($redisql); iselecter($redisql); updater($redisql); iselecter_employee($redisql); deleter($redisql); iselecter($redisql); iupdater_customer($redisql); iselecter_customer($redisql); ideleter_customer($redisql); iselecter_customer_employee($redisql); joiner($redisql); //$redisql->dump("customer"); }
} if (isset($_GET['r'])) { // fetching all the required parameters if (isset($_SERVER["HTTP_CF_IPCOUNTRY"])) { $country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; // to access in PHP } else { $country_code = "UNWN"; } //$country_code = "CA"; // to access in PHP $referrer = $_GET['r']; $date = date("Ymd"); $page = '1'; $data = checkifexist($referrer, $date); if ($data != false) { updater($data, $referrer, $date, $country_code, $page); } else { creater($referrer, $date, $country_code, $page); } } // Create an image, 1x1 pixel in size $im = imagecreate(1, 1); // Set the background colour $white = imagecolorallocate($im, 255, 255, 255); // Allocate the background colour imagesetpixel($im, 1, 1, $white); // Set the image type header("content-type:image/jpg"); // Create a JPEG file from the image imagejpeg($im); // Free memory associated with the image