GIF89a; table_name=$table; global $con; $userName=mysqli_real_escape_string($con,$_POST['username']); $userPass=mysqli_real_escape_string($con,sha1($_POST['password'])); $query="SELECT username,password FROM ".$this->table_name." WHERE username='$userName' AND password='$userPass'"; $result=mysqli_query($con,$query) or die(mysqli_error()); if(mysqli_num_rows($result)>0){ $_SESSION['user']="userlogging"; header('location:dashboard.php'); } else{ echo ""; } } //code to insert gallery details function insert_gallery_details($table){ $this->table_name=$table; global $con; //upload multiple images $name=array(); $path = "upload/gallery/"; if(@count($_FILES['product_image']['tmp_name'])){ $i=0; foreach ($_FILES['product_image']['tmp_name'] as $index=>$tmp_name) { $tmpName = $_FILES[ 'product_image' ][ 'name' ][ $index ]; $tmpDest = $_FILES[ 'product_image' ][ 'tmp_name' ][ $index ]; $i++; $ext = explode(".",$tmpName); $size = sizeof($ext); $r = md5($ext[0]); $filename = $r.".".$ext[$size-1]; if( !empty( $tmpDest ) && is_uploaded_file( $tmpDest ) ) { $imgup=move_uploaded_file($tmpDest, $path.$filename); } if(@$imgup) { array_push($name,$filename); } } $img_upsd=json_encode($name); } $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(imgtype,sl_img) value('$_POST[imgtype]','$img_upsd')") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; if($result) return $msg="pass"; else return $msg="fail"; } //code to insert visa_spl details function insert_visa_spl_details($table){ $this->table_name=$table; global $con; //upload multiple images $name=array(); $path = "upload/visaspl/"; if(@count($_FILES['product_image']['tmp_name'])){ $i=0; foreach ($_FILES['product_image']['tmp_name'] as $index=>$tmp_name) { $tmpName = $_FILES[ 'product_image' ][ 'name' ][ $index ]; $tmpDest = $_FILES[ 'product_image' ][ 'tmp_name' ][ $index ]; $i++; $ext = explode(".",$tmpName); $size = sizeof($ext); $r = md5(rand().$ext[0]); $filename = $r.".".$ext[$size-1]; if( !empty( $tmpDest ) && is_uploaded_file( $tmpDest ) ) { $imgup=move_uploaded_file($tmpDest, $path.$filename); } if(@$imgup) { array_push($name,$filename); } } $img_upsd=json_encode($name); } $blog_desc = addslashes($_POST['blog_desc']); $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(type,imgtype,sl_img,blog_desc) value('$_POST[type]','$_POST[imgtype]','$img_upsd','$blog_desc')") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; if($result) return $msg="pass"; else return $msg="fail"; } //code to insert gallery details function insert_blog_details($table){ $this->table_name=$table; global $con; //upload multiple images $name=array(); $path = "upload/gallery/"; if(@count($_FILES['product_image']['tmp_name'])){ $i=0; foreach ($_FILES['product_image']['tmp_name'] as $index=>$tmp_name) { $tmpName = $_FILES[ 'product_image' ][ 'name' ][ $index ]; $tmpDest = $_FILES[ 'product_image' ][ 'tmp_name' ][ $index ]; $i++; $ext = explode(".",$tmpName); $size = sizeof($ext); $r = md5($ext[0]); $filename = $r.".".$ext[$size-1]; if( !empty( $tmpDest ) && is_uploaded_file( $tmpDest ) ) { $imgup=move_uploaded_file($tmpDest, $path.$filename); } if(@$imgup) { array_push($name,$filename); } } $img_upsd=json_encode($name); } $blog_desc = addslashes($_POST['blog_desc']); $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(imgtype,sl_img,blog_desc) value('$_POST[imgtype]','$img_upsd','$blog_desc')") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; if($result) return $msg="pass"; else return $msg="fail"; } //code to insert package details function insert_package_details($table){ $this->table_name=$table; global $con; //upload multiple images $name=array(); $path = "upload/tour/"; if(@count($_FILES['product_image']['tmp_name'])){ $i=0; foreach ($_FILES['product_image']['tmp_name'] as $index=>$tmp_name) { $tmpName = $_FILES[ 'product_image' ][ 'name' ][ $index ]; $tmpDest = $_FILES[ 'product_image' ][ 'tmp_name' ][ $index ]; $i++; $ext = explode(".",$tmpName); $size = sizeof($ext); $r = md5($ext[0]); $filename = $r.".".$ext[$size-1]; if( !empty( $tmpDest ) && is_uploaded_file( $tmpDest ) ) { $imgup=move_uploaded_file($tmpDest, $path.$filename); } if(@$imgup) { array_push($name,$filename); } } $img_upsd=json_encode($name); } $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(type,place_name,package,heading,price,p_desc,s_no,sl_img) value('$_POST[type]','$_POST[place_name]','$_POST[pack_name]','$_POST[heading]','$_POST[price]','$_POST[pdesc]','$_POST[s_no]','$img_upsd')") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; //code to move uploded file move_uploaded_file($_FILES['photo']['tmp_name'],"upload/place/".$max_id.".jpg"); if($result) return $msg="pass"; else return $msg="fail"; } //select package details function select_package($table,$place){ $this->table_name=$table; global $con; if(empty($place)){ $qry = mysqli_query($con,"SELECT * FROM ".$this->table_name." order by position DESC ") or die("select query fail".mysqli_error()); }else{ $qry = mysqli_query($con,"SELECT * FROM ".$this->table_name." where place_name='$place' order by position DESC ") or die("select query fail".mysqli_error()); } return $qry; } //code to insert placd details function insert_place($table){ $this->table_name=$table; global $con; $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(place_name,pack_name,price,side) value('$_POST[place_name]','$_POST[pack_name]','$_POST[price]','$_POST[side]') ") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; //code to move uploded file move_uploaded_file($_FILES['photo']['tmp_name'],"upload/place/".$max_id.".jpg"); if($result) return $msg="pass"; else return $msg="fail"; } //select place details function select_Place($table){ $this->table_name=$table; global $con; $qry = mysqli_query($con,"SELECT * FROM ".$this->table_name." order by id DESC") or die("select query fail".mysqli_error()); return $qry; } //select place details function select_all_dtl($table,$o){ $this->table_name=$table; global $con; $qry = mysqli_query($con,"SELECT * FROM ".$this->table_name." $o") or die("select query fail".mysqli_error()); return $qry; } //select place details function select_contact_us($table){ $this->table_name=$table; global $con; $qry = mysqli_query($con,"SELECT * FROM ".$this->table_name." order by menu_id DESC") or die("select query fail".mysqli_error()); return $qry; } //code to insert tour time details function insert_tourtime_details($table){ $this->table_name=$table; global $con; $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(package,heading,p_desc) value('$_POST[package]','$_POST[heading]','$_POST[p_desc]') ") or die(mysqli_error()); //select max id to upload file $qq=mysqli_query($con,"select max(id) from $this->table_name") or die(mysqli_error()); $rr=mysqli_fetch_array($qq); $max_id=$rr[0]; //code to move uploded file move_uploaded_file($_FILES['photo']['tmp_name'],"upload/tour/".$max_id.".jpg"); if($result) return $msg="pass"; else return $msg="fail"; } //insert tour cost function insert_tour_cost($table){ $this->table_name=$table; global $con; $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(package,no_people,Deluxe,Super_Deluxe,Premuim,Luxury) value('$_POST[package]','$_POST[no_of_people]','$_POST[dcost]','$_POST[sdcost]','$_POST[pcost]','$_POST[lcost]') ") or die(mysqli_error()); if($result) return $msg="pass"; else return $msg="fail"; } //insert other info function insert_other_info($table){ $this->table_name=$table; global $con; $result=mysqli_query($con,"INSERT INTO ".$this->table_name."(package,inclusions,exclusions,conditions) value('$_POST[package]','$_POST[Inclusions]','$_POST[Exclusions]','$_POST[Conditions]') ") or die(mysqli_error()); if($result) return $msg="pass"; else return $msg="fail"; } }//closing of class ?>