Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/public_html/governmentofindia.in/dt_admin/lib/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/public_html/governmentofindia.in/dt_admin/lib/functions.php

<?php
	session_start();
	date_default_timezone_set('Asia/Kolkata');
	
	$project_title  =   "Government Of India";
	$author			=	"Government Of India";
	$project_base_url	=	"https://www.governmentofindia.in/";
	$ico_icon_path		=	$project_base_url."images/india-bharat-flag-ico.ico";
			
		class login_function
		{
			private $con;
			
			function __construct()
			{
				$this->con = new mysqli("localhost","wwwdreamtechnolo_gov_admin","xyjgw9rk52w7","wwwdreamtechnolo_government_of_india");
				//$this->con = new mysqli("localhost","root","","bravemy8_main_breakingnews");
				$this->con->set_charset("utf8");
			}
			
			function get_thumbnail_image_from_post_id($post_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `post_contents`, `another_description` FROM `post_details` WHERE `post_id`=? AND `post_content_type_code_no`=11"))
				{	
					$stmt_select->bind_param("i",$post_id);
				
					$stmt_select->bind_result($result_contents,$another_description);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							$data = array();
							$data[0] = $result_contents;
							$data[1] = $another_description;

							return $data;
						}
					}
					return false;
				}
			}
			
			function get_post_sub_category_id($post_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `category` FROM `add_post` WHERE `id`=?"))
				{
					$stmt_select->bind_param("i",$post_id);
				
					$stmt_select->bind_result($result_category);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_category;
						}
					}
					return false;
				}
			}
			
			function get_total_count_of_news_by_subcategory($sub_category_id)
			{
			 	if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `add_post` where `status`=1 AND `category` IN (".$sub_category_id.")"))
				{
					$stmt_select->bind_result($result_count);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_count;
						}
					}
					return false;
				}
			}
			
			function get_total_count_of_news()
			{
				if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `add_post` where `status`=1"))
				{
					$stmt_select->bind_result($result_count);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_count;
						}
					}
					return false;
				}
			}
			
			function get_sub_category_name_from_id($post_subcat_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `category`,`title` FROM `sub_category` WHERE `id`=?"))
				{
					$stmt_select->bind_param("i",$post_subcat_id);
				
					$stmt_select->bind_result($result_category,$result_title);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							$data[0] = $result_category;
							$data[1] = $result_title;
							
							return $data;
						}
					}
					return false;
				}
			}
			
			function get_main_category_name_from_id($cat_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `category_title` FROM `category` WHERE `id`=?"))
				{
					$stmt_select->bind_param("i",$cat_id);
				
					$stmt_select->bind_result($result_title);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_title;
						}
					}
					return false;
				}
			}
			
			function get_name_of_post_from_id($post_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `post_contents` FROM `post_details` WHERE `post_id`=? AND `post_content_type_code_no`=5"))
				{	
					$stmt_select->bind_param("s",$post_id);
				
					$stmt_select->bind_result($result_contents);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_contents;
						}
					}
					return false;
				}
			}
			
			function get_text_title_color($post_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `title_color` FROM `add_post` WHERE `id`=?"))
				{	
					$stmt_select->bind_param("s",$post_id);
				
					$stmt_select->bind_result($result_contents);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_contents;
						}
					}
					return false;
				}
			}
			
			function get_page_english_title_from_post_id($post_id)
			{
				if($stmt_select = $this->con->prepare("SELECT `post_contents` FROM `post_details` WHERE `post_id`=? AND `post_content_type_code_no`=19"))
				{	
					$stmt_select->bind_param("s",$post_id);
				
					$stmt_select->bind_result($result_contents);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_contents;
						}
					}
					return false;
				}
			}

			function get_password_from_user_name($email)
			{
				if($stmt_select = $this->con->prepare("Select `password` from `admin` where `admin_name` = ? "))
				{	
					$stmt_select->bind_param("s",$email);
				
					$stmt_select->bind_result($result_password);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_password;
						}
					}
							return false;
				}
			}

			function get_exist_tags_from_tag_code_no($blog_post_id,$content_type)
			{
				if($stmt_select = $this->con->prepare("Select `id` from `post_details` where `post_id` = ? AND `post_content_type_code_no` = ? "))
				{	
					$stmt_select->bind_param("ss",$blog_post_id,$content_type);
				
					$stmt_select->bind_result($result_id);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_id;
						}
					}
							return false;
				}
			}

			function change_user_password($email,$password)
			{ 
				$date = date("Y-m-d");
				$time = date("H:i:s A");
			
				if($stmt_select = $this->con->prepare("update `admin` set `password`='".$password."' where `admin_name` = ?"))
				{
					$stmt_select->bind_param("s",$email);				
				
					if($stmt_select->execute())
					{					
						return true;
					}
						return false;
				}
			}
			function add_registration($user_name,$mobile_number,$address,$aadhar_number,$election_card_no,$vehicle_number,$election_matdarsangh,$rent_own)
			{
				$date = date("Y-m-d");
				$time = date("H-i-s A");
				
				if($stmt_insert = $this->con->prepare("INSERT INTO `registration`(`name`, `mobile_no`, `address`, `addhar_no`, `election_card_no`, `vechical_no`, `matdarsangh`, `vechical_on`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?)"))
				{
				
					$stmt_insert->bind_param("ssssssssss",$user_name,$mobile_number,$address,$aadhar_number,$election_card_no,$vehicle_number,$election_matdarsangh,$rent_own,$date,$time);
					
					if($stmt_insert->execute())
					{ 
						return true;
					}
					return false;
				} 
			}
			function add_post_details($blog_post_id,$content_type,$description,$another_description)
			{
				$date = date("Y-m-d");
				$time = date("h:i:s A");
				
				if($stmt_insert = $this->con->prepare("INSERT INTO `post_details`(`post_id`, `post_content_type_code_no`, `post_contents`, `insertion_date`, `insertion_time`, `last_updated_date`, `last_updated_time`,`another_description`) VALUES (?,?,?,?,?,?,?,?)"))
				{				
					$stmt_insert->bind_param("ssssssss",$blog_post_id,$content_type,$description,$date,$time,$date,$time,$another_description);
					
					if($stmt_insert->execute())
					{ 
						return true;
					}
					return false;
				} 
			}
			
			function update_post_content_details($content_id,$content_type,$description)
			{
				$date = date("Y-m-d");
				$time = date("h:i:s A");
				
				if($stmt_insert = $this->con->prepare("UPDATE `post_details` SET `post_content_type_code_no`=?,`post_contents`=?,`last_updated_date`=?,`last_updated_time`=? WHERE `id`=?"))
				{				
					$stmt_insert->bind_param("ssssi",$content_type,$description,$date,$time,$content_id);
					
					if($stmt_insert->execute())
					{ 
						return true;
					}
					return false;
				} 
			}
			
			function get_all_reg_details()
			{
				if($stmt_insert = $this->con->prepare("SELECT `id`, `name`, `mobile_no`, `address`, `addhar_no`, `election_card_no`, `vechical_no`, `matdarsangh`, `vechical_on`, `date`, `time` FROM `registration`"))
				{	
					$stmt_insert->bind_result($id,$name,$mobile_no,$address,$addhar_no,$election_card_no,$vechical_no,$matdarsangh,$vechical_on,$date,$time);
					
					if($stmt_insert->execute())
					{
							$counter	=	0;
							$details	=	array();
						while($stmt_insert->fetch())
						{
							$details[$counter][0]	=	$id;
							$details[$counter][1]	=	$name;
							$details[$counter][2]	=	$mobile_no;
							$details[$counter][3]	=	$address;
							$details[$counter][4]	=	$addhar_no;
							$details[$counter][5]	=	$election_card_no;
							$details[$counter][6]	=	$vechical_no;
							$details[$counter][7]	=	$matdarsangh;
							$details[$counter][8]	=	$vechical_on;
							$details[$counter][9]	=	$date;
							$details[$counter][10]	=	$time;
							
							$counter++;
						}
						if(!empty($details))	
						{
							return $details;
						}
						return false;
					}	
				}
			}
			function get_mobile_no_registartion($mobile_number)
			{ 
				if($stmt=$this->con->prepare("SELECT `id` FROM `registration` WHERE `mobile_no`=?"))
				{
					$stmt->bind_param("s",$mobile_number);
					
					$stmt->bind_result($res_id);
					
					if($stmt->execute())
					{
						if($stmt->fetch())
						{
							return $res_id;
						}
					}
					else
					{
						return false;
					}
				}
				
			}
			
			function delete_reg_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `registration` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			/**************************************************************************************************************************/
		function get_id_from_category_name($category_name)
		{
			if($stmt = $this->con->prepare("SELECT `id` FROM `category` WHERE `category_title`=?" ))
			{
				
				$stmt->bind_param("s",$category_name);
				
				
				$stmt->bind_result($output_id);
				
				
				if($stmt->execute())
				{
					
					if($stmt->fetch())
					{
						
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function  save_category($category_name,$icon_image)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `category`( `category_title`, `icon_image`, `date`, `time`)   VALUES (?,?,?,?)"))
			{
				
				$stmt->bind_param("ssss", $category_name,$icon_image,$date,$time);
				 
				if($stmt->execute())
				{
					return true;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		 function get_multiple_rows_of_category()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_title`, `icon_image`, `date`, `time` FROM `category` "))
			{
				
                         $stmt->bind_result($id, $category_name ,$icon_image , $date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category_name;
						$data[$row][2]	=	$icon_image;
						$data[$row][3]	=	$date;
						$data[$row][4]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function delete_category_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `category` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			
			function delete_sub_category_record_name($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `sub_category` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			
			
			function get_category_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_title`, `icon_image`, `date`, `time` FROM `category` WHERE  `id`= ? "))
			{
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$category_name,$icon_image, $date,$time);
				
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$category_name;
						$data[2]	=	$icon_image;
						$data[3]	=	$date;
						$data[4]	=	$time;
						return $data;
					}
				}
				return false;
			}
		}
		
		function get_post_title_details_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`, `status`, `post_unique_visits` FROM `add_post` WHERE `id`= ?"))
			{
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$category,$title,$post_visits, $date,$time,$status,$post_unique_visits);
				
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$category;
						$data[2]	=	$title;
						$data[3]	=	$post_visits;						
						$data[4]	=	$date;
						$data[5]	=	$time;
						$data[6]	=	$status;
						$data[7]	=	$post_unique_visits;
						
						return $data;
					}
				}
				return false;
			}
		}
		
		function  update_category_record($id,$category_name)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");

			if($stmt = $this->con->prepare("UPDATE `category` SET `category_title`=?,`date`=?,`time`=? WHERE `id`=?"))
			{				
				$stmt->bind_param("sssi",$category_name,$date,$time,$id);
				
				if($stmt->execute())
				{
					echo "++";
					return true;
				}
				return false;
			}
		}
		function  update_image_record($id,$icon_image)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			echo $id,$icon_image;
			if($stmt = $this->con->prepare("UPDATE `category` SET `icon_image`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				
				$stmt->bind_param("sssi",$icon_image,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		/***************************************************************************************************************************/
		function get_id_from_question($question)
		{
			if($stmt = $this->con->prepare("SELECT `id`  FROM `questions`  WHERE `question`=?" ))
			{
				$stmt->bind_param("s",$question);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function  save_question($question,$option1,$option2,$option3,$option4,$select_ans_option)
		{
			$question_type  = "text";
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `questions`(`question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time`)    VALUES (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt->bind_param("sssssssss", $question,$option1,$option2,$option3,$option4,$select_ans_option,$question_type,$date,$time);
				 if($stmt->execute())
				{
					return true;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		function get_multiple_rows_of_question()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time` FROM `questions`"))
			{
				
                         $stmt->bind_result($id, $question ,$option1 , $option2 ,$option3 ,$option4 ,$select_ans_option ,$question_type ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$question;
						$data[$row][2]	=	$option1;
						$data[$row][3]	=	$option2;
						$data[$row][4]	=	$option3;
						$data[$row][5]	=	$option4;
						$data[$row][6]	=	$select_ans_option;
						$data[$row][7]	=	$question_type;
						$data[$row][8]	=	$date;
						$data[$row][9]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function delete_question_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `questions` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_question_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time` FROM `questions` WHERE  `id`= ? "))
			{
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$question,$option1,$option2,$option3,$option4,$select_ans_option,$question_type, $date,$time);
				
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$question;
						$data[2]	=	$option1;
						$data[3]	=	$option2;
						$data[4]	=	$option3;
						$data[5]	=	$option4;
						$data[6]	=	$select_ans_option;
						$data[7]	=	$question_type;
						$data[8]	=	$date;
						$data[9]	=	$time;
						return $data;
					}
				}
				return false;
			}
		}
		function update_question_record($id,$question,$option1,$option2,$option3,$option4,$select_ans_option)
		{ 
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `questions` SET `question`=?,`option1`=?,`option2`=?,`option3`=?,`option4`=?,`select_ans_option`=?,`date`=?,`time`=?  WHERE `id`=?"))
			{ 
				$stmt->bind_param("ssssssssi",$question,$option1,$option2,$option3,$option4,$select_ans_option,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		/**************************************************************************************/
		function  save_image_question($question,$name_option1,$name_option2,$name_option3,$name_option4,$select_image_ans_option)
		{ 
			$question_type  = "image";
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `image_question`(`question`, `option1`, `option2`, `option3`, `option4`, `answer`, `question_type`, `date`, `time`)  VALUES (?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt->bind_param("sssssssss", $question,$name_option1,$name_option2,$name_option3,$name_option4,$select_image_ans_option,$question_type,$date,$time);
			 if($stmt->execute())
				{
					return true;
				}
			else
				{
					echo $stmt->error;
				}
			}
		}
		function delete_image_question_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `image_question` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_multiple_rows_of_image_question()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `answer`, `question_type`, `date`, `time` FROM `image_question` "))
			{
				
                         $stmt->bind_result($id, $question ,$option1 , $option2 ,$option3 ,$option4 ,$select_image_ans_option ,$question_type ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$question;
						$data[$row][2]	=	$option1;
						$data[$row][3]	=	$option2;
						$data[$row][4]	=	$option3;
						$data[$row][5]	=	$option4;
						$data[$row][6]	=	$select_image_ans_option;
						$data[$row][7]	=	$question_type;
						$data[$row][8]	=	$date;
						$data[$row][9]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function update_image_question_record($question,$option1,$option2,$option3,$option4,$select_image_ans_option)
		{ 
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `image_question` SET `question`=?,`option1`=?,`option2`=?,`option3`=?,`option4`=?,`select_image_ans_option`=?,`date`=?,`time`=?  WHERE `id`=?"))
			{ 
				$stmt->bind_param("ssssssssi",$question,$option1,$option2,$option3,$option4,$select_image_ans_option,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		function get_image_question_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `answer`, `question_type`, `date`, `time` FROM `image_question` WHERE  `id`= ? "))
			{
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$question,$option1,$option2,$option3,$option4,$select_image_ans_option,$question_type, $date,$time);
				
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$question;
						$data[2]	=	$option1;
						$data[3]	=	$option2;
						$data[4]	=	$option3;
						$data[5]	=	$option4;
						$data[6]	=	$select_image_ans_option;
						$data[7]	=	$question_type;
						$data[8]	=	$date;
						$data[9]	=	$time;
						return $data;
			
					}
				}
			}
		}
		function  update_image_question($id, $question)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			if($stmt = $this->con->prepare("UPDATE `image_question` SET `question`=? WHERE `id`=?"))
			{
				$stmt->bind_param("si",$question,$id);
				
				if($stmt->execute())
				{
					
					return true;
				}
				return false;
			}
		}
		/**************************************************************************************************************************/
		function get_id_from_user_name($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id` FROM `user` WHERE `mobile_number`=?" ))
			{ 
				$stmt->bind_param("s",$mobile_number);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function  save_user_data($full_name,$mobile_number,$password)
		{ 
		   
			$account_status  = "Pending";
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `user`(`full_name`, `mobile_number`, `password`, `account_status`, `date`, `time`)  VALUES (?,?,?,?,?,?)"))
			{
				$stmt->bind_param("ssssss", $full_name,$mobile_number,$password,$account_status,$date,$time);
			 if($stmt->execute())
				{ 
					return true;
				}
			else
				{
					echo $stmt->error;
				}
			}
		}
		function delete_user_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `user` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_multiple_rows_of_user()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `full_name`, `mobile_number`, `password`,`account_status`, `date`, `time` FROM `user`"))
			{
				
                         $stmt->bind_result($id, $full_name ,$mobile_number , $password ,$account_status ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$full_name;
						$data[$row][2]	=	$mobile_number;
						$data[$row][3]	=	$password;
						$data[$row][4]	=	$account_status;
						$data[$row][5]	=	$date;
						$data[$row][6]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function update_user_record($id,$full_name,$mobile_number,$password)
		{  
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `user` SET `full_name`=?,`mobile_number`=?,`password`=?,`date`=?,`time`=?  WHERE `id`=?"))
			{  
				$stmt->bind_param("sssssi",$full_name,$mobile_number,$password,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		function get_question_user_from_id($var_edit_id)
		{ 
			if($stmt = $this->con->prepare("SELECT `id`, `full_name`, `mobile_number`, `password`, `account_status`, `date`, `time` FROM `user` WHERE  `id`= ? "))
			{ 
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$full_name,$mobile_number,$password,$account_status,$date,$time);
				
				
				if($stmt->execute())
				{ 
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$full_name;
						$data[2]	=	$mobile_number;
						$data[3]	=	$password;
						$data[4]	=	$account_status;
						$data[5]	=	$date;
						$data[6]	=	$time;
						
						return $data;
					}
				}
				return false;
			}
		}
		/**********************************************************************************************************************************/
		function get_id_from_title($title)
		{
			
			if($stmt = $this->con->prepare("SELECT `id` FROM `news_event`  WHERE `title`=?" ))
			{
				$stmt->bind_param("s",$title);
				$stmt->bind_result($output_id);
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function  save_title($title)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `news_event`( `title`, `date`, `time`) VALUES (?,?,?)"))
			{
				
				$stmt->bind_param("sss", $title,$date,$time);
				 
				if($stmt->execute())
				{
					return $stmt->insert_id;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		function delete_title_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `news_event` WHERE `id`=?"))
				 { 
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{ 
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_multiple_rows_of_title()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `title`,`date`, `time` FROM `news_event` "))
			{
				
                         $stmt->bind_result($id, $title,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$title;
						$data[$row][2]	=	$date;
						$data[$row][3]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function get_title_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `title`, `date`, `time` FROM `news_event`WHERE  `id`= ? "))
			{ 
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$title,$date,$time);
				
				
				if($stmt->execute())
				{ 
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$title;
						$data[2]	=	$date;
						$data[3]	=	$time;
		
						return $data;
					}
				}
				return false;
			}
		}
		function update_title_record($id,$title)
		{  
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `news_event` SET `title`=?,`date`=?,`time`=? WHERE `id`=?"))
			{  
				$stmt->bind_param("sssi",$title,$date,$time,$id);
				
				if($stmt->execute())
				{ 
					return true;
				}
				return false;
			}
		}
		function get_id_from_title_name($title_name)
		{
			if($stmt = $this->con->prepare("SELECT `id` FROM `news_event_image` WHERE `title_name`=?" ))
			{
				$stmt->bind_param("s",$title_name);
				$stmt->bind_result($output_id);
			
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		function  save_image($var_title_id,$title_name,$attachment1)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `news_event_image`( `title_id`,`title_name`, `image`, `date`, `time`)   VALUES (?,?,?,?,?)"))
			{
				
				$stmt->bind_param("sssss",$var_title_id, $title_name,$attachment1,$date,$time);
				 
				if($stmt->execute())
				{
					return true;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		function delete_title_image_record($del_id)
			{ 
				if($stmt= $this->con->prepare("DELETE FROM `news_event_image` WHERE `id`=?"))
				 {  
					$stmt->bind_param("i",$del_id);
					if($stmt->execute())
					{  
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_multiple_rows_of_event_image($var_title_id)
			{ 
			if($stmt = $this->con->prepare("SELECT `id`, `title_id`, `title_name`, `image`, `date`, `time` FROM `news_event_image` WHERE `title_id`=?"))
			{ 			$stmt->bind_param("s",$var_title_id);
                         $stmt->bind_result($id, $title_id,$title_name,$image,$date,$time);
				
				if($stmt->execute())
				{ 
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{  
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$title_id;
						$data[$row][2]	=	$title_name;
						$data[$row][3]	=	$image;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		/*************************************************************************************************/
		function  save_1image_question($question,$option1,$option2,$option3,$option4,$select_ans_option)
		{ 
			$question_type  = "image";
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `questions`(`question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time`)   VALUES (?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt->bind_param("sssssssss", $question,$option1,$option2,$option3,$option4,$select_ans_option,$question_type,$date,$time);
			 if($stmt->execute())
				{
					return true;
				}
			else
				{
					echo $stmt->error;
				}
			}
		}
		function delete_img_question_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `image_question_new` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_multiple_rows_of_img_question()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `select_img_ans_option`, `question_type`, `date`, `time` FROM `image_question_new` "))
			{
				
                         $stmt->bind_result($id, $question ,$option1 , $option2 ,$option3 ,$option4 ,$select_img_ans_option ,$question_type ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$question;
						$data[$row][2]	=	$option1;
						$data[$row][3]	=	$option2;
						$data[$row][4]	=	$option3;
						$data[$row][5]	=	$option4;
						$data[$row][6]	=	$select_img_ans_option;
						$data[$row][7]	=	$question_type;
						$data[$row][8]	=	$date;
						$data[$row][9]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function get_img_question_record_from_id($var_edit_id)
		{ 
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time` FROM `questions` WHERE  `id`= ? "))
			{  
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$question,$option1,$option2,$option3,$option4,$select_img_ans_option,$question_type, $date,$time);
				
				
				if($stmt->execute())
				{ 
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$question;
						$data[2]	=	$option1;
						$data[3]	=	$option2;
						$data[4]	=	$option3;
						$data[5]	=	$option4;
						$data[6]	=	$select_img_ans_option;
						$data[7]	=	$question_type;
						$data[8]	=	$date;
						$data[9]	=	$time;
						return $data;
			
					}
				}
			}
		}
		function update_1img_question_record($option1,$option2,$option3,$option4,$select_img_ans_option,$var_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `image_question_new` SET `option1`=?,`option2`=?,`option3`=?,`option4`=?,`select_img_ans_option`=?,`date`=?,`time`=? WHERE `id`=?"))
			{ 
				$stmt->bind_param("sssssssi",$option1,$option2,$option3,$option4,$select_img_ans_option,$date,$time,$var_edit_id);
				
				if($stmt->execute())
				{ 
					return true;
				}
				return false;
			}
		}
		function  update_img_question($id, $question)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("UPDATE `image_question_new` SET `question`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt->bind_param("sssi",$question,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		


	/************************************************************/
	
			function insert_amount($amount)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `withdrawal_limit`(`amount`, `date`, `time`)VALUES(?,?,?)"))
				{	
					$stmt->bind_param("sss",$amount,$date,$time);
				
				if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 $stmt->error;
					}
				}
			}
			
			
			function update_withdrawl_amount($amount)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `withdrawal_limit` set `amount`=?, `date`=?, `time`=?"))
				{	
					$stmt->bind_param("sss",$amount,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 $stmt->error;
					}
				}
			}
			
			function get_amount_from_withdrawal_limit()
				{
					if($stmt=$this->con->prepare("SELECT `amount` FROM `withdrawal_limit`"))
					{
						$stmt->bind_result($amount);
						
						if($stmt->execute())
						{
							if($stmt->fetch())
							{
								return $amount;
							}
						}
						else
						{
							return false;
						}
					}
				}
				
			
			function insert_winner_amount($amount)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `set_winner_amount`(`amount`, `date`, `time`)VALUES(?,?,?)"))
				{	
					$stmt->bind_param("sss",$amount,$date,$time);
				
					if($stmt->execute())
						{
							return true;
						}
						else
						{  
							 $stmt->error;
						}
				}
			}
			
			
			function update_winner_amount($amount)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `set_winner_amount` set `amount`=?, `date`=?, `time`=?"))
				{	
					$stmt->bind_param("sss",$amount,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 $stmt->error;
					}
				}
			}
			
			function get_winner_amount_from_table()
				{
					if($stmt=$this->con->prepare("SELECT `amount` FROM `set_winner_amount`"))
					{
						$stmt->bind_result($amount);
						
						if($stmt->execute())
						{
							if($stmt->fetch())
							{
								return $amount;
							}
						}
						else
						{
							return false;
						}
					}
				}
			
			function insert_game_instruction($game_instruct)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `game_instructions`(`game_instruct`, `date`, `time`)VALUES(?,?,?)"))
				{	
					$stmt->bind_param("sss",$game_instruct,$date,$time);
				
					if($stmt->execute())
						{
							return true;
						}
						else
						{  
							 $stmt->error;
						}
				}
			}
			
			
			function update_game_instruction($game_instruct)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `game_instructions` set `game_instruct`=?, `date`=?, `time`=?"))
				{	
					$stmt->bind_param("sss",$game_instruct,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 $stmt->error;
					}
				}
			}
			
				function get_game_instruction_from_table()
				{
					if($stmt=$this->con->prepare("SELECT `game_instruct` FROM `game_instructions`"))
					{
						$stmt->bind_result($game_instruct);
						
						if($stmt->execute())
						{
							if($stmt->fetch())
							{
								return $game_instruct;
							}
						}
						else
						{
							return false;
						}
					}
				}
				
		function get_winner_amount()
		{
			if($stmt=$this->con->prepare("SELECT `amount` FROM `set_winner_amount`"))
			{
				$stmt->bind_result($game_instruct);
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $game_instruct;
					}
				}
				else
				{
					return false;
				}
			}
		}	
		
		
		/***********************************************API FUNCTIONS***********************************************/
			function get_password_from_user($mobile_number)
			{
				if($stmt_select = $this->con->prepare("Select `password` from `user` where `mobile_number` = ? "))
				{	
					$stmt_select->bind_param("s",$mobile_number);
				
					$stmt_select->bind_result($result_password);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_password;
						}
					}
							return false;
				}
			}
			function change_login_password($mobile_number,$password)
			{ 
				$date = date("Y-m-d");
				$time = date("H:i:s A");
			
				if($stmt_select = $this->con->prepare("update `user` set `password`='".$password."' where `mobile_number` = ?"))
				{
					$stmt_select->bind_param("s",$mobile_number);				
				
					if($stmt_select->execute())
					{					
						return true;
					}
						return false;
				}
			}
			function get_user_profile($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `full_name`, `mobile_number`, `password`, `wallet_balance`, `account_status`, `date`, `time` FROM `user` WHERE `mobile_number` = ?"))
			{
					$stmt->bind_param("s",$mobile_number);
                    $stmt->bind_result($id, $full_name ,$mobile_number , $password ,$wallet_balance ,$account_status ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					if($stmt->fetch())
					{
                        $data[0]	=	$id;
						$data[1]	=	$full_name;
						$data[2]	=	$mobile_number;
						$data[3]	=	$password;
						$data[4]	=	$wallet_balance;
						$data[5]	=	$account_status;
						$data[6]	=	$date;
						$data[7]	=	$time;
						return $data;
					}
					
				}
				return false;
			}
		}
		function change_password($mobile_number,$new_password)
			{ 
				$date = date("Y-m-d");
				$time = date("H:i:s A");
			
				if($stmt_select = $this->con->prepare("update `user` set `password`='".$new_password."' where `mobile_number` = ?"))
				{
					$stmt_select->bind_param("s",$mobile_number);				
				
					if($stmt_select->execute())
					{					
						return true;
					}
						return false;
				}
			}
			function get_id_from_wallet($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id`  FROM `coin_system`  WHERE `mobile_number`=?" ))
			{
				$stmt->bind_param("s",$mobile_number);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		function  save_coin_to_wallet($mobile_number,$win_amount,$question_id)
		{
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `coin_system`(`user_mobile_number`, `win_amount`, `question_id`, `date`, `time`)VALUES (?,?,?,?,?)"))
			{
				$stmt->bind_param("sssss", $mobile_number,$win_amount,$question_id,$date,$time);
				 if($stmt->execute())
				{
					return true;
				}
				else
				{
					return false;
				}
			}
		}
		function update_user_wallet_balance($mobile_number,$win_amount)
			{ 
				$date = date("Y-m-d");
				$time = date("H:i:s A");
			
				if($stmt_select = $this->con->prepare("update `user` set `wallet_balance`=`wallet_balance`+'".$win_amount."' where `mobile_number` = ?"))
				{
					$stmt_select->bind_param("s",$mobile_number);				
				
					if($stmt_select->execute())
					{					
						return true;
					}
						return false;
				}
			}
			function get_multiple_rows_of_coin_history($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id`,`win_amount`, `question_id`, `date`, `time` FROM `coin_system` WHERE `user_mobile_number`=?"))
			{
				$stmt->bind_param('s',$mobile_number);
                 $stmt->bind_result($id,$win_amount ,$question_id , $date ,$time );
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
						$data[$row][0]	=	$id;
                        $data[$row][1]	=	$win_amount;
						$data[$row][2]	=	$question_id;
						$data[$row][3]	=	$date;
						$data[$row][4]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function get_user_data_from_mobile_number($mobile_number)
		{ 
			if($stmt = $this->con->prepare("SELECT `id`, `full_name`, `mobile_number`, `password`, `wallet_balance`, `account_status`, `date`, `time` FROM `user` WHERE  `mobile_number`= ? "))
			{ 
				$stmt->bind_param("i", $mobile_number);
				
				$stmt->bind_result($id,$full_name,$mobile_number,$password,$wallet_balance,$account_status,$date,$time);
				
				
				if($stmt->execute())
				{  
						$row	=	0;
						$data = array();
						
					while($stmt->fetch())
					{
						$data[$row][0]	=	$id;
						$data[$row][1]	=	$full_name;
						$data[$row][2]	=	$mobile_number;
						$data[$row][3]	=	$password;
						$data[$row][4]	=	$wallet_balance;
						$data[$row][5]	=	$account_status;
						$data[$row][6]	=	$date;
						$data[$row][7]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function save_withdraw_requests($mobile_number,$amount,$upi_id,$bank_name,$account_number,$ifsc_code,$branch)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			$status = "default";
			if($stmt = $this->con->prepare("INSERT INTO `withdraw_requests`(`mobile_number`, `amount`, `upi_id`, `bank_name`, `account_number`, `ifsc_code`, `branch`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?)"))
			{
				
				$stmt->bind_param("ssssssssss",$mobile_number,$amount,$upi_id,$bank_name,$account_number,$ifsc_code,$branch,$status,$date,$time);
				 
				if($stmt->execute())
				{
					return true;
				}
				else
				{
					return false;
				}
			}
		}
		function get_wallet_balance_amount($mobile_number)
			{
				if($stmt_select = $this->con->prepare("SELECT `wallet_balance` FROM `user` WHERE `mobile_number` = ? "))
				{	
					$stmt_select->bind_param("s",$mobile_number);
				
					$stmt_select->bind_result($result_password);
				
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							return $result_password;
						}
					}
							return false;
				}
			}
			function get_user_withdrawal_history($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `mobile_number`, `amount`, `upi_id`, `bank_name`, `account_number`, `ifsc_code`, `branch`, `status`, `date`, `time` FROM `withdraw_requests` WHERE `mobile_number` = ?"))
			{
					$stmt->bind_param("s",$mobile_number);
                    $stmt->bind_result($id, $mobile_number ,$amount , $upi_id ,$bank_name ,$account_number,$ifsc_code,$branch,$status,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$mobile_number;
						$data[$row][2]	=	$amount;
						$data[$row][3]	=	$upi_id;
						$data[$row][4]	=	$bank_name;
						$data[$row][5]	=	$account_number;
						$data[$row][6]	=	$ifsc_code;
						$data[$row][7]	=	$branch;
						$data[$row][7]	=	$status;
						$data[$row][6]	=	$date;
						$data[$row][7]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function get_multiple_rows_of_withdrawal_requests()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `mobile_number`, `amount`, `upi_id`, `bank_name`, `account_number`, `ifsc_code`, `branch`, `status`, `date`, `time` FROM `withdraw_requests`"))
			{
				
                         $stmt->bind_result($id, $mobile_number,$amount,$upi_id,$bank_name,$account_number,$ifsc_code,$branch,$status,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$mobile_number;
						$data[$row][2]	=	$amount;
						$data[$row][3]	=	$upi_id;
						$data[$row][4]	=	$bank_name;
						$data[$row][5]	=	$account_number;
						$data[$row][6]	=	$ifsc_code;
						$data[$row][7]	=	$branch;
						$data[$row][8]	=	$status;
						$data[$row][9]	=	$date;
						$data[$row][10]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		/***************************************************************************************************************************************************/
		
		function update_img_question_option($option1,$option2,$option3,$option4,$select_img_ans_option,$var_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `questions` SET `option1`=?,`option2`=?,`option3`=?,`option4`=?,`select_ans_option`=?,`date`=?,`time`=? WHERE `id`=?"))
			{ 
				$stmt->bind_param("sssssssi",$option1,$option2,$option3,$option4,$select_img_ans_option,$date,$time,$var_edit_id);
				
				if($stmt->execute())
				{ 
					return true;
				}
				return false;
			}
		}
		function  update_img_que($id, $question)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("UPDATE `questions` SET `question`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt->bind_param("sssi",$question,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		
		function get_random_questions()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `question`, `option1`, `option2`, `option3`, `option4`, `select_ans_option`, `question_type`, `date`, `time` FROM `questions` ORDER BY RAND() LIMIT 25"))
			{				
				$stmt->bind_result($id, $question ,$option1 , $option2 ,$option3 ,$option4 ,$select_ans_option ,$question_type ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row]['id']					=	$id;
						$data[$row]['question']				=	$question;
						$data[$row]['option1']				=	$option1;
						$data[$row]['option2']				=	$option2;
						$data[$row]['option3']				=	$option3;
						$data[$row]['option4']				=	$option4;
						$data[$row]['correct_answer_value']	=	$select_ans_option;
						$data[$row]['question_type']		=	$question_type;
						$data[$row]['date']					=	$date;
						$data[$row]['time']					=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function get_terms_condtions_from_table()
				{
					if($stmt=$this->con->prepare("SELECT `term_condition` FROM `terms_condition`"))
					{
						$stmt->bind_result($term_condition);
						
						if($stmt->execute())
						{
							if($stmt->fetch())
							{
								return $term_condition;
							}
						}
						else
						{
							return false;
						}
					}
				}				
			function update_terms_conditions($term_condition)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `terms_condition` set `term_condition`=?, `date`=?, `time`=?"))
				{	
					$stmt->bind_param("sss",$term_condition,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 return false;
					}
				}
			}
			function insert_term_condition($term_condition)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `terms_condition`(`term_condition`, `date`, `time`)VALUES(?,?,?)"))
				{	
					$stmt->bind_param("sss",$term_condition,$date,$time);
				
					if($stmt->execute())
						{
							return true;
						}
						else
						{  
							 return false;
						}
				}
			}
			function get_privacy_policy_from_table()
			{
				if($stmt=$this->con->prepare("SELECT `privacy_policy` FROM `privacy_policy`"))
				{
					$stmt->bind_result($privacy_policy);
					
					if($stmt->execute())
					{
						if($stmt->fetch())
						{
							return $privacy_policy;
						}
					}
					else
					{
						return false;
					}
				}
			}
			
			function get_description_from_content_id($content_id)
			{
				if($stmt=$this->con->prepare("SELECT `post_contents` FROM `post_details` where `id` = ?"))
				{
					$stmt->bind_param("i",$content_id);
					
					$stmt->bind_result($privacy_policy);
					
					if($stmt->execute())
					{
						if($stmt->fetch())
						{
							return $privacy_policy;
						}
					}
					else
					{
						return false;
					}
				}
			}
			
			function get_cms_data_from_cms_id($cms_id)
			{
				if($stmt=$this->con->prepare("SELECT `cms_content` FROM `cms` where `cms_id`=?"))
				{
					$stmt->bind_param("s",$cms_id);
					
					$stmt->bind_result($cms_content);
					
					if($stmt->execute())
					{
						if($stmt->fetch())
						{
							return $cms_content;
						}
					}
					else
					{
						return false;
					}
				}
			}
				
				function insert_privacy_policy($privacy_policy)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `privacy_policy`(`privacy_policy`, `date`, `time`)VALUES(?,?,?)"))
				{	
					$stmt->bind_param("sss",$privacy_policy,$date,$time);
				
					if($stmt->execute())
						{
							return true;
						}
						else
						{  
							 return false;
						}
				}
			}
			
			function insert_cms_data($cms_id,$cms_content)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("INSERT INTO `cms`(`cms_id`,`cms_content`, `date`, `time`)VALUES(?,?,?,?)"))
				{	
					$stmt->bind_param("ssss",$cms_id,$cms_content,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 return false;
					}
				}
			}
			
			function update_cms_data($cms_id,$cms_content)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `cms` set `cms_content`=?, `date`=?, `time`=? where `cms_id`=?"))
				{	
					$stmt->bind_param("ssss",$cms_content,$date,$time,$cms_id);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 return false;
					}
				}
			}
			
			function update_privacy_policy($privacy_policy)
			{
				$date=date("y-m-d");
				$time=date("H:i:s");
					
				if($stmt= $this->con->prepare("update `privacy_policy` set `privacy_policy`=?, `date`=?, `time`=?"))
				{	
					$stmt->bind_param("sss",$privacy_policy,$date,$time);
				
					if($stmt->execute())
					{
						return true;
					}
					else
					{  
						 return false;
					}
				}
			}
			
			/****************************************************V JEWELLERY MARKET***************************************************************************************/
			function get_id_from_category($category_title)
		{
			if($stmt = $this->con->prepare("SELECT `id`  FROM `category`  WHERE `category_title`=?" ))
			{ 
				$stmt->bind_param("s",$category_title);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
				
						return $output_id;
					}
				}
				return false;
		}
		
		function  save_jewellery_category($category_title)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `category`(`category_title`, `date`, `time`) VALUES (?,?,?)"))
			{
				$stmt->bind_param("sss", $category_title,$date,$time);
				 
				if($stmt->execute())
				{
					return $stmt->insert_id;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		
		function get_id_from_sub_category($sub_category)
		{
			if($stmt = $this->con->prepare("SELECT `id`  FROM `jewellery_sub_category`  WHERE `sub_category`=?" ))
			{ 
				$stmt->bind_param("s",$sub_category);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
				
						return $output_id;
					}
				}
				return false;
		}
		
		
		function get_category_name_from_id($id) 
		{
			if($stmt = $this->con->prepare("SELECT `category_title`  FROM `category`  WHERE `id`=?" ))
			{ 
				$stmt->bind_param("i",$id);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
				
						return $output_id;
					}
				}
				return false;
		}
		
		function  save_sub_category($var_sub_category_id,$sub_category)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `jewellery_sub_category`( `category_id`,`sub_category_title`, `date`, `time`)   VALUES (?,?,?,?)"))
			{
				
				$stmt->bind_param("ssss",$var_sub_category_id, $sub_category,$date,$time);
				 
				if($stmt->execute())
				{
					return true;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		
		function get_multiple_rows_of_jewellery_category()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_title`, `date`, `time` FROM `category`"))
			{
				
                         $stmt->bind_result($id, $category_title,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category_title;
						$data[$row][2]	=	$date;
						$data[$row][3]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_sub_category()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_id`, `sub_category_title`, `date`, `time` FROM `jewellery_sub_category`"))
			{
                $stmt->bind_result($id, $category_id, $sub_category_title, $date, $time);
				
				if($stmt->execute())
				{
					$data	=	array();
					
					$counter = 0;
					
					while($stmt->fetch())
					{
                        $data[$counter][0]	=	$id;
						$data[$counter][1]	=	$category_id;
						$data[$counter][2]	=	$sub_category_title;
						$data[$counter][3]	=	$date;
						$data[$counter][4]	=	$time;
						
						$counter++;	
					}
					return $data;
				}
				return false;
			}
		}
		
		function delete_category($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `category`  WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
		function get_jewellery_category_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT  `category_title`, `date`, `time` FROM `category` WHERE `id`= ? "))
			{ 
				
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($category_title,$date,$time);
				
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
					{
						
						$data = array();
						
						$data[0]	=	$var_edit_id;
						$data[1]	=	$category_title;
						$data[2]	=	$date;
						$data[3]	=	$time;
		
						return $data;
					}
				}
				return false;
			}
		}
		function update_jewellery_category_record($var_edit_id,$category_title)
		{  
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `category` SET `category_title`=?,`date`=?,`time`=? WHERE `id`=?"))
			{  
				$stmt->bind_param("sssi",$category_title,$date,$time,$var_edit_id);
				
				if($stmt->execute())
				{ 
					return true;
				}
				return false;
			}
		}
		/*************************************************************************************************/
		
		function delete_sub_category($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `jewellery_sub_category`  WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
		
		function get_jewellery_sub_category_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT  `sub_category_title`, `date`, `time` FROM `jewellery_sub_category` WHERE `id`= ? "))
			{ 
				
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($sub_category,$date,$time);
				
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
					{
						
						$data = array();
						
						$data[0]	=	$var_edit_id;
						$data[1]	=	$sub_category;
						$data[2]	=	$date;
						$data[3]	=	$time;
		
						return $data;
					}
				}
				return false;
			}
		}
		
		function update_jewellery_sub_category_record($id,$sub_category)
		{  
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `jewellery_sub_category` SET `sub_category_title`=?,`date`=?,`time`=? WHERE `id`=?"))
			{  
				$stmt->bind_param("sssi",$sub_category,$date,$time,$id);
				
				if($stmt->execute())
				{ 
					return true;
				}
				return false;
			}
		}
		/**************product***************************************/
		
		function get_id_from_product_name($product_name)

		{
			;
			if($stmt = $this->con->prepare("SELECT `id` FROM `add_product` WHERE `product_name`=?" ))
			{
				
				$stmt->bind_param("s",$product_name);
				
				
				$stmt->bind_result($output_id);
				
				
				if($stmt->execute())
				{
					
					if($stmt->fetch())
					{
						
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function save_product($category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `add_product`(`category_id`, `sub_category_id`, `product_code`, `product_name`, `price`, `max_price`, `discount_off`, `description`, `date`, `time`)VALUES (?,?,?,?,?,?,?,?,?,?)"))
			{
				
				$stmt->bind_param("ssssssssss",$category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description,$date,$time);
				 
				if($stmt->execute())
				{
					return $stmt->insert_id;
				}
				else
				{
					return false;
				}
			}
		}
		/*****************for select category id*************/
		function get_category_from_id($category_id	)
		{
			if($stmt = $this->con->prepare("SELECT  `category_title`` FROM `category` WHERE `id`=? "))
			{ 
				$stmt->bind_param("i", $category_id);
				
				$stmt->bind_result($category_title);
				
				
				if($stmt->execute())
				{  
					$data = array();
					$row =0;
					if($stmt->fetch())
					{
			
						$data = array();
						
						$data[$row][0]	=	$category_id;
						$data[$row][1]	=	$category_title;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		/*************************************/
		function get_multiple_rows_of_product()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_id`, `sub_category_id`, `product_code`, `product_name`, `price`, `max_price`, `discount_off`, `description`, `date`, `time` FROM `add_product`"))
			{
			
                $stmt->bind_result($id, $category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category_id;
						$data[$row][2]	=	$sub_category_id;
						$data[$row][3]	=	$product_code;
						$data[$row][4]	=	$product_name;
						$data[$row][5]	=	$price;
						$data[$row][6]	=	$max_price;
						$data[$row][7]	=	$discount_off;
						$data[$row][8]	=	$description;
						$data[$row][9]	=	$date;
						$data[$row][10]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function delete_product_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `add_product` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			
			function update_product_record($var_edit_id,$category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description)
		{  
		
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `add_product` SET `category_id`=?,`sub_category_id`=?,`product_code`=?,`product_name`=?,`price`=?,`max_price`=?,`discount_off`=?,`description`=?,`date`=?,`time`=? WHERE `id`=?"))
			{  
				$stmt->bind_param("ssssssssssi",$category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description,$date,$time,$var_edit_id);
				
				if($stmt->execute())
				{  
					return true;
				}
				return false;
			}
		}
		
		function get_product_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `category_id`, `sub_category_id`, `product_code`, `product_name`, `price`, `max_price`, `discount_off`, `description`, `date`, `time` FROM `add_product` WHERE `id`= ? "))
			{  
				
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($category_id,$sub_category_id,$product_code,$product_name,$price,$max_price,$discount_off,$description,$date,$time);
				
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$var_edit_id;
						$data[1]	=	$category_id;
						$data[2]	=	$sub_category_id;
						$data[3]	=	$product_code;
						$data[4]	=	$product_name;
						$data[5]	=	$price;
						$data[6]	=	$max_price;
						$data[7]	=	$discount_off;
						$data[8]	=	$description;
						$data[9]	=	$date;
						$data[10]	=	$time;
		
						return $data;
					}
				}
				return false;
			}
		}
		/************************product image******************/
		
		function save_product_image($var_title_id ,$attachment1)
		{
			
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("INSERT INTO `product_images`( `product_id`, `image_name`, `date`, `time`) VALUES (?,?,?,?)"))
			{
				
				$stmt->bind_param("ssss", $var_title_id,$attachment1,$date,$time);
				 
				if($stmt->execute())
				{
					return true;
				}
				else
				{
					echo $stmt->error;
				}
			}
		}
		function get_id_from_product($var_title_id)

		{
			;
			if($stmt = $this->con->prepare("SELECT `id` FROM `add_product` WHERE `product_name`=?" ))
			{
				
				$stmt->bind_param("s",$var_title_id);
				
				
				$stmt->bind_result($output_id);
				
				
				if($stmt->execute())
				{
					
					if($stmt->fetch())
					{
						
						return $output_id;
					}
				}
				return false;
			}
		}
		function get_image_name_from_id($id)
		{
			if($stmt = $this->con->prepare("SELECT `image_name` FROM `product_images`  WHERE `product_id`=?" ))
			{ 
				$stmt->bind_param("i",$id);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{  
					
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
			}	return false;
		}
		
		function get_multiple_rows_of_product_images($var_image_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`,`image_name`, `date`, `time` FROM `product_images` WHERE `product_id`=?"))
			{	
				$stmt->bind_param("i",$var_image_id);
                $stmt->bind_result($var_image_id,$image_name,$date,$time);
				
				if($stmt->execute())
				{
					
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
						$data[$row][0]	=	$var_image_id;
						$data[$row][1]	=	$image_name;
						$data[$row][2]	=	$date;
						$data[$row][3]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		function delete_product_image($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `product_images` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_product_name_from_id($var_image_id)
		{
			if($stmt = $this->con->prepare("SELECT `product_name` FROM `add_product` WHERE `id`=?" ))
			{ 
				$stmt->bind_param("i",$var_image_id);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
			}	return false;
		}
		/**********************API**************************************************************/
		function get_product_list($category_id,$sub_category_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category_id`, `sub_category_id`, `product_code`, `product_name`, `price`, `max_price`, `discount_off`, `description`, `date`, `time` FROM `add_product` WHERE `category_id`=? AND `sub_category_id`=?"))
			{  
				$stmt->bind_param("ss",$category_id,$sub_category_id);
				$stmt->bind_result($id, $res_category_id ,$res_sub_category_id , $product_code ,$product_name ,$price ,$max_price ,$discount_off ,$description ,$date,$time);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row]['id']				=	$id;
						$data[$row]['category_id']		=	$res_category_id;
						$data[$row]['sub_category_id']	=	$res_sub_category_id;
						$data[$row]['product_code']		=	$product_code;
						$data[$row]['product_name']		=	$product_name;
						$data[$row]['price']			=	$price;
						$data[$row]['max_price']		=	$max_price;
						$data[$row]['discount_off']		=	$discount_off;
						$data[$row]['description']		=	$description;
						$data[$row]['date']				=	$date;
						$data[$row]['time']				=	$time;
						$row++;
					}
					return $data;
					
				}
				return false;
			}
		}
		function get_category_list()
		{
			if($stmt = $this->con->prepare("SELECT `id`,`category_title` FROM `category`"))
			{				
				$stmt->bind_result($category_id,$category_title);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row]['id']				=	$category_id;
						$data[$row]['category_id']		=	$category_title;
						$row++;
					}
					return $data;
					
				}
				return false;
			}
		}
		function get_category_name_from_category_id($category_id)
		{
			if($stmt = $this->con->prepare("SELECT `category_title` FROM `category` where `id`=$category_id"))
			{				
				$stmt->bind_result($category_title);
				
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $category_title;
					}
				}
				return false;
			}
		}
		function get_sub_category_list($category_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`,`sub_category_title`FROM `jewellery_sub_category` WHERE `category_id`=?"))
			{  
				$stmt->bind_param("s",$category_id);
				$stmt->bind_result($res_category_id,$res_sub_category_title);
				
				if($stmt->execute())
				{
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row]['sub_category_id']	=	$res_category_id;
						$data[$row]['sub_category_name']	=	$res_sub_category_title;
						$row++;
					}
					
					return $data;
				}
				return false;
			}
		}
		/*********************user ordders******************************************************/
		function get_id_from_mobile_name($mobile_number)
		{
			if($stmt = $this->con->prepare("SELECT `id` FROM `user_orders` WHERE `user_contact_no`=?"))
			{  
				$stmt->bind_param("s",$mobile_number);
				
				$stmt->bind_result($output_id);
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
					{
						
						return $output_id;
					}
				}
				return false;
			}
		}
		function save_user_order($mobile_number,$order_id)
		{ 
		   
			$order_status  = "Pending";
			$date 			= date("Y-m-d");
			$time		    = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `user_orders`(`user_contact_no`, `order_id`, `date`, `time`, `order_status`) VALUES (?,?,?,?,?)"))
			{
				
				$stmt->bind_param("sssss",$mobile_number,$order_id,$date,$time,$order_status);
			 if($stmt->execute())
				{ 
					
					return true;
				}
			else
				{
					
					echo $stmt->error;
				}
			}
		}
		
			function get_all_user_order_details()
			{
				if($stmt_insert = $this->con->prepare("SELECT `id`, `user_contact_no`, `order_id`, `date`, `time`, `order_status` FROM `user_orders`"))
				{	
					$stmt_insert->bind_result($id,$user_contact_no,$order_id,$date,$time,$order_status);
					
					if($stmt_insert->execute())
					{
							$row	=	0;
							$data	=	array();
						while($stmt_insert->fetch())
						{
							$data[$row][0]	=	$id;
							$data[$row][1]	=	$user_contact_no;
							$data[$row][2]	=	$order_id;
							$data[$row][3]	=	$date;
							$data[$row][4]	=	$time;
							$data[$row][5]	=	$order_status;
							$row++;
						}
						if(!empty($data))	
						{
							return $data;
						}
						return false;
					}	
				}
			}
			
			function delete_user_order_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `user_orders` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			function get_all_pending_order_details()
			{
				if($stmt_insert = $this->con->prepare("SELECT `id`, `user_contact_no`, `order_id`, `date`, `time`, `order_status` FROM `user_orders` WHERE  `order_status`= 'pending'"))
				{	
					$stmt_insert->bind_result($id,$user_contact_no,$order_id,$date,$time,$order_status);
					
					if($stmt_insert->execute())
					{
							$row	=	0;
							$data	=	array();
						while($stmt_insert->fetch())
						{
							$data[$row][0]	=	$id;
							$data[$row][1]	=	$user_contact_no;
							$data[$row][2]	=	$order_id;
							$data[$row][3]	=	$date;
							$data[$row][4]	=	$time;
							$data[$row][5]	=	$order_status;
							$row++;
						}
						if(!empty($data))	
						{
							return $data;
						}
						return false;
					}	
				}
			}
			function get_all_dispatched_order_details()
			{
				if($stmt_insert = $this->con->prepare("SELECT `id`, `user_contact_no`, `order_id`, `date`, `time`, `order_status` FROM `user_orders` WHERE  `order_status`= 'dispatched'"))
				{	
					$stmt_insert->bind_result($id,$user_contact_no,$order_id,$date,$time,$order_status);
					
					if($stmt_insert->execute())
					{
							$row	=	0;
							$data	=	array();
						while($stmt_insert->fetch())
						{
							$data[$row][0]	=	$id;
							$data[$row][1]	=	$user_contact_no;
							$data[$row][2]	=	$order_id;
							$data[$row][3]	=	$date;
							$data[$row][4]	=	$time;
							$data[$row][5]	=	$order_status;
							$row++;
						}
						if(!empty($data))	
						{
							return $data;
						}
						return false;
					}	
				}
			}
			function update_pending_order_to_dispatched($var_status_id)
			{
				if($stmt= $this->con->prepare("UPDATE `user_orders` SET `order_status`='dispatched' WHERE `id`=?"))
				{	
					$stmt->bind_param("i",$var_status_id);
					
					if($stmt->execute())
					{
						return true;
					}
					return false;					
				}
			}
			function update_dispatched_order_to_pending($var_status_id)
			{
				if($stmt= $this->con->prepare("UPDATE `user_orders` SET `order_status`='pending' WHERE `id`=?"))
				{	
					$stmt->bind_param("i",$var_status_id);
					
					if($stmt->execute())
					{
						
						return true;
					}
					return false;					
				}
			}
			
			function update_status_to_published($status_pb_id,$status)
			{
				if($stmt= $this->con->prepare("UPDATE `add_post` SET `status`=? WHERE `id`=?"))
				{	
					$stmt->bind_param("si",$status,$status_pb_id);
					
					if($stmt->execute())
					{
						return true;
					}
					return false;					
				}
			}
			
			function update_text_color_of_post($tid,$title_color)
			{
				if($stmt= $this->con->prepare("UPDATE `add_post` SET `title_color`=? WHERE `id`=?"))
				{	
					$stmt->bind_param("si",$title_color,$tid);
					
					if($stmt->execute())
					{
						return true;
					}
					return false;					
				}
			}
		
		function get_all_dispatched_orders($var_status_id)
			{
				if($stmt= $this->con->prepare("SELECT `id`, `user_contact_no`, `order_id`, `date`, `time`, `order_status` FROM `user_orders` WHERE  `order_status`= 'dispatched'"))
				{	
					$stmt->bind_result($var_status_id,$user_contact_no,$order_id,$date,$time,$order_status);
					
					if($stmt->execute())
					{
						
							$row	=	0;
							$data	=	array();
						while($stmt->fetch())
						{
							
							$data[$row][0]	=	$var_status_id;
							$data[$row][1]	=	$user_contact_no;
							$data[$row][2]	=	$order_id;
							$data[$row][3]	=	$date;
							$data[$row][4]	=	$time;
							$data[$row][5]	=	$order_status;
							$row++;
						}
						return $data;
					}
					return false;
						
				}
			}
			/******************************* ADD POST***********************************************/
			/*function get_id_from_post_title($title)
		{
		
			if($stmt = $this->con->prepare("SELECT `id` FROM `add-post` WHERE `title`=?" ))
			{
				echo 1;
				$stmt->bind_param("s",$title);
				$stmt->bind_result($output_id);
				if($stmt->execute())
				{
					echo 2;
					if($stmt->fetch())
					{
						echo 3;
						
						return $output_id;
					}
				}
				return false;
			}
		}*/
		
		function save_post($category,$title)
		{
			$status	=	"0";
			$date = date("Y-m-d");
			$time = date("h:i:s t");
			$visits	=	0;
			$title_color = 'black';
			
			if($stmt = $this->con->prepare("INSERT INTO `add_post`(`category`, `title`, `post_visits`, `date`, `time`,`status`,`title_color`,`post_unique_visits`) VALUES (?,?,?,?,?,?,?,?)"))
			{
				$stmt->bind_param("ssssssss",$category,$title,$visits,$date,$time,$status,$title_color,$visits);
				 
				if($stmt->execute())
				{					
					return true;
				}
				else
				{
					return $stmt->error;
				}
			}
		}
		
		function update_news_post_title($var_edit_id,$category,$title)
		{
			$status	=	"0";
			$date = date("Y-m-d");
			$time = date("h:i:s t");
			$visits	=	0;
			if($stmt = $this->con->prepare("UPDATE `add_post` SET `category`=?,`title`=? WHERE `id`=?"))
			{
				$stmt->bind_param("ssi",$category,$title,$var_edit_id);
				 
				if($stmt->execute())
				{					
					return true;
				}
				else
				{
					return $stmt->error;
				}
			}
		}
		
		function save_sub_category_name($category,$title)
		{ 
			$date = date("Y-m-d");
			$time = date("h:i:s t");
			$visits	=	0;
			if($stmt = $this->con->prepare("INSERT INTO `sub_category`(`category`, `title`, `post_visits`, `date`, `time`) VALUES (?,?,?,?,?)"))
			{
				$stmt->bind_param("sssss",$category,$title,$visits,$date,$time);
				 
				if($stmt->execute())
				{					
					return true;
				}
				else
				{
					return $stmt->error;
				}
			}
		}
		
		function subscribe_newsletters($email_id)
		{ 
			$date = date("Y-m-d");
			$time = date("h:i:s a");
			$visits	=	0;
			if($stmt = $this->con->prepare("INSERT INTO `newsletter_email_subscriptions`(`email_id`, `date`, `time`) VALUES (?,?,?)"))
			{
				$stmt->bind_param("sss",$email_id,$date,$time);
				 
				if($stmt->execute())
				{					
					return true;
				}
				else
				{
					return $stmt->error;
				}
			}
		}
		
		function get_exist_email_subscription_id($email_id)
		{
		
			if($stmt = $this->con->prepare("SELECT `id` FROM `newsletter_email_subscriptions` WHERE `email_id`=?" ))
			{
				$stmt->bind_param("s",$email_id);
				$stmt->bind_result($output_id);
				if($stmt->execute())
				{
					if($stmt->fetch())
					{
						return $output_id;
					}
				}
				return false;
			}
		}
		
		function get_multiple_rows_of_post()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`,`status` FROM `add_post` ORDER BY `id` DESC"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time,$status);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						$data[$row][6]	=	$status;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_post_author_name_from_post_id($post_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `post_contents` FROM `post_details` WHERE `post_id`=? AND `post_content_type_code_no`='20'"))
			{
				$stmt_select->bind_param("i",$post_id);
			
				$stmt_select->bind_result($result_contents);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_contents;
					}
				}
				return false;
			}
		}
		
		function get_multiple_rows_of_published_posts($page_first_result,$results_per_page)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`,`status` FROM `add_post` where `status`=1 ORDER BY `id` DESC LIMIT " . $page_first_result . ',' . $results_per_page))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time,$status);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						$data[$row][6]	=	$status;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_multiple_rows_of_published_posts_right_side()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`,`status` FROM `add_post` where `status`=1 ORDER BY `id` DESC LIMIT 15"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time,$status);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						$data[$row][6]	=	$status;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_multiple_rows_of_published_posts_by_sub_category_id($sub_category_id,$page_first_result,$results_per_page)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`,`status` FROM `add_post` where `status`=1 AND `category` IN ($sub_category_id) ORDER BY `id` DESC LIMIT " . $page_first_result . ',' . $results_per_page))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time,$status);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						$data[$row][6]	=	$status;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_multiple_rows_of_published_posts_by_custom_search($custom_value)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time`,`status` FROM `add_post` where `status`=1 AND `title` LIKE '%$custom_value%' ORDER BY `id` DESC"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time,$status);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						$data[$row][6]	=	$status;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_all_subcategory_from_category_id($category_id)
		{
			if($stmt = $this->con->prepare("SELECT `id` FROM `sub_category` where `category`='$category_id'"))
			{			
                $stmt->bind_result($r_id);
				
				if($stmt->execute())
				{
					$subcat_id_nos	=	"";
					while($stmt->fetch())
					{
						if($subcat_id_nos=="")
						{
							$subcat_id_nos	=	"'".$r_id."'";
						}
						else{
							$subcat_id_nos	=	$subcat_id_nos.",'".$r_id."'";
						}
					}
					return $subcat_id_nos;
				}
				return false;
			}
		}
		
		function get_all_subcategory_report_data()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time` FROM `sub_category` ORDER BY `id` DESC"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_all_subcategory_report_data_from_cat_id($cat_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time` FROM `sub_category` where `category`=$cat_id ORDER BY `id` DESC"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}

		function get_recent_posts_data()
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `post_visits`, `date`, `time` FROM `add_post` ORDER BY `id` DESC LIMIT 10"))
			{			
                $stmt->bind_result($id, $category,$title,$post_visits,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$post_visits;
						$data[$row][4]	=	$date;
						$data[$row][5]	=	$time;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}

		function get_all_contents_of_blog_post($blog_post_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `post_id`, `post_content_type_code_no`, `post_contents`, `insertion_date`, `insertion_time`, `last_updated_date`, `last_updated_time`,`another_description` FROM `post_details` WHERE `post_id`=? ORDER BY `post_content_type_code_no` ASC"))
			{			
				$stmt->bind_param("s",$blog_post_id);

                $stmt->bind_result($res_id, $res_post_id,$res_post_content_type_code_no,$res_post_contents,$res_insertion_date,$res_insertion_time,$res_last_updated_date,$res_last_updated_time,$another_description);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$res_id;
						$data[$row][1]	=	$res_post_id;
						$data[$row][2]	=	$res_post_content_type_code_no;
						$data[$row][3]	=	$res_post_contents;
						$data[$row][4]	=	$res_insertion_date;
						$data[$row][5]	=	$res_insertion_time;
						$data[$row][6]	=	$res_last_updated_date;
						$data[$row][7]	=	$res_last_updated_time;
						$data[$row][8]	=	$another_description;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_all_contents_of_blog_post_for_admin_view($blog_post_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `post_id`, `post_content_type_code_no`, `post_contents`, `insertion_date`, `insertion_time`, `last_updated_date`, `last_updated_time`,`another_description` FROM `post_details` WHERE `post_id`=?"))
			{			
				$stmt->bind_param("s",$blog_post_id);

                $stmt->bind_result($res_id, $res_post_id,$res_post_content_type_code_no,$res_post_contents,$res_insertion_date,$res_insertion_time,$res_last_updated_date,$res_last_updated_time,$another_description);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$res_id;
						$data[$row][1]	=	$res_post_id;
						$data[$row][2]	=	$res_post_content_type_code_no;
						$data[$row][3]	=	$res_post_contents;
						$data[$row][4]	=	$res_insertion_date;
						$data[$row][5]	=	$res_insertion_time;
						$data[$row][6]	=	$res_last_updated_date;
						$data[$row][7]	=	$res_last_updated_time;
						$data[$row][8]	=	$another_description;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}

		function get_all_contents_of_blog_post_for_creating_post_file($blog_post_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `post_id`, `post_content_type_code_no`, `post_contents`, `insertion_date`, `insertion_time`, `last_updated_date`, `last_updated_time`,`another_description` FROM `post_details` WHERE `post_id`=?"))
			{			
				$stmt->bind_param("s",$blog_post_id);

                $stmt->bind_result($res_id, $res_post_id,$res_post_content_type_code_no,$res_post_contents,$res_insertion_date,$res_insertion_time,$res_last_updated_date,$res_last_updated_time,$another_description);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$res_id;
						$data[$row][1]	=	$res_post_id;
						$data[$row][2]	=	$res_post_content_type_code_no;
						$data[$row][3]	=	$res_post_contents;
						$data[$row][4]	=	$res_insertion_date;
						$data[$row][5]	=	$res_insertion_time;
						$data[$row][6]	=	$res_last_updated_date;
						$data[$row][7]	=	$res_last_updated_time;
						$data[$row][8]	=	$another_description;
						
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_blog_posts_by_category_id($cat_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `description`, `link`, `image`, `date`, `time` FROM `add_post` where `category`=?"))
			{
				$stmt->bind_param("s",$cat_id);
				
                $stmt->bind_result($id, $category,$title,$description,$link,$image,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$description;
						$data[$row][4]	=	$link;
						$data[$row][5]	=	$image;
						$data[$row][6]	=	$date;
						$data[$row][7]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function get_blog_posts_by_post_id($post_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `category`, `title`, `description`, `link`, `image`, `date`, `time` FROM `add_post` where `id`=?"))
			{
				$stmt->bind_param("i",$post_id);
				
                $stmt->bind_result($id, $category,$title,$description,$link,$image,$date,$time);
				
				if($stmt->execute())
				{
			
					$data	=	array();
					$row	=	0;
					//while loop for fetching multiple records
					while($stmt->fetch())
					{
                        $data[$row][0]	=	$id;
						$data[$row][1]	=	$category;
						$data[$row][2]	=	$title;
						$data[$row][3]	=	$description;
						$data[$row][4]	=	$link;
						$data[$row][5]	=	$image;
						$data[$row][6]	=	$date;
						$data[$row][7]	=	$time;
						$row++;
					}
					return $data;
				}
				return false;
			}
		}
		
		function delete_post_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `add_post` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);
					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}

			function delete_blog_post_contents_record($delete_id)
			{
				if($stmt= $this->con->prepare("DELETE FROM `post_details` WHERE `id`=?"))
				 {
					$stmt->bind_param("i",$delete_id);

					if($stmt->execute())
					{
						return true;
					}
				}
				else
				{
				return false;
				}
			}
			
			function update_post_record($var_edit_id,$category,$title,$description,$link)
		{  
		
			$date = date("Y-m-d");
			$time = date("H:i:s t");
				if($stmt = $this->con->prepare("UPDATE `add_post` SET `category`=?,`title`=?,`description`=?,`link`=?,`date`=?,`time`=?  WHERE `id`=?"))
			{  
				$stmt->bind_param("ssssssi",$category,$title,$description,$link,$date,$time,$var_edit_id);
				
				if($stmt->execute())
				{  
					return true;
				}
				return false;
			}
		}
		
		function get_post_record_from_id($var_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`,`category`, `title`, `description`, `link`, `image`, `date`, `time` FROM `add_post` WHERE `id`= ? "))
			{  
				
				$stmt->bind_param("i", $var_edit_id);
				
				$stmt->bind_result($id,$category,$title,$description,$link,$image,$date,$time);
				
				
				if($stmt->execute())
				{ 
					
					if($stmt->fetch())
					{
						$data = array();
						
						$data[0]	=	$id;
						$data[1]	=	$category;
						$data[2]	=	$title;
						$data[3]	=	$description;
						$data[4]	=	$link;
						$data[5]	=	$image;
						$data[6]	=	$date;
						$data[7]	=	$time;
						return $data;
					}
				}
				return false;
			}
		}
		
		function  update_post_image($id, $file_name)
		{
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			
			if($stmt = $this->con->prepare("UPDATE `add_post` SET `image`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt->bind_param("sssi",$file_name,$date,$time,$id);
				
				if($stmt->execute())
				{
					return true;
				}
				return false;
			}
		}
		//7-6-21
		
		function get_unique_counter_value($todays_date)
		{
			if($stmt_select = $this->con->prepare("SELECT  `unique_counter`  FROM `visitors` WHERE `date`=? "))
			{	
				$stmt_select->bind_param("s",$todays_date);
				$stmt_select->bind_result($result);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result;
					}
				}
						return false;
			}
		}
		
		function get_total_website_visitors()
		{
			if($stmt_select = $this->con->prepare("SELECT  SUM(`daily_visit_counter`)  FROM `visitors`"))
			{
				$stmt_select->bind_result($result);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result;
					}
				}
						return false;
			}
		}
		
		function get_page_unique_counter_value($post_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `post_unique_visits` FROM `add_post` WHERE `id`=?"))
			{	
				$stmt_select->bind_param("i",$post_id);
				
				$stmt_select->bind_result($result);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result;
					}
				}
				return false;
			}
		}
		
		function get_date_from_post_id($post_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `date` FROM `add_post` WHERE `id`=?"))
			{	
				$stmt_select->bind_param("i",$post_id);
				
				$stmt_select->bind_result($result_date);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_date;
					}
				}
				return false;
			}
		}
		
		function insert_visit_counter_value($counter_val,$daily_count_val)
		{ 
			$date = date("Y-m-d");
			$time = date("H:i:s t");
			if($stmt = $this->con->prepare("INSERT INTO `visitors`( `unique_counter`, `date`, `time`,`daily_visit_counter` ) VALUES  (?,?,?,?)"))
			{
				$stmt->bind_param("issi",$counter_val,$date,$time,$daily_count_val);
				 
				if($stmt->execute())
				{
					
					return true;
				}
				else
				{
					return $stmt->error;
				}
			}
		}
		
		function update_unique_visitor($counter_val,$todays_date)
		{	
			if($stmt_insert = $this->con->prepare("UPDATE `visitors` SET `unique_counter`=?  WHERE `date`=? "))
			{
				$stmt_insert->bind_param("ss",$counter_val,$todays_date);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function update_page_unique_visitor($counter_val,$blog_post_id)
		{	
			if($stmt_insert = $this->con->prepare("UPDATE `add_post` SET `post_unique_visits`=?  WHERE `id`=? "))
			{
				$stmt_insert->bind_param("ss",$counter_val,$blog_post_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		//
		function get_daily_counter_val($todays_date)
		{
			if($stmt_select = $this->con->prepare("SELECT  `daily_visit_counter`  FROM `visitors` WHERE `date`=? "))
			{
				$stmt_select->bind_param("s",$todays_date);
				$stmt_select->bind_result($result);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result;
					}
				}
						return false;
			}
		}
		
		function get_daily_page_counter_val($blog_post_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `post_visits` FROM `add_post` WHERE `id`=? "))
			{
				$stmt_select->bind_param("i",$blog_post_id);
				
				$stmt_select->bind_result($result);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result;
					}
				}
						return false;
			}
		}
		
		function update_daily_visitor_count($counter_val,$todays_date)
		{	
			if($stmt_insert = $this->con->prepare("UPDATE `visitors` SET `daily_visit_counter`=?  WHERE `date`=? "))
			{
				$stmt_insert->bind_param("ss",$counter_val,$todays_date);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function update_daily_page_visitor_count($counter_val,$blog_post_id)
		{	
			if($stmt_insert = $this->con->prepare("UPDATE `add_post` SET `post_visits`=?  WHERE `id`=? "))
			{
				$stmt_insert->bind_param("ss",$counter_val,$blog_post_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function get_visitors_count_all()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `unique_counter`, `daily_visit_counter`, `date`  FROM `visitors`  ORDER BY `id` DESC"))
				{	
					$stmt_insert->bind_result($id,$unique_counter,$frequntly_counter,$date);
					
					if($stmt_insert->execute())
					{
							$counter	=	0;
							$details	=	array();
						while($stmt_insert->fetch())
						{
							$details[$counter][0]	=	$id;
							$details[$counter][1]	=	$unique_counter;
							$details[$counter][2]	=	$frequntly_counter;
							$details[$counter][3]	=	$date;
							
							$counter++;
						}
						if(!empty($details))	
						{
							return $details;
						}
						return false;
					}	
				}
		}
		 
		 
    }//END
?>

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4