/
home
/
u775757334
/
domains
/
civicwelllife.com
/
public_html
/
admin
/
dataQuery
/
/home/u775757334/domains/civicwelllife.com/public_html/admin/dataQuery
mkdir
upload
Name
Size
Mode
Actions
common-function.php
1130
0644
edit
dl
rm
error_log
8916
0644
edit
dl
rm
process.php
254317
0644
edit
dl
rm
Edit:
/home/u775757334/domains/civicwelllife.com/public_html/admin/dataQuery/process.php
(254317B)
<?php require_once '../loginQuery/session_start2.php'; require_once '../dbc.php'; require_once 'common-function.php'; $action = isset($_POST['action']) ? $_POST['action'] : ''; switch ($action) { case 'addBanner': addBanner($conn); break; case 'getSubCategory': getSubCategory($conn); break; case 'changeOrderStatus': changeOrderStatus($conn); break; case 'updateTracking': updateTracking($conn); break; case 'editBanner': editBanner($conn); break; case 'editSetting': editSetting($conn, $tblSetting, $urlSetting); break; case 'addData': addData($conn); break; case 'editData': editData($conn); break; case 'addProblemSolution': addProblemSolution($conn); break; case 'editProblemSolution': editProblemSolution($conn); break; case 'addDoctorRegistration': addDoctorRegistration($conn); break; case 'editDoctorRegistration': editDoctorRegistration($conn); break; case 'addSellerRegistration': addSellerRegistration($conn); break; case 'editSellerRegistration': editSellerRegistration($conn); break; case 'addCourse': addData($conn); break; case 'editCourse': editData($conn); break; case 'sendProfit': sendProfit($conn, $tblPayment, "send-profit.php"); break; case 'sendLose': sendLose($conn, $tblPayment, "send-loss.php"); break; case 'addNotification': addNotification($conn, $tblNotification, $urlNotificationList); break; case 'editNotification': editNotification($conn, $tblNotification, $urlNotification); break; default: //header('Location: ../home.php'); } $action2 = isset($_GET['action2']) ? $_GET['action2'] : ''; switch ($action2) { case 'deleteData': deleteData($conn); break; case 'ChangeStatus': ChangeStatus($conn, $tblUser, "user-list.php"); break; case 'paymentVerify': paymentVerify($conn, $tblPayment, "recharge-list.php"); break; case 'deleteCollege': deleteCollege($conn, $tblCourseCollege); break; case 'addExam': addExam($conn, $tblCourseExam, $urlAddExam); break; case 'deleteExam': deleteExam($conn, $tblCourseExam); break; case 'addStudentExam': addStudentExam($conn, $tblStudentExam, $urlAddStudent); break; case 'deleteExamStudent': deleteExamStudent($conn, $tblStudentExam); break; case 'deleteProblemSolution': deleteProblemSolution($conn, $returnurl); break; case 'deleteVideo': deleteVideo($conn, $tblVideo, $urlVideoList); break; default: } // 0- Record has not been saved successfully // 1- Record has been saved successfully // 2- this image content two dot (.) // 3- Pleas Select Image // 4- Record has been updated // 5- Record has not been updated // 6- Rrecord has been delteted // 7- Record has not been delteted function changeOrderStatus($conn) { global $tblOrder; $tableName = $tblOrder; $returnurl = "order-list.php"; $order_id = $_POST['order_id']; $order_status = $_POST['status']; //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set order_status = '$order_status' where order_id = '$order_id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); // echo "Fail"; } } function updateTracking($conn) { global $tblOrder; $tableName = $tblOrder; $returnurl = "order-list.php"; $order_id = $_POST['order_id']; $tracking_no = mysqli_real_escape_string($conn, $_POST['tracking_no']); $tracking_url = mysqli_real_escape_string($conn, $_POST['tracking_url']); //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set tracking_url = '$tracking_url', tracking_no = '$tracking_no' where order_id = '$order_id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); } } function getSubCategory($conn) { $categoryid = $_POST['categoryid']; echo '<select name="sub_category_id" class="form-control" style="border-radius:0;">'; echo '<option value="">Select</option>'; $sqlr = mysqli_query($conn, "select * from tbl_sub_category where category_id='$categoryid' order by name") or die(mysqli_error($conn)); while ($rowr = mysqli_fetch_assoc($sqlr)) { echo '<option value="' . $rowr['id'] . '">' . $rowr['name'] . '</option>'; } echo '</select>'; } function addData($conn) { $tableName = $_POST['tablename']; $returnurl = $_POST['returnurl']; /*-------------------------Image info-----------------------------*/ $imgFlag1 = 0; $imgFlag2 = 0; $imgFlag3 = 0; $imgFlag4 = 0; $imgFlag5 = 0; $imgFlag6 = 0; $image = $_POST['image']; if ($image == 1) { $imgFlag1 = 1; } if ($image == 2) { $imgFlag1 = 1; $imgFlag2 = 1; } if ($image == 3) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; } if ($image == 4) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; } if ($image == 5) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; } if ($image == 6) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; $imgFlag6 = 1; } $keyAry = array(); $valueAry = array(); $keyString = ""; $valueString = ""; $value = ""; foreach ($_POST['feild'] as $feild_name) { $keyAry[] = $feild_name; if ($feild_name == 'size') { $value = implode(',', $_POST['size']); } else { $value = mysqli_real_escape_string($conn, $_POST[$feild_name]); } $valueAry[] = "'{$value}'"; } $keyString = implode(',', $keyAry); $valueString = implode(',', $valueAry); // ====================Image section ================ function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1000000, 9999999); $tno = rand(1000000, 9999999); global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; $imageKey = ""; $imageValue = ""; if ($imgFlag1 == 1) { $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename1 = $str = preg_replace('/\s+/', '_', $imagefleimagename1); $imagefleimagename1_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename1_tmp); // ---------------------------------------- if ($imagefleimagename1 != "") { $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 1 end------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $imageKey = ",image1,thumb1"; $imageValue = ",'{$newfile1}','{$imageThumbName}'"; // ---------------------------------------- } if ($imgFlag2 == 1) { $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; $imagefleimagename2 = $str = preg_replace('/\s+/', '_', $imagefleimagename2); $imagefleimagename2_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename2_tmp); // ------------------------------------------------ if ($imagefleimagename2 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $newfile2); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $image2ThumbName = $tno . $imagefleimagename2; $imagefleimagename = "$ImageThumbPath/" . $image2ThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 2 end------------//////////// } else { $newfile2 = ""; $image2ThumbName = ""; } $imageKey = ",image1,thumb1,image2,thumb2"; $imageValue = ",'{$newfile1}','{$imageThumbName}','{$newfile2}','{$image2ThumbName}'"; // ------------------------------------------------ } if ($imgFlag3 == 1) { $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; $imagefleimagename3 = $str = preg_replace('/\s+/', '_', $imagefleimagename3); $imagefleimagename3_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename3_tmp); // ---------------------------------------------- if ($imagefleimagename3 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile3 = $no . $imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath" . $newfile3); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $image3ThumbName = $tno . $imagefleimagename3; $imagefleimagename = "$ImageThumbPath/" . $image3ThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 3 end------------//////////// } else { $newfile3 = ""; $image3ThumbName = ""; } $imageKey = ",image1,thumb1,image2,thumb2,image3,thumb3"; $imageValue = ",'{$newfile1}','{$imageThumbName}','{$newfile2}','{$image2ThumbName}','{$newfile3}','{$image3ThumbName}'"; // ---------------------------------------------- } if ($imgFlag4 == 1) { $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; $imagefleimagename4 = $str = preg_replace('/\s+/', '_', $imagefleimagename4); $imagefleimagename4_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename4_tmp); // ---------------------------------------------- if ($imagefleimagename4 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile4 = $no . $imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath" . $newfile4); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $image4ThumbName = $tno . $imagefleimagename4; $imagefleimagename = "$ImageThumbPath/" . $image4ThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 4 end------------//////////// } else { $newfile4 = ""; $image4ThumbName = ""; } $imageKey = ",image1,thumb1,image2,thumb2,image3,thumb3,image4,thumb4"; $imageValue = ",'{$newfile1}','{$imageThumbName}','{$newfile2}','{$image2ThumbName}','{$newfile3}','{$image3ThumbName}','{$newfile4}','{$image4ThumbName}'"; // ---------------------------------------------- } if ($imgFlag5 == 1) { $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; $imagefleimagename5 = $str = preg_replace('/\s+/', '_', $imagefleimagename5); $imagefleimagename5_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename5_tmp); // ---------------------------------------------- if ($imagefleimagename5 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile5 = $no . $imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath" . $newfile5); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $image5ThumbName = $tno . $imagefleimagename5; $imagefleimagename = "$ImageThumbPath/" . $image5ThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 5 end------------//////////// } else { $newfile5 = ""; $image5ThumbName = ""; } $imageKey = ",image1,thumb1,image2,thumb2,image3,thumb3,image4,thumb4,image5,thumb5"; $imageValue = ",'{$newfile1}','{$imageThumbName}','{$newfile2}','{$image2ThumbName}','{$newfile3}','{$image3ThumbName}','{$newfile4}','{$image4ThumbName}','{$newfile5}','{$image5ThumbName}'"; // ---------------------------------------------- } if ($imgFlag6 == 1) { $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; $imagefleimagename6 = $str = preg_replace('/\s+/', '_', $imagefleimagename6); $imagefleimagename6_tmp = $str = preg_replace('/\s+/', '_', $imagefleimagename6_tmp); // ---------------------------------------------- if ($imagefleimagename6 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile6 = $no . $imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath" . $newfile6); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $image6ThumbName = $tno . $imagefleimagename6; $imagefleimagename = "$ImageThumbPath/" . $image6ThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Image 6 end------------//////////// } else { $newfile6 = ""; $image6ThumbName = ""; } $imageKey = ",image1,thumb1,image2,thumb2,image3,thumb3,image4,thumb4,image5,thumb5,image6,thumb6"; $imageValue = ",'{$newfile1}','{$imageThumbName}','{$newfile2}','{$image2ThumbName}','{$newfile3}','{$image3ThumbName}','{$newfile4}','{$image4ThumbName}','{$newfile5}','{$image5ThumbName}','{$newfile6}','{$image6ThumbName}'"; // ---------------------------------------------- } // ====================Insert Section ================ $insertKey = $keyString . '' . $imageKey; $insertValue = $valueString . "" . $imageValue; $sql = "insert into $tableName($insertKey) values($insertValue)"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=1'); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=1'); // echo "Not Find"; } // echo "success"; } else { if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=0'); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=0'); // echo "Not Find"; } } } function editData($conn) { $id = $_POST['txtid']; $tableName = $_POST['tablename']; $returnurl = $_POST['returnurl']; /*-------------------------Image info-----------------------------*/ $imgFlag1 = 0; $imgFlag2 = 0; $imgFlag3 = 0; $imgFlag4 = 0; $imgFlag5 = 0; $imgFlag6 = 0; $image = $_POST['image']; if ($image == 1) { $imgFlag1 = 1; } if ($image == 2) { $imgFlag1 = 1; $imgFlag2 = 1; } if ($image == 3) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; } if ($image == 4) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; } if ($image == 5) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; } if ($image == 6) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; $imgFlag6 = 1; } $keyAry = array(); $valueAry = array(); $flag = 0; $updateString = ""; foreach ($_POST['feild'] as $feild_name) { if ($feild_name == 'size') { $value = implode(',', $_POST['size']); } else { $value = mysqli_real_escape_string($conn, $_POST[$feild_name]); } if ($flag == 0) { $flag = 1; $updateString .= "{$feild_name}='{$value}'"; } else { $updateString .= ",{$feild_name}='{$value}'"; } } // ====================Image section ================ function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1000000, 9999999); $tno = rand(1000000, 9999999); global $productPath; global $productPathThumb; $ImagePath = "$productPath/"; $ImageThumbPath = "$productPathThumb/"; $imageString = ""; // =============================== $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); /*---------------------------*/ $flagImage1 = 0; $flagImage2 = 0; $flagImage3 = 0; $flagImage4 = 0; $flagImage5 = 0; $flagImage6 = 0; // ============================= if ($imgFlag1 == 1) { $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; // ---------------------------------------- $Un_OrginalImage1 = $row['image1']; $Un_Image1 = $row['thumb1']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image1']; $InsertImagethumb1 = $row['thumb1']; if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $imageString = " ,image1='{$InsertImage1}',thumb1='{$InsertImagethumb1}'"; // ---------------------------------------- } if ($imgFlag2 == 1) { $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; // ------------------------------------------------ $Un_OrginalImage2 = $row['image2']; $Un_Image2 = $row['thumb2']; $InsertImage2 = $row['image2']; $InsertImagethumb2 = $row['thumb2']; if ($imagefleimagename2 != "") { $flagImage2 = 2; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename2_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $InsertImage2); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb2 = $tno . $imagefleimagename2; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb2; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $imageString .= " ,image2='{$InsertImage2}',thumb2='{$InsertImagethumb2}'"; // ------------------------------------------------ } if ($imgFlag3 == 1) { $imagefleimagename3 = $_FILES['image3fleimage']['name']; $imagefleimagename3_tmp = $_FILES['image3fleimage']['tmp_name']; // ---------------------------------------------- $Un_OrginalImage3 = $row['image3']; $Un_Image3 = $row['thumb3']; $InsertImage3 = $row['image3']; $InsertImagethumb3 = $row['thumb3']; if ($imagefleimagename3 != "") { $flagImage3 = 3; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename3; $uploadedfile = $imagefleimagename3; $imagefleimagename3 = stripslashes($imagefleimagename3); $extension = getExtension($imagefleimagename3); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename3_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage3 = $no . $imagefleimagename3; move_uploaded_file($_FILES["image3fleimage"]['tmp_name'], "$ImagePath" . $InsertImage3); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb3 = $tno . $imagefleimagename3; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb3; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } $imageString .= " ,image3='{$InsertImage3}',thumb3='{$InsertImagethumb3}'"; // ---------------------------------------------- } if ($imgFlag4 == 1) { $imagefleimagename4 = $_FILES['image4fleimage']['name']; $imagefleimagename4_tmp = $_FILES['image4fleimage']['tmp_name']; // ---------------------------------------------- $Un_OrginalImage4 = $row['image4']; $Un_Image4 = $row['thumb4']; $InsertImage4 = $row['image4']; $InsertImagethumb4 = $row['thumb4']; // ======================= image 4 ========================= if ($imagefleimagename4 != "") { $flagImage4 = 4; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename4; $uploadedfile = $imagefleimagename4; $imagefleimagename4 = stripslashes($imagefleimagename4); $extension = getExtension($imagefleimagename4); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename4_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage4 = $no . $imagefleimagename4; move_uploaded_file($_FILES["image4fleimage"]['tmp_name'], "$ImagePath" . $InsertImage4); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb4 = $tno . $imagefleimagename4; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb4; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 4 End============================== $imageString .= " ,image4='{$InsertImage4}',thumb4='{$InsertImagethumb4}'"; // ---------------------------------------------- } if ($imgFlag5 == 1) { $imagefleimagename5 = $_FILES['image5fleimage']['name']; $imagefleimagename5_tmp = $_FILES['image5fleimage']['tmp_name']; // ---------------------------------------------- $Un_OrginalImage5 = $row['image5']; $Un_Image5 = $row['thumb5']; $InsertImage5 = $row['image5']; $InsertImagethumb5 = $row['thumb5']; // ======================= image 5 ========================= if ($imagefleimagename5 != "") { $flagImage5 = 5; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename5; $uploadedfile = $imagefleimagename5; $imagefleimagename5 = stripslashes($imagefleimagename5); $extension = getExtension($imagefleimagename5); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename5_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage5 = $no . $imagefleimagename5; move_uploaded_file($_FILES["image5fleimage"]['tmp_name'], "$ImagePath" . $InsertImage5); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb5 = $tno . $imagefleimagename5; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb5; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 5 End============================== $imageString .= " ,image5='{$InsertImage5}',thumb5='{$InsertImagethumb5}'"; // ---------------------------------------------- } if ($imgFlag6 == 1) { $imagefleimagename6 = $_FILES['image6fleimage']['name']; $imagefleimagename6_tmp = $_FILES['image6fleimage']['tmp_name']; // ---------------------------------- $Un_OrginalImage6 = $row['image6']; $Un_Image6 = $row['thumb6']; $InsertImage6 = $row['image6']; $InsertImagethumb6 = $row['thumb6']; // ======================= image 6 ========================= if ($imagefleimagename6 != "") { $flagImage6 = 6; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename6; $uploadedfile = $imagefleimagename6; $imagefleimagename6 = stripslashes($imagefleimagename6); $extension = getExtension($imagefleimagename6); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../product-list.php?m=16&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename6_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setwidth = 400; $ratio = 0.0; if ($width > $setwidth) { $ratio = $setwidth / $width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } /*if($height>$setheight){ $ratio=$setheight/$height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight =350; }*/ $InsertImage6 = $no . $imagefleimagename6; move_uploaded_file($_FILES["image6fleimage"]['tmp_name'], "$ImagePath" . $InsertImage6); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb6 = $tno . $imagefleimagename6; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb6; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 6 End============================== $imageString .= " ,image6='{$InsertImage6}',thumb6='{$InsertImagethumb6}'"; // ---------------------------------------------- } $insertValue = "update {$tableName} set {$updateString} {$imageString} where id = '{$id}'"; $sqladd = mysqli_query($conn, $insertValue) or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=4&id=' . $id); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "Not Find"; } // echo "success"; } else { if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=5&id=' . $id); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); // echo "Not Find"; } } } function deleteData($conn) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $image = $_GET['image']; $tableName = $_GET['tablename']; $returnurl = $_GET['returnurl']; if (isset($_GET['product_id'])) { $returnurl = "{$returnurl}&product_id={$_GET['product_id']}"; } $imgFlag1 = 0; $imgFlag2 = 0; $imgFlag3 = 0; $imgFlag4 = 0; $imgFlag5 = 0; $imgFlag6 = 0; if ($image == 1) { $imgFlag1 = 1; } if ($image == 2) { $imgFlag1 = 1; $imgFlag2 = 1; } if ($image == 3) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; } if ($image == 4) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; } if ($image == 5) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; } if ($image == 6) { $imgFlag1 = 1; $imgFlag2 = 1; $imgFlag3 = 1; $imgFlag4 = 1; $imgFlag5 = 1; $imgFlag6 = 1; } // =================================== if ($image == 0) { $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); if ($imgFlag1 == 1) { $image1 = $rowi['image1']; $thumb1 = $rowi['thumb1']; } if ($imgFlag2 == 1) { $image2 = $rowi['image2']; $thumb2 = $rowi['thumb2']; } if ($imgFlag3 == 1) { $image3 = $rowi['image3']; $thumb3 = $rowi['thumb3']; } if ($imgFlag4 == 1) { $image4 = $rowi['image4']; $thumb4 = $rowi['thumb4']; } if ($imgFlag5 == 1) { $image5 = $rowi['image5']; $thumb5 = $rowi['thumb5']; } if ($imgFlag6 == 1) { $image6 = $rowi['image6']; $thumb6 = $rowi['thumb6']; } //header('Location: ../product-list.php?&m=15'); //exit(); } } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($imgFlag1 == 1) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } } if ($imgFlag2 == 2) { if ($image2 != "") { unlink($ImagePath . $image2); unlink($ImageThumbPath . $thumb2); } } if ($imgFlag3 == 1) { if ($image3 = "") { unlink($ImagePath . $image3); unlink($ImageThumbPath . $thumb3); } } if ($imgFlag4 == 1) { if ($image4 != "") { unlink($ImagePath . $image4); unlink($ImageThumbPath . $thumb4); } } if ($imgFlag5 == 1) { if ($image5 != "") { unlink($ImagePath . $image5); unlink($ImageThumbPath . $thumb5); } } if ($imgFlag6 == 1) { if ($image6 != "") { unlink($ImagePath . $image6); unlink($ImageThumbPath . $thumb6); } } mysqli_query($conn, "COMMIT"); if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=6'); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=6'); // echo "Not Find"; } } else { mysqli_query($conn, "ROLLBACK"); if (strpos($returnurl, "?") != "") { header('Location: ../' . $returnurl . '&m=7'); // echo "Find"; } else { header('Location: ../' . $returnurl . '?m=7'); // echo "Not Find"; } } // =================================== } function sendProfit($conn, $tableName, $returnurl) { $values = array(); $userid = array(); $amount = mysqli_real_escape_string($conn, $_POST['amount']); $userid = $_POST['userid']; // ============================ $payment_category_id = 0; $transaction_id = 0; $payment_status = 1; $payment_type = 3; $block_status = 0; $block_date = date('Y-m-d'); $date = date('Y-m-d'); $date_time = date('Y-m-d H:i:s'); // ============================ foreach ($userid as $key => $value) { # code... $user_id = $value; $uid = date('ymdhis') . rand(10, 99); $values[] = "('$uid','$user_id','$date','$date_time','$payment_category_id','$amount','$transaction_id','$payment_status','$payment_type','$block_date','$block_status')"; } $sql = "INSERT INTO $tableName(uid,user_id,date,date_time,payment_category_id,amount,transaction_id,payment_status,payment_type,block_date,block_status) VALUES "; $sql .= implode(', ', $values); if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function sendLose($conn, $tableName, $returnurl) { $values = array(); $userid = array(); $amount = mysqli_real_escape_string($conn, $_POST['amount']); $userid = $_POST['userid']; // ============================ $payment_category_id = 0; $transaction_id = 0; $payment_status = 1; $payment_type = 4; $block_status = 0; $block_date = date('Y-m-d'); $date = date('Y-m-d'); $date_time = date('Y-m-d H:i:s'); // ============================ foreach ($userid as $key => $value) { # code... $user_id = $value; $uid = date('ymdhis') . rand(10, 99); $values[] = "('$uid','$user_id','$date','$date_time','$payment_category_id','$amount','$transaction_id','$payment_status','$payment_type','$block_date','$block_status')"; } $sql = "INSERT INTO $tableName(uid,user_id,date,date_time,payment_category_id,amount,transaction_id,payment_status,payment_type,block_date,block_status) VALUES "; $sql .= implode(', ', $values); if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function addExam($conn, $tableName, $returnurl) { $course_id = mysqli_real_escape_string($conn, $_GET['c']); $exam_id = mysqli_real_escape_string($conn, $_GET['e']); $sql = "insert into $tableName(course_id,exam_id) values('$course_id','$exam_id')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&c=' . $course_id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&c=' . $course_id); } } function deleteCollege($conn, $tableName) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $course_id = isset($_GET['c']) ? $_GET['c'] : ""; $returnurl = $_GET['r']; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where course_id = '$course_id' and college_id='$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&c=' . $course_id); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&c=' . $course_id); } //---------------------------------------------------------- } function deleteExam($conn, $tableName) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $course_id = isset($_GET['c']) ? $_GET['c'] : ""; $returnurl = $_GET['r']; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where course_id = '$course_id' and exam_id='$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&c=' . $course_id); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&c=' . $course_id); } //---------------------------------------------------------- } function addStudentExam($conn, $tableName, $returnurl) { $exam_id = mysqli_real_escape_string($conn, $_GET['c']); $student_id = mysqli_real_escape_string($conn, $_GET['e']); $sql = "insert into $tableName(exam_id,student_id) values('$exam_id','$student_id')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&c=' . $exam_id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&c=' . $exam_id); } } function deleteExamStudent($conn, $tableName) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $exam_id = isset($_GET['c']) ? $_GET['c'] : ""; $returnurl = $_GET['r']; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where exam_id = '$exam_id' and id='$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&c=' . $exam_id); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&c=' . $exam_id); } //---------------------------------------------------------- } function deleteProblemSolution($conn, $returnurl) { $problem_id = intval($_GET['problem_id'] ?? 0); if ($problem_id <= 0) { header("Location: ../$returnurl?m=0"); exit; } mysqli_query( $conn, "DELETE FROM tbl_problem_solution WHERE problem_id = '$problem_id'" ) or die(mysqli_error($conn)); header("Location: ../$returnurl?m=3"); exit; } function ChangeStatus($conn, $tableName, $returnurl) { $id = $_GET['id']; $status = $_GET['status']; //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set status = '$status' where id = '$id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); } } function paymentVerify($conn, $tableName, $returnurl) { $id = $_GET['id']; $status = $_GET['status']; //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set payment_status = '$status' where id = '$id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); } } function changeWhatsupStatus($conn, $tableName, $returnurl) { $id = $_GET['id']; $status = $_GET['status']; //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set status = '$status' where id = '$id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function editPromo($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $type = mysqli_real_escape_string($conn, $_POST['seltype']); $amount = mysqli_real_escape_string($conn, $_POST['txtamount']); $status = mysqli_real_escape_string($conn, $_POST['selstatus']); //================================ Image 1 End============================== $sqladd = mysqli_query($conn, "update $tableName set name = '$name', type = '$type', status = '$status', amount='$amount' where id = '$id'") or die(mysqli_error($conn)); /*----------------------------------------------*/ if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addBanner($conn) { $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $subheading = mysqli_real_escape_string($conn, $_POST['txtsubheading']); $order = mysqli_real_escape_string($conn, $_POST['txtorder']); $link = mysqli_real_escape_string($conn, $_POST['txtlink']); $banner = mysqli_real_escape_string($conn, $_POST['banner']); $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $bannerPath; global $bannerPathThumb; $ImagePath = "$bannerPath/"; $ImageThumbPath = "$bannerPathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "pdf")) { header('Location: ../banner.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 200; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into tbl_banner(ordering, heading,sub_heading,image,thumb,link,banner_type) values('$order','$heading','$subheading','$newfile1','$imageThumbName','$link','$banner')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../banner-list.php?m=1'); //echo "suucess"; } else { //echo "fail"; header('Location: ../banner-list.php?m=0'); } } function editBanner($conn) { $id = $_POST['txtid']; $banner = mysqli_real_escape_string($conn, $_POST['banner']); $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $subheading = mysqli_real_escape_string($conn, $_POST['txtsubheading']); $order = mysqli_real_escape_string($conn, $_POST['txtorder']); $link = mysqli_real_escape_string($conn, $_POST['txtlink']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../brand-list.php?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from tbl_banner where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $bannerPath; global $bannerPathThumb; $ImagePath = "$bannerPath/"; $ImageThumbPath = "$bannerPathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../banner.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 667; $ratio = 0.0; /* if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update tbl_banner set ordering ='$order', heading ='$heading', sub_heading ='$subheading', link ='$link', banner_type ='$banner', image='$InsertImage1' , thumb='$InsertImagethumb1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../banner-list.php?m=4'); //echo "success"; } else { header('Location: ../banner-list.php?m=5'); } } function deleteBanner($conn) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------------------- $checkSql = mysqli_query($conn, "select * from tbl_banner where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; //header('Location: ../product-list.php?&m=15'); //exit(); } //echo "value is ".$id; global $bannerPath; global $bannerPathThumb; $ImagePath = "$bannerPath/"; $ImageThumbPath = "$bannerPathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from tbl_banner where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../banner-list.php?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../banner-list.php?m=7'); } //--------------------------------------------------------------------------------------------------- } function addNotes($conn, $tableName, $returnurl) { $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $longdescription = mysqli_real_escape_string($conn, $_POST['txtlongdescription']); $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $showonhome = mysqli_real_escape_string($conn, $_POST['selshowonhome']); $status = mysqli_real_escape_string($conn, $_POST['selstatus']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "pdf")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(course_id,subject_id,short_description,long_description,video_link,status,show_on_home,paid_status,pdf) values('$course','$subject','$shortdescription','$longdescription','$video','$status','$showonhome','$paidstatus','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editNotes($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $longdescription = mysqli_real_escape_string($conn, $_POST['txtlongdescription']); $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $showonhome = mysqli_real_escape_string($conn, $_POST['selshowonhome']); $status = mysqli_real_escape_string($conn, $_POST['selstatus']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['pdf']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['pdf']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "pdf")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set course_id='$course' , subject_id='$subject' , long_description='$longdescription' , short_description='$shortdescription' , status='$status' , show_on_home='$showonhome' , paid_status='$paidstatus' , video_link='$video' , pdf='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteNotes($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['pdf']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addTestimonial($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtcoursename']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $post = mysqli_real_escape_string($conn, $_POST['txtpost']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,short_description,post, image) values('$name','$shortdescription','$post','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editTestimonial($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtcoursename']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $post = mysqli_real_escape_string($conn, $_POST['txtpost']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , post='$post' , short_description='$shortdescription' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addUser($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $email = mysqli_real_escape_string($conn, $_POST['txtemail']); $phone = mysqli_real_escape_string($conn, $_POST['txtphone']); $s_password = mysqli_real_escape_string($conn, $_POST['txtpassword']); $password = md5($_POST['txtpassword']); $subject = mysqli_real_escape_string($conn, $_POST['txtsubject']); $qualification = mysqli_real_escape_string($conn, $_POST['txtqualification']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,email,phone,subject,qualification,password,s_password, image,user_role) values('$name','$email','$phone','$subject','$qualification','$password','$s_password','$newfile1',2)"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editUser($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $email = mysqli_real_escape_string($conn, $_POST['txtemail']); $phone = mysqli_real_escape_string($conn, $_POST['txtphone']); $s_password = mysqli_real_escape_string($conn, $_POST['txtpassword']); $password = md5($_POST['txtpassword']); $subject = mysqli_real_escape_string($conn, $_POST['txtsubject']); $qualification = mysqli_real_escape_string($conn, $_POST['txtqualification']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , email='$email' , phone='$phone' , subject='$subject' , qualification='$qualification' , password='$password' , s_password='$s_password' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addNotice($conn, $tableName, $returnurl) { $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $date = date('Y-m-d'); $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $details = mysqli_real_escape_string($conn, $_POST['txtdetails']); $pageUrl = mysqli_real_escape_string($conn, $_POST['txturl']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(subject_id,course_id,date,heading,details,url,image) values('$subject','$course','$date','$heading','$details','$pageUrl','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editNotice($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $date = date('Y-m-d'); $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $details = mysqli_real_escape_string($conn, $_POST['txtdetails']); $pageUrl = mysqli_real_escape_string($conn, $_POST['txturl']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set heading='$heading' , details='$details' , subject_id='$subject' , course_id='$course' , url='$pageUrl' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addCourse($conn, $tableName, $returnurl) { $coursename = mysqli_real_escape_string($conn, $_POST['txtcoursename']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); $saleprice = mysqli_real_escape_string($conn, $_POST['txtsaleprice']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $syllabus = mysqli_real_escape_string($conn, $_POST['txtsyllabus']); $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(course_name,price,sale_price,short_description,syllabus,video_link, image) values('$coursename','$price','$saleprice','$shortdescription','$syllabus','$video','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editCourse($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $coursename = mysqli_real_escape_string($conn, $_POST['txtcoursename']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); $saleprice = mysqli_real_escape_string($conn, $_POST['txtsaleprice']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $syllabus = mysqli_real_escape_string($conn, $_POST['txtsyllabus']); $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set course_name='$coursename' , price='$price' , sale_price='$saleprice' , short_description='$shortdescription' , syllabus='$syllabus' , video_link='$video' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addProblemSolution($conn) { $tableName = 'tbl_problem_solution'; $returnurl = 'problem-solution-list.php'; $problem_id = intval($_POST['problem_id']); $product_ids = $_POST['product_id']; // array $user_id = $_POST['user_id']; if ($problem_id == 0 || empty($product_ids)) { header("Location: ../$returnurl?m=0"); exit; } foreach ($product_ids as $pid) { $pid = intval($pid); mysqli_query( $conn, "INSERT INTO tbl_problem_solution (problem_id, product_id) VALUES ('$problem_id', '$pid')" ); } header("Location: ../$returnurl?m=1"); exit; } function editProblemSolution($conn) { $tableName = 'tbl_problem_solution'; $returnurl = 'problem-solution-list.php'; $problem_id = intval($_POST['problem_id']); $product_ids = $_POST['product_id']; $id = intval($_POST['txtid']); if ($problem_id == 0 || empty($product_ids)) { header("Location: ../$returnurl?m=5&id=$id"); exit; } // 🔴 DELETE OLD MAPPING mysqli_query( $conn, "DELETE FROM tbl_problem_solution WHERE problem_id = '$problem_id'" ); // 🟢 INSERT NEW MAPPING foreach ($product_ids as $pid) { $pid = intval($pid); mysqli_query( $conn, "INSERT INTO tbl_problem_solution (problem_id, product_id) VALUES ('$problem_id', '$pid')" ); } header("Location: ../$returnurl?m=4&id=$id"); exit; } function uploadDoctorImage($fileInputName) { if (!isset($_FILES[$fileInputName]) || $_FILES[$fileInputName]['error'] != 0) { return ''; } $folder = "../../media/image/"; $ext = pathinfo($_FILES[$fileInputName]['name'], PATHINFO_EXTENSION); // unique image name $imageName = time() . '_' . rand(1000, 9999) . '.' . $ext; move_uploaded_file( $_FILES[$fileInputName]['tmp_name'], $folder . $imageName ); return $imageName; } function addDoctorRegistration($conn) { $returnurl = 'registration-list.php'; $name = $_POST['name']; $mobile = $_POST['mobile']; $email = $_POST['email']; $timimg = $_POST['timimg']; $eduaction = $_POST['eduaction']; $experience = $_POST['experience']; $gender = $_POST['gender']; $dob = $_POST['dob']; $address = $_POST['address']; $check_mode = $_POST['check_mode']; $hospital_name = $_POST['hospital_name']; $status = $_POST['status']; $institute = $_POST['institute']; $about = $_POST['about']; $consultation_fee = $_POST['consultation_fee']; // 🔥 MULTIPLE SELECT $category_id = isset($_POST['category_id']) ? implode(',', $_POST['category_id']) : ''; $problem_id = isset($_POST['problem_id']) ? implode(',', $_POST['problem_id']) : ''; $image1 = uploadDoctorImage('image1fleimage'); $sql = " INSERT INTO tbl_doctor_registration (name, mobile, email, timimg, eduaction, experience, gender, dob, address, check_mode, hospital_name, consultation_fee, category_id, problem_id,image1,status,institute,about) VALUES ('$name', '$mobile', '$email', '$timimg', '$eduaction', '$experience', '$gender', '$dob', '$address', '$check_mode', '$hospital_name', '$consultation_fee', '$category_id', '$problem_id','$image1','$status','$institute','$about') "; mysqli_query($conn, $sql) or die(mysqli_error($conn)); header("Location: ../$returnurl?m=1"); exit; } function editDoctorRegistration($conn) { $returnurl = 'registration-list.php'; $id = intval($_POST['txtid']); $name = $_POST['name']; $mobile = $_POST['mobile']; $email = $_POST['email']; $timimg = $_POST['timimg']; $eduaction = $_POST['eduaction']; $experience = $_POST['experience']; $gender = $_POST['gender']; $dob = $_POST['dob']; $address = $_POST['address']; $check_mode = $_POST['check_mode']; $hospital_name = $_POST['hospital_name']; $consultation_fee = $_POST['consultation_fee']; $status = $_POST['status']; $institute = $_POST['institute']; $about = $_POST['about']; $category_id = isset($_POST['category_id']) ? implode(',', $_POST['category_id']) : ''; $problem_id = isset($_POST['problem_id']) ? implode(',', $_POST['problem_id']) : ''; // OLD IMAGE $oldImg = ''; $res = mysqli_query($conn, "SELECT image1 FROM tbl_doctor_registration WHERE id='$id'"); if ($r = mysqli_fetch_assoc($res)) { $oldImg = $r['image1']; } // NEW IMAGE $newImage = uploadDoctorImage('image1fleimage'); $finalImage = $newImage ? $newImage : $oldImg; $sql = " UPDATE tbl_doctor_registration SET name='$name', mobile='$mobile', email='$email', timimg='$timimg', eduaction='$eduaction', experience='$experience', gender='$gender', dob='$dob', address='$address', check_mode='$check_mode', hospital_name='$hospital_name', consultation_fee='$consultation_fee', category_id='$category_id', problem_id='$problem_id', image1='$finalImage', status='$status', institute='$institute', about='$about' WHERE id='$id' "; mysqli_query($conn, $sql) or die(mysqli_error($conn)); header("Location: ../$returnurl?m=2&id=$id"); exit; } function addSellerRegistration($conn) { $returnurl = 'seller-registration-list.php'; $company_name = $_POST['company_name']; $brand_name = $_POST['brand_name']; $gst_number = $_POST['gst_number']; $license_number = $_POST['license_number']; $pan_number = $_POST['pan_number']; $company_address = $_POST['company_address']; $contact_person_name = $_POST['contact_person_name']; $phone_number = $_POST['phone_number']; $email_id = $_POST['email_id']; $bank_name = $_POST['bank_name']; $account_holder_name = $_POST['account_holder_name']; $account_number = $_POST['account_number']; $ifsc_code = $_POST['ifsc_code']; $logistics_type = $_POST['logistics_type']; $status = $_POST['status']; // 🔐 Password Handling $normal_password = $_POST['normal_password']; $seller_password = md5($normal_password); $sql = "INSERT INTO tbl_seller_registration (company_name, brand_name, gst_number, license_number, pan_number, company_address, contact_person_name, phone_number, email_id, bank_name, account_holder_name, account_number, ifsc_code, logistics_type, status, seller_password, normal_password) VALUES ('$company_name','$brand_name','$gst_number','$license_number','$pan_number','$company_address', '$contact_person_name','$phone_number','$email_id','$bank_name','$account_holder_name', '$account_number','$ifsc_code','$logistics_type','$status','$seller_password','$normal_password')"; mysqli_query($conn, $sql) or die(mysqli_error($conn)); header("Location: ../$returnurl?m=1"); exit; } function editSellerRegistration($conn) { $returnurl = 'seller-registration-list.php'; $id = intval($_POST['txtid']); $company_name = $_POST['company_name']; $brand_name = $_POST['brand_name']; $gst_number = $_POST['gst_number']; $license_number = $_POST['license_number']; $pan_number = $_POST['pan_number']; $company_address = $_POST['company_address']; $contact_person_name = $_POST['contact_person_name']; $phone_number = $_POST['phone_number']; $email_id = $_POST['email_id']; $bank_name = $_POST['bank_name']; $account_holder_name = $_POST['account_holder_name']; $account_number = $_POST['account_number']; $ifsc_code = $_POST['ifsc_code']; $logistics_type = $_POST['logistics_type']; $status = $_POST['status']; // 🔐 Password Update Logic $password_update = ""; if (!empty($_POST['normal_password'])) { $normal_password = $_POST['normal_password']; $seller_password = md5($normal_password); $password_update = ", seller_password='$seller_password', normal_password='$normal_password' "; } $sql = "UPDATE tbl_seller_registration SET company_name='$company_name', brand_name='$brand_name', gst_number='$gst_number', license_number='$license_number', pan_number='$pan_number', company_address='$company_address', contact_person_name='$contact_person_name', phone_number='$phone_number', email_id='$email_id', bank_name='$bank_name', account_holder_name='$account_holder_name', account_number='$account_number', ifsc_code='$ifsc_code', logistics_type='$logistics_type', status='$status' $password_update WHERE id='$id' "; mysqli_query($conn, $sql) or die(mysqli_error($conn)); header("Location: ../$returnurl?m=2&id=$id"); exit; } function addAnswer($conn, $tableName, $returnurl) { $questionid = mysqli_real_escape_string($conn, $_POST['questionid']); $studentid = mysqli_real_escape_string($conn, $_POST['studentid']); $teacherid = mysqli_real_escape_string($conn, $_POST['teacherid']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(question_id,teacher_id,student_id,description, image) values('$questionid','$teacherid','$studentid','$description','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editAnswer($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $questionid = mysqli_real_escape_string($conn, $_POST['questionid']); $studentid = mysqli_real_escape_string($conn, $_POST['studentid']); $teacherid = mysqli_real_escape_string($conn, $_POST['teacherid']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set question_id = '$questionid', teacher_id = '$teacherid', student_id = '$studentid', description = '$description', image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&aid=' . $questionid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&aid=' . $questionid); } } function addSubject($conn, $tableName, $returnurl) { $course = mysqli_real_escape_string($conn, $_POST['selcourse']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,course_id,image) values('$name','$course','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editSubject($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $course = mysqli_real_escape_string($conn, $_POST['selcourse']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); //================================ Image 1 End============================== //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name = '$name', image = '$InsertImage1', course_id = '$course' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function addVideo($conn, $tableName, $returnurl) { $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $title = mysqli_real_escape_string($conn, $_POST['txttitle']); $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $showonhome = mysqli_real_escape_string($conn, $_POST['selshowonhome']); $status = mysqli_real_escape_string($conn, $_POST['selstatus']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(video_link,course_id,subject_id,status,show_on_home,paid_status,title) values('$video','$course','$subject','$status','$showonhome','$paidstatus','$title')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editVideo($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $title = mysqli_real_escape_string($conn, $_POST['txttitle']); $video = mysqli_real_escape_string($conn, $_POST['txtvideo']); $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $showonhome = mysqli_real_escape_string($conn, $_POST['selshowonhome']); $status = mysqli_real_escape_string($conn, $_POST['selstatus']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set video_link = '$video', course_id = '$course', subject_id = '$subject', status = '$status', show_on_home = '$showonhome', title='$title', status = '$status', paid_status = '$paidstatus' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteVideo($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addExamPaper($conn, $tableName, $returnurl) { $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $subject1 = mysqli_real_escape_string($conn, $_POST['txtsubject1']); $subject2 = mysqli_real_escape_string($conn, $_POST['txtsubject2']); $subject3 = mysqli_real_escape_string($conn, $_POST['txtsubject3']); $start1 = mysqli_real_escape_string($conn, $_POST['txtstart1']); $start2 = mysqli_real_escape_string($conn, $_POST['txtstart2']); $start3 = mysqli_real_escape_string($conn, $_POST['txtstart3']); $end1 = mysqli_real_escape_string($conn, $_POST['txtend1']); $end2 = mysqli_real_escape_string($conn, $_POST['txtend2']); $end3 = mysqli_real_escape_string($conn, $_POST['txtend3']); $papername = mysqli_real_escape_string($conn, $_POST['txtpapername']); $totalquation = mysqli_real_escape_string($conn, $_POST['txttotalquation']); $perquationmarks = mysqli_real_escape_string($conn, $_POST['txtperquationmarks']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $examdate = mysqli_real_escape_string($conn, $_POST['txtexamdate']); $starttime = mysqli_real_escape_string($conn, $_POST['txtstarttime']); $endtime = mysqli_real_escape_string($conn, $_POST['txtendtime']); $exam_status = mysqli_real_escape_string($conn, $_POST['exam_status']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(course_id,subject_id,paper_name,short_description,total_quation,per_quation_marks,exam_date,start_time,end_time,exam_status,subject1,subject2,subject3,start1,start2,start3,end1,end2,end3) values('$course','$subject','$papername','$shortdescription','$totalquation','$perquationmarks','$examdate','$starttime','$endtime','$exam_status','$subject1','$subject2','$subject3','$start1','$start2','$start3','$end1','$end2','$end3')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editExamPaper($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $subject1 = mysqli_real_escape_string($conn, $_POST['txtsubject1']); $subject2 = mysqli_real_escape_string($conn, $_POST['txtsubject2']); $subject3 = mysqli_real_escape_string($conn, $_POST['txtsubject3']); $start1 = mysqli_real_escape_string($conn, $_POST['txtstart1']); $start2 = mysqli_real_escape_string($conn, $_POST['txtstart2']); $start3 = mysqli_real_escape_string($conn, $_POST['txtstart3']); $end1 = mysqli_real_escape_string($conn, $_POST['txtend1']); $end2 = mysqli_real_escape_string($conn, $_POST['txtend2']); $end3 = mysqli_real_escape_string($conn, $_POST['txtend3']); $papername = mysqli_real_escape_string($conn, $_POST['txtpapername']); $totalquation = mysqli_real_escape_string($conn, $_POST['txttotalquation']); $perquationmarks = mysqli_real_escape_string($conn, $_POST['txtperquationmarks']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $examdate = mysqli_real_escape_string($conn, $_POST['txtexamdate']); $starttime = mysqli_real_escape_string($conn, $_POST['txtstarttime']); $endtime = mysqli_real_escape_string($conn, $_POST['txtendtime']); $exam_status = mysqli_real_escape_string($conn, $_POST['exam_status']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set subject1 = '$subject1', subject2 = '$subject2', subject3 = '$subject3', end1 = '$end1', end2 = '$end2', end3 = '$end3', start1 = '$start1', start2 = '$start2', start3 = '$start3', course_id = '$course', subject_id = '$subject', exam_status= '$exam_status', paper_name = '$papername', short_description = '$shortdescription', total_quation = '$totalquation', per_quation_marks = '$perquationmarks', exam_date = '$examdate', start_time = '$starttime', end_time = '$endtime' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteExamPaper($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addExamPaperFree($conn, $tableName, $returnurl) { $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $papername = mysqli_real_escape_string($conn, $_POST['txtpapername']); $totalquation = mysqli_real_escape_string($conn, $_POST['txttotalquation']); $perquationmarks = mysqli_real_escape_string($conn, $_POST['txtperquationmarks']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(course_id,subject_id,paper_name,short_description,total_quation,per_quation_marks,paid_status) values('$course','$subject','$papername','$shortdescription','$totalquation','$perquationmarks','$paidstatus')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editExamPaperFree($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $url = mysqli_real_escape_string($conn, $_POST['selcourse']); $subjectAry = explode('-', $url); $subject = $subjectAry[0]; $course = $subjectAry[1]; $paidstatus = mysqli_real_escape_string($conn, $_POST['selpaidstatus']); $papername = mysqli_real_escape_string($conn, $_POST['txtpapername']); $totalquation = mysqli_real_escape_string($conn, $_POST['txttotalquation']); $perquationmarks = mysqli_real_escape_string($conn, $_POST['txtperquationmarks']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $examdate = mysqli_real_escape_string($conn, $_POST['txtexamdate']); $starttime = mysqli_real_escape_string($conn, $_POST['txtstarttime']); $endtime = mysqli_real_escape_string($conn, $_POST['txtendtime']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set course_id = '$course', subject_id = '$subject', paper_name = '$papername', paid_status = '$paidstatus', short_description = '$shortdescription', total_quation = '$totalquation', per_quation_marks = '$perquationmarks' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteExamPaperFree($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addQuestionFree($conn, $tableName, $returnurl) { $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } if ($imagefleimagename2 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename2; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $newfile2); //////---------------End Upload Brand Image------------//////////// } else { $newfile2 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(paper_id,question,answer1,answer2,answer3,answer4,right_answer,image,image2) values('$qid','$question','$answer1','$answer2','$answer3','$answer4','$rightanswer','$newfile1','$newfile2')";; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&qid=' . $qid); } } function editQuestionFree($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImage2 = $row['image2']; /*---------------------------*/ $flagImage1 = 0; $flagImage2 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } if ($imagefleimagename2 != "") { $flagImage2 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $InsertImage2); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set paper_id = '$qid', question = '$question', answer1 = '$answer1', answer2 = '$answer2', answer3 = '$answer3', answer4 = '$answer4', image='$InsertImage1' , image2='$InsertImage2' , right_answer = '$rightanswer' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&qid=' . $qid); } } function deleteQuestionFree($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } $qid = isset($_GET['qid']) ? $_GET['qid'] : ""; //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&qid=' . $qid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&qid=' . $qid); } //---------------------------------------------------------- } function addQuestionFree2($conn, $tableName, $returnurl) { $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(paper_id,question,answer1,answer2,answer3,answer4,right_answer) values('$qid','$question','$answer1','$answer2','$answer3','$answer4','$rightanswer')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&qid=' . $qid); } } function editQuestionFree2($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set paper_id = '$qid', question = '$question', answer1 = '$answer1', answer2 = '$answer2', answer3 = '$answer3', answer4 = '$answer4', right_answer = '$rightanswer' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&qid=' . $qid); } } function deleteQuestionFree2($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $qid = isset($_GET['qid']) ? $_GET['qid'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&qid=' . $qid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&qid=' . $qid); } //---------------------------------------------------------- } function addQuestion($conn, $tableName, $returnurl) { $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } if ($imagefleimagename2 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename2; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $newfile2); //////---------------End Upload Brand Image------------//////////// } else { $newfile2 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(paper_id,question,answer1,answer2,answer3,answer4,right_answer,image,image2) values('$qid','$question','$answer1','$answer2','$answer3','$answer4','$rightanswer','$newfile1','$newfile2')";; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&qid=' . $qid); } } function editQuestion($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImage2 = $row['image2']; /*---------------------------*/ $flagImage1 = 0; $flagImage2 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== if ($imagefleimagename2 != "") { $flagImage2 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $InsertImage2); //////---------------End Upload Brand Image------------//////////// } /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set paper_id = '$qid', question = '$question', answer1 = '$answer1', answer2 = '$answer2', answer3 = '$answer3', answer4 = '$answer4', image='$InsertImage1' , right_answer = '$rightanswer' where id = '$id'") or die(mysqli_error($conn)); $sqladd = mysqli_query($conn, "update $tableName set course_name='$coursename' , price='$price' , short_description='$shortdescription' , syllabus='$syllabus' , video_link='$video' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&qid=' . $qid); } } function deleteQuestion($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } $qid = isset($_GET['qid']) ? $_GET['qid'] : ""; //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&qid=' . $qid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&qid=' . $qid); } //---------------------------------------------------------- } function addQuestion1($conn, $tableName, $returnurl) { $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(paper_id,question,answer1,answer2,answer3,answer4,right_answer) values('$qid','$question','$answer1','$answer2','$answer3','$answer4','$rightanswer')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&qid=' . $qid); } } function editQuestion1($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $qid = mysqli_real_escape_string($conn, $_POST['txtqid']); $question = mysqli_real_escape_string($conn, $_POST['txtquestion']); $answer1 = mysqli_real_escape_string($conn, $_POST['txtanswer1']); $answer2 = mysqli_real_escape_string($conn, $_POST['txtanswer2']); $answer3 = mysqli_real_escape_string($conn, $_POST['txtanswer3']); $answer4 = mysqli_real_escape_string($conn, $_POST['txtanswer4']); $rightanswer = mysqli_real_escape_string($conn, $_POST['rightanswer']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set paper_id = '$qid', question = '$question', answer1 = '$answer1', answer2 = '$answer2', answer3 = '$answer3', answer4 = '$answer4', right_answer = '$rightanswer' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&qid=' . $qid); } } function deleteQuestion1($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $qid = isset($_GET['qid']) ? $_GET['qid'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&qid=' . $qid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&qid=' . $qid); } //---------------------------------------------------------- } function addLive($conn, $tableName, $returnurl) { $course = mysqli_real_escape_string($conn, $_POST['selcourse']); $title = mysqli_real_escape_string($conn, $_POST['txttitle']); $video_link = mysqli_real_escape_string($conn, $_POST['txtvideolink']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $time = mysqli_real_escape_string($conn, $_POST['txttime']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(title,video_link,date,time,course_id) values('$title','$video_link','$date','$time','$course')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&qid=' . $qid); } } function editLive($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $course = mysqli_real_escape_string($conn, $_POST['selcourse']); $title = mysqli_real_escape_string($conn, $_POST['txttitle']); $video_link = mysqli_real_escape_string($conn, $_POST['txtvideolink']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $time = mysqli_real_escape_string($conn, $_POST['txttime']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set title = '$title', course_id= '$course', video_link = '$video_link', date = '$date', time = '$time' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&qid=' . $qid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&qid=' . $qid); } } function deleteLive($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $qid = isset($_GET['qid']) ? $_GET['qid'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&qid=' . $qid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&qid=' . $qid); } //---------------------------------------------------------- } function addService($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,details, image) values('$name','$description','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editService($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , details='$description' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteService($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addSubCategory($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $category = mysqli_real_escape_string($conn, $_POST['selcategory']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,category_id, image) values('$name','$category','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editSubCategory($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $category = mysqli_real_escape_string($conn, $_POST['selcategory']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , category_id='$category' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteSubCategory($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addMenu($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); $category = mysqli_real_escape_string($conn, $_POST['selcategory']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(name,sub_category_id,price) values('$name','$category','$price')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editMenu($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); $category = mysqli_real_escape_string($conn, $_POST['selcategory']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , price='$price' , sub_category_id='$category' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteMenu($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addRooms($conn, $tableName, $returnurl) { $roomname = mysqli_real_escape_string($conn, $_POST['txtroomname']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $longdescription = mysqli_real_escape_string($conn, $_POST['txtlongdescription']); /*-------------------------Image info-----------------------------*/ $facilities = ""; //echo explode(",",$facility); foreach ($_POST['facility'] as $item) { $facilities .= $item . ","; } $facilities = substr($facilities, 0, strlen($facilities) - 1); $sql = "insert into $tableName(room_name,short_description,long_description,facilities) values('$roomname','$shortdescription','$longdescription','$facilities')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editRooms($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $roomname = mysqli_real_escape_string($conn, $_POST['txtroomname']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $longdescription = mysqli_real_escape_string($conn, $_POST['txtlongdescription']); $facilities = ""; //echo explode(",",$facility); foreach ($_POST['facility'] as $item) { $facilities .= $item . ","; } $facilities = substr($facilities, 0, strlen($facilities) - 1); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set room_name='$roomname' , facilities='$facilities', short_description='$shortdescription' , long_description='$longdescription' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteRooms($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addTariff($conn, $tableName, $returnurl) { $rid = mysqli_real_escape_string($conn, $_POST['txtrid']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); $sql = "insert into $tableName(room_id,name,price) values('$rid','$name','$price')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&rid=' . $rid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&rid=' . $rid); } } function editTariff($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $rid = mysqli_real_escape_string($conn, $_POST['txtrid']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); $price = mysqli_real_escape_string($conn, $_POST['txtprice']); //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set room_id ='$rid' , name ='$name', price ='$price' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id . '&rid=' . $rid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id . '&rid=' . $rid); } } function deleteRoomBooking($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $rid = isset($_GET['rid']) ? $_GET['rid'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&rid=' . $rid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&rid=' . $rid); } //---------------------------------------------------------- } function deleteTariff($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $rid = isset($_GET['rid']) ? $_GET['rid'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&rid=' . $rid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&rid=' . $rid); } //---------------------------------------------------------- } function addGalleryCategory($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); /*-------------------------Image info-----------------------------*/ $sql = "insert into $tableName(name) values('$name')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editGalleryCategory($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); /*-------------------------Image info-----------------------------*/ //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteGalleryCategory($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addStory($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $url = strtolower(str_replace(" ", "-", $name)); $url = strtolower(str_replace("&", "and", $url)); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); $metatitle = mysqli_real_escape_string($conn, $_POST['txtmetatitle']); $metakeyword = mysqli_real_escape_string($conn, $_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn, $_POST['txtmetadescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,url,date,short_description,full_description, image,thumb,meta_title,meta_keyword,meta_description) values('$name','$url','$date','$shortdescription','$description','$newfile1','$imageThumbName','$metatitle','$metakeyword','$metadescription')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editStory($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $url = strtolower(str_replace(" ", "-", $name)); $url = strtolower(str_replace("&", "and", $url)); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $shortdescription = mysqli_real_escape_string($conn, $_POST['txtshortdescription']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); $metatitle = mysqli_real_escape_string($conn, $_POST['txtmetatitle']); $metakeyword = mysqli_real_escape_string($conn, $_POST['txtmetakeyword']); $metadescription = mysqli_real_escape_string($conn, $_POST['txtmetadescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 350; $ratio = 0.0; /* if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , url='$url' , date='$date' , short_description='$shortdescription' , full_description='$description' , image='$InsertImage1' , thumb='$InsertImagethumb1', meta_title='$metatitle', meta_keyword='$metakeyword', meta_description='$metadescription' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteStory($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function editSetting($conn, $tableName, $returnurl) { $facebook = mysqli_real_escape_string($conn, $_POST['facebook']); $tweeter = mysqli_real_escape_string($conn, $_POST['tweeter']); $instagram = mysqli_real_escape_string($conn, $_POST['instagram']); $youtube = mysqli_real_escape_string($conn, $_POST['youtube']); $whatsup_number = mysqli_real_escape_string($conn, $_POST['whatsup_number']); $phone_number = mysqli_real_escape_string($conn, $_POST['phone_number']); $email = mysqli_real_escape_string($conn, $_POST['email']); $address = mysqli_real_escape_string($conn, $_POST['address']); $heading1 = mysqli_real_escape_string($conn, $_POST['heading1']); $text1 = mysqli_real_escape_string($conn, $_POST['text1']); $heading2 = mysqli_real_escape_string($conn, $_POST['heading2']); $text2 = mysqli_real_escape_string($conn, $_POST['text2']); $heading3 = mysqli_real_escape_string($conn, $_POST['heading3']); $text3 = mysqli_real_escape_string($conn, $_POST['text3']); $heading4 = mysqli_real_escape_string($conn, $_POST['heading4']); $text4 = mysqli_real_escape_string($conn, $_POST['text4']); $opening_heading = mysqli_real_escape_string($conn, $_POST['opening_heading']); $opening = mysqli_real_escape_string($conn, $_POST['opening']); $closing_heading = mysqli_real_escape_string($conn, $_POST['closing_heading']); $closing = mysqli_real_escape_string($conn, $_POST['closing']); /*------- ------ ------- ------ -------*/ $sqladd = mysqli_query($conn, "update $tableName set opening_heading ='$opening_heading', opening ='$opening', closing_heading ='$closing_heading', closing ='$closing', facebook ='$facebook', tweeter ='$tweeter', instagram ='$instagram', youtube ='$youtube', whatsup_number ='$whatsup_number', phone_number ='$phone_number', email ='$email', address ='$address', heading1 ='$heading1', text1 ='$text1', heading2 ='$heading2', text2 ='$text2', heading3 ='$heading3', text3 ='$text3', heading4 ='$heading4', text4 ='$text4' where id = '1'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { // ================================== header('Location: ../' . $returnurl . '?m=4'); //echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); } } function addRoomImage($conn, $tableName, $returnurl) { $rid = mysqli_real_escape_string($conn, $_POST['txtrid']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image&rid=' . $rid); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3&rid=' . $rid); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(room_id,image,thumb) values('$rid','$newfile1','$imageThumbName')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1&rid=' . $rid); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0&rid=' . $rid); } } function deleteRoomImage($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $rid = isset($_GET['rid']) ? $_GET['rid'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6&rid=' . $rid); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7&rid=' . $rid); } //---------------------------------------------------------- } function addGallery($conn, $tableName, $returnurl) { $categoryid = mysqli_real_escape_string($conn, $_POST['selcategory']); $youtube = mysqli_real_escape_string($conn, $_POST['txtyoutube']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(category_id,image,thumb,youtube) values('$categoryid','$newfile1','$imageThumbName','$youtube')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editGallery($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $categoryid = mysqli_real_escape_string($conn, $_POST['selcategory']); $youtube = mysqli_real_escape_string($conn, $_POST['txtyoutube']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /* if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set category_id='$categoryid', youtube='$youtube', image='$InsertImage1' , thumb='$InsertImagethumb1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteGallery($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addEvent($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,date,description, image) values('$name','$date','$description','$newfile1')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editEvent($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , date='$date' , description='$description' , image='$InsertImage1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteEvent($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addMedia($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(name,date, image,thumb) values('$name','$date','$newfile1','$imageThumbName')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editMedia($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $name = mysqli_real_escape_string($conn, $_POST['txtname']); $date = mysqli_real_escape_string($conn, $_POST['txtdate']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3&id=' . $id); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 350; $ratio = 0.0; /* if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name' , date='$date' , image='$InsertImage1' , thumb='$InsertImagethumb1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../' . $returnurl . '?m=4&id=' . $id); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteMedia($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } function addSole($conn, $tableName, $returnurl) { $caption = mysqli_real_escape_string($conn, $_POST['txtcaption']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg")) { header('Location: ../blog.php?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 400; $ratio = 0.0; /*if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $imageThumbName = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $imageThumbName; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } else { $newfile1 = ""; $imageThumbName = ""; } $sql = "insert into $tableName(caption,image,thumb) values('$caption','$newfile1','$imageThumbName')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); } } function editSole($conn, $tableName, $returnurl) { $id = $_POST['txtid']; $caption = mysqli_real_escape_string($conn, $_POST['txtcaption']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Brand Logo'); exit(0); } //------------------------------------------------------------------ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_Image1 = $row['thumb']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImagethumb1 = $row['thumb']; /*---------------------------*/ $flagImage1 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $imagefleimagename1_tmp; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } list($width, $height) = getimagesize($uploadedfile); $setheight = 350; $ratio = 0.0; /* if($width>$setwidth){ $ratio=$setwidth/$width; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; }else{ $newheight = $height ; $newwidth = $width ; }*/ if ($height > $setheight) { $ratio = $setheight / $height; $newheight = $height * $ratio; // Reset height to match scaled image $newwidth = $width * $ratio; } else { $newheight = $height; $newwidth = $width; } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); $tmp = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $InsertImagethumb1 = $tno . $imagefleimagename1; $imagefleimagename = "$ImageThumbPath/" . $InsertImagethumb1; imagejpeg($tmp, $imagefleimagename, 100); imagedestroy($src); imagedestroy($tmp); //////---------------End Upload Brand Image------------//////////// } //================================ Image 1 End============================== /*----------------------------------------------*/ $sqladd = mysqli_query($conn, "update $tableName set caption ='$caption', image='$InsertImage1' , thumb='$InsertImagethumb1' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); unlink($ImageThumbPath . $Un_Image1); } } header('Location: ../' . $returnurl . '?m=4'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=5'); } } function deleteSole($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $thumb1 = $rowi['thumb']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); unlink($ImageThumbPath . $thumb1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } // ===================================== /*--------Delete Category close-----------------------------------------------*/ function addCourse1($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); $sql = "insert into $tableName(name,description) values('$name','$description')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); // echo "fail"; } } function editCourse1($conn, $tableName, $returnurl) { $id = mysqli_real_escape_string($conn, $_POST['txtid']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*------- ------ ------- ------ -------*/ $sqladd = mysqli_query($conn, "update $tableName set name='$name', description='$description' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { // ================================== header('Location: ../' . $returnurl . '?m=4&id=' . $id); //echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteCourse1($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=6'); } else { header('Location: ../' . $returnurl . '?m=7'); } } function addTiming($conn, $tableName, $returnurl) { $name = mysqli_real_escape_string($conn, $_POST['txtname']); $sql = "insert into $tableName(timing) values('$name')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); // echo "fail"; } } function editTiming($conn, $tableName, $returnurl) { $id = mysqli_real_escape_string($conn, $_POST['txtid']); $name = mysqli_real_escape_string($conn, $_POST['txtname']); /*------- ------ ------- ------ -------*/ $sqladd = mysqli_query($conn, "update $tableName set timing='$name' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { // ================================== header('Location: ../' . $returnurl . '?m=4&id=' . $id); //echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteTiming($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=6'); } else { header('Location: ../' . $returnurl . '?m=7'); } } /*--------Add Category-----------------------------------------------*/ /*--------Delete Category close-----------------------------------------------*/ function addMachine($conn, $tableName, $returnurl) { $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $youtube = mysqli_real_escape_string($conn, $_POST['txtyoutube']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //---------------------condition--check dots------------------------ $dots = substr_count($imagefleimagename1, '.'); if ($dots > 1) { header('Location: ../' . $returnurl . '?m=2&n=Rooms Image'); exit(0); } //------------------------------------------------------------------ //-----------------------check compalsory image------------------------------------------- /*if($imagefleimagename1==""){ header('Location: ../add-image.php?m=3&n=Product Image&id='.$productID);exit(0); } //---------------------------------------------------------------------------------------- //-----------------------check compalsory image size-------------------------------------- list($width1,$height1)=getimagesize($imagefleimagename1_tmp); if($width1<1000){ header('Location: ../add-image.php?m=13&n=1000px Product Image&id=');exit(0); } //----------------------------------------------------------------------------------------*/ //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $machinePath; global $machinePathThumb; $ImagePath = "$machinePath/"; $ImageThumbPath = "$machinePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $newfile1); //////---------------End Image 1 end------------//////////// } else { $newfile1 = ""; } //================================ Image 2 ============================== if ($imagefleimagename2 != "") { //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=3'); exit(); } $newfile2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $newfile2); //////---------------End Image 2 end------------//////////// } else { $newfile2 = ""; } $sql = "insert into $tableName(heading,youtube_link,description, image,broucher_image) values('$heading','$youtube','$description','$newfile1','$newfile2')"; if (mysqli_query($conn, $sql) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); // echo "success"; } else { header('Location: ../' . $returnurl . '?m=0'); // echo "fail"; } } function editMachine($conn, $tableName, $returnurl) { $id = mysqli_real_escape_string($conn, $_POST['txtid']); $heading = mysqli_real_escape_string($conn, $_POST['txtheading']); $youtube = mysqli_real_escape_string($conn, $_POST['txtyoutube']); $description = mysqli_real_escape_string($conn, $_POST['txtdescription']); /*-------------------------Image info-----------------------------*/ //------------------brand logo-------------------------- $imagefleimagename1 = $_FILES['image1fleimage']['name']; $imagefleimagename1_tmp = $_FILES['image1fleimage']['tmp_name']; $imagefleimagename2 = $_FILES['image2fleimage']['name']; $imagefleimagename2_tmp = $_FILES['image2fleimage']['tmp_name']; //------------------brand img 1-------------------------- //------now clear all condtion is good-------------if two image not avale----- function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str, $i + 1, $l); return $ext; } // ------------- get all images name ------------------------- $sel = mysqli_query($conn, "select * from $tableName where id = '$id' "); $row = mysqli_fetch_assoc($sel); $Un_OrginalImage1 = $row['image']; $Un_OrginalImage2 = $row['broucher_image']; /*--------------insert record varible record------------*/ $InsertImage1 = $row['image']; $InsertImage2 = $row['broucher_image']; /*---------------------------*/ $flagImage1 = 0; $flagImage2 = 0; // ------------- get all images name ------------------------- $no = rand(1, 999); $tno = rand(1, 999); ///////--------------Upload Logo Image-----------------//////////// global $machinePath; global $machinePathThumb; $ImagePath = "$machinePath/"; $ImageThumbPath = "$machinePathThumb/"; //================================ Image 1 ============================== if ($imagefleimagename1 != "") { $flagImage1 = 1; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename1; $uploadedfile = $imagefleimagename1; $imagefleimagename1 = stripslashes($imagefleimagename1); $extension = getExtension($imagefleimagename1); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=16&id=' . $id); exit(); } $InsertImage1 = $no . $imagefleimagename1; move_uploaded_file($_FILES["image1fleimage"]['tmp_name'], "$ImagePath" . $InsertImage1); //////---------------End Upload Brand Image------------//////////// } // ======================= image 2 ========================= if ($imagefleimagename2 != "") { $flagImage2 = 2; //check if image has 2 dot then exit program //$catfile = $imagefleimagename1; $image = $imagefleimagename2; $uploadedfile = $imagefleimagename2; $imagefleimagename2 = stripslashes($imagefleimagename2); $extension = getExtension($imagefleimagename2); $extension = strtolower($extension); /*-------------------------------*/ /*---------------------------------*/ if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { header('Location: ../' . $returnurl . '?m=16&id=' . $id); exit(); } $InsertImage2 = $no . $imagefleimagename2; move_uploaded_file($_FILES["image2fleimage"]['tmp_name'], "$ImagePath" . $InsertImage2); //////---------------End Upload Brand Image------------//////////// } /*------- ------ ------- ------ -------*/ $sqladd = mysqli_query($conn, "update $tableName set heading='$heading', youtube_link='$youtube', description='$description', image='$InsertImage1', broucher_image='$InsertImage2' where id = '$id'") or die(mysqli_error($conn)); if (mysqli_affected_rows($conn) > 0) { if ($flagImage1 == 1) { if ($Un_OrginalImage1 != "") { unlink($ImagePath . $Un_OrginalImage1); } } if ($flagImage2 == 2) { if ($Un_OrginalImage2 != "") { unlink($ImagePath . $Un_OrginalImage2); } } // ================================== header('Location: ../' . $returnurl . '?m=4&id=' . $id); //echo "success"; } else { header('Location: ../' . $returnurl . '?m=5&id=' . $id); } } function deleteMachine($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; $v = isset($_GET['v']) ? $_GET['v'] : ""; $mainid = isset($_GET['mainid']) ? $_GET['mainid'] : ""; // ====== check how many product in this group========= $flag = 0; // =================================== $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; $image2 = $rowi['broucher_image']; } //echo "value is ".$id; global $machinePath; global $machinePathThumb; $ImagePath = "$machinePath/"; $ImageThumbPath = "$machinePathThumb/"; // ====== check how many product in this group========= //echo "value is ".$id; $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($flag == 1) { if ($image1 != "") { unlink($ImagePath . $image1); } if ($image2 != "") { unlink($ImagePath . $image2); } header('Location: ../' . $returnurl . '&m=6'); } else { header('Location: ../' . $returnurl . '?m=6'); } } else { header('Location: ../' . $returnurl . '?m=7'); } } /*--------Add Category-----------------------------------------------*/ function addOrder($conn, $tableName, $returnurl) { $orderID = getUID(); $customerid = mysqli_real_escape_string($conn, $_POST['txtid']); $courseid = mysqli_real_escape_string($conn, $_POST['courseid']); $amount = mysqli_real_escape_string($conn, $_POST['amount']); $name = mysqli_real_escape_string($conn, $_POST['name']); $email = mysqli_real_escape_string($conn, $_POST['email']); $phone = mysqli_real_escape_string($conn, $_POST['phone']); $address = mysqli_real_escape_string($conn, $_POST['address']); $location = mysqli_real_escape_string($conn, $_POST['location']); $locationAry = explode('-', $location); $state = $locationAry[0]; $city = $locationAry[1]; $date = date('Y-m-d'); $sqls = "insert into $tableName(order_id,order_date,user_id,email,name,phone,address,city,state,course_id,payment_status,amount) values('$orderID','$date','$customerid','$email','$name','$phone','$address','$city','$state','$courseid',1,'$amount')"; if (mysqli_query($conn, $sqls) or die(mysqli_error($conn))) { header('Location: ../' . $returnurl . '?m=1'); } else { header('Location: ../' . $returnurl . '?m=0'); } // ================ insert product in product details =============== } function getUID() { $time = ""; $time .= date('y'); $time .= date('m'); $time .= date('d'); $time .= date('h'); $time .= date('i'); $time .= date('s'); $time .= rand(10, 99); return $time; } function deleteGloble($conn, $tableName, $returnurl) { $id = isset($_GET['id']) ? $_GET['id'] : ""; //------------------------------------------------------------------------------------ $checkSql = mysqli_query($conn, "select * from $tableName where id ='$id'") or die(mysqli_error($conn)); if (mysqli_num_rows($checkSql) > 0) { $rowi = mysqli_fetch_assoc($checkSql); $image1 = $rowi['image']; } //echo "value is ".$id; global $solePath; global $solePathThumb; $ImagePath = "$solePath/"; $ImageThumbPath = "$solePathThumb/"; $sql = mysqli_query($conn, "START TRANSACTION"); $del = "delete from $tableName where id = '$id' "; if (mysqli_query($conn, $del) or die(mysqli_error($conn))) { if ($image1 != "") { unlink($ImagePath . $image1); } mysqli_query($conn, "COMMIT"); header('Location: ../' . $returnurl . '?&m=6'); } else { mysqli_query($conn, "ROLLBACK"); header('Location: ../' . $returnurl . '?m=7'); } //---------------------------------------------------------- } /*--------Delete Category close-----------------------------------------------*/
Save
cmd:
run