MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.129.69.134
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/thedigitaldubai.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/thedigitaldubai.com/function.php
<?php

function header_tags($page_name)
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from cms_menu where page_url='$page_name' and status=1"));
    return $query;
}

function product_tags($slug)
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from cat_prod where ct_pd_url='$slug' and status=1"));
    return $query;
}

function product_facility($slug)
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_facility where ct_pd_url='$slug' and status=1"));
    return $query;
}

function contact_det()
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_contact"));
	return $query;
}


function blog_det($id)
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from tbl_blog where id='$id'"));
	return $query;
}

function user_det()
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from users where status=1"));
	return $query;
}

function logo_det()
{
	global $conn;
	$query=mysqli_fetch_array(mysqli_query($conn,"select * from logo"));
	return $query;
}

function prepStr($data)
{
	global $conn;
	$rec=mysqli_real_escape_string($conn,$data);
	return $rec;

}

function insert_contact($tbl_name,$rec)
{
	global $conn;

	$query=mysqli_query($conn,'insert into '.$tbl_name.'
		                                                SET name="'.$rec['name'].'",
			                                                email="'.$rec['email'].'",
			                                                phone_number="'.$rec['phone_number'].'",
			                                                subject="'.$rec['subject'].'",
			                                                message="'.$rec['message'].'"
		                                                       ');
	if($query)
	{
		return true;
	}
	return false;

}

function insert_contact_details($tbl_name,$rec)
{
	global $conn;

	$query=mysqli_query($conn,'insert into '.$tbl_name.'
		                                                SET name="'.$rec['name'].'",
			                                                email="'.$rec['email'].'",
			                                                phone="'.$rec['phone'].'",
			                                                subject="'.$rec['subject'].'",
			                                                message="'.$rec['message'].'"
		                                                       ');
	if($query)
	{
		return true;
	}
	return false;

}



function select_data_fetch($tbl_name,$cond)
{
	global $conn;
    $res='';
    foreach ($cond as $key => $value) {

		$res.=$key.'='."'$value'";
	}


	$query=mysqli_fetch_array(mysqli_query($conn,'select * from '.$tbl_name.' where '.$res.''));

	if($query)
	{
		return $query;
	}

	return false;


}

function totl($q,$p)
{
	$totl=$q * $p;
	return 'Rs.'.number_format($totl);
}

function total_sum()
{
    global $conn;
	$total_sum=mysqli_fetch_array(mysqli_query($conn,"select sum(p.cat_pd_sale_price * tc.prod_quant) as total_sum from cat_prod as p RIGHT JOIN tbl_cart as tc ON p.id=tc.prod_id where tc.user_id='".$_SESSION['login_id']."' and tc.cart_status='0'"));

	return 'Rs.'.number_format($total_sum['total_sum']);
}

function total_sum_count()
{
    global $conn;
	$total_sum=mysqli_fetch_array(mysqli_query($conn,"select sum(p.cat_pd_sale_price * tc.prod_quant) as total_sum from cat_prod as p RIGHT JOIN tbl_cart as tc ON p.id=tc.prod_id where tc.user_id='".$_SESSION['login_id']."' and tc.cart_status='0'"));

	return $total_sum['total_sum'];
}

function select_data($tbl_name,$cond)
{

	global $conn;
    $res='';
	foreach ($cond as $key => $value) {
		$res.=$key.'='."'$value'";
	}

	$query=mysqli_query($conn,'select * from '.$tbl_name.' where '.$res.'');

	if($query)
	{
		return $query;
	}

	return false;


}


function total_rec($tbl_name,$cond)
{
	global $conn;
	$res='';

	foreach ($cond as $key => $value) {
		$res.=$key.'='."'$value'";
	}

	$query=mysqli_query($conn,'select * from '.$tbl_name.' where '.$res.'');
	$totl=mysqli_num_rows($query);
	
	if($query)
	{
		return $totl;
	}

	return false;

}

function update_password($tbl_name,$cond)
{
	global $conn;
	$query=mysqli_query($conn,'update '.$tbl_name.'
		                       set password="'.$cond['password'].'" where email="'.$cond['email'].'"');
	if($query)
	{
		return true;
	}

	return false;
}


function randomPassword() 
{
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 8; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}


?>

MMCT - 2023