Server IP : 103.53.40.154 / Your IP : 3.142.172.190 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 (0755) : /home2/ppcad7no/fozan.in/../agratourbus.com/../ntimachinery.com/conn/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php date_default_timezone_set('Asia/Kolkata'); global $created_at; $created_at=date('Y-m-d H:i:s'); function admin_base_url() { return sprintf( "%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'].'/webpanel/' //$_SERVER['REQUEST_URI'] ); } function base_url() { return sprintf( "%s://%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'].'/' //$_SERVER['REQUEST_URI'] ); } function insert_data($tblname,$form_data) { global $conn; $fields = array_keys($form_data); //print_r($form_data); $sql="INSERT INTO `".$tblname."`(`".implode("`,`", $fields)."`) VALUES('".implode("','", $form_data)."')"; $query= mysqli_query($conn,$sql) or mysqli_error($conn);; if($query){ return mysqli_insert_id($conn); }else{ return false; } } function check_data_exist($tablename,$condi) { global $conn; if(!empty($condi)) { foreach ($condi as $key => $value) { echo $cond="WHERE `".$key."`= '".$value."'"; } } //echo $sql="SELECT * FROM `$tablename` $cond AND `status`=1"; echo $sql="SELECT * FROM `$tablename` $cond"; $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); return $count=mysqli_num_rows($query); // if($count>0) // { // return true; // }else{ // return false; // } } function edit_data($tblname,$form_data,$field_id,$id) { global $conn; $sql = "UPDATE ".$tblname." SET "; $data = array(); foreach($form_data as $column=>$value){ $data[] =$column."="."'".$value."'"; } $sql .= implode(',',$data); if(is_int($id)==1){ $sql.=" WHERE ".$field_id." = ".$id.""; }else{ $sql.=' WHERE '.$field_id.'='."'".$id."'"; } $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); if($query) { return true; }else{ return false; } } function get_data($tablename,$condi=null,$operator=null,$limit=null) { global $conn; if(is_array($condi) && !empty($condi)) { foreach ($condi as $key => $value) { $cond[]="`".$key."`".$operator." '".$value."'"; } if(!empty($limit)) { $limits="LIMIT ".$limit; }else{ $limits=""; } //echo $sql="SELECT * FROM `$tablename` $cond AND `status`=1"; $sql="SELECT * FROM `$tablename` WHERE"; $sql .= implode('AND',$cond); $sql .= $limits; //$sql.=" "; $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); // $data=mysqli_fetch_assoc($query); //return $data; }else{ $sql="SELECT * FROM `$tablename`"; $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); } $all_data=array(); while($row=mysqli_fetch_assoc($query)) { $all_data[]=$row; } return $all_data; } function data_count($tablename,$condi=null,$operator=null) { global $conn; if(is_array($condi) && !empty($condi)) { foreach ($condi as $key => $value) { $cond[]="`".$key."`".$operator." '".$value."'"; } //echo $sql="SELECT * FROM `$tablename` $cond AND `status`=1"; $sql="SELECT * FROM `$tablename` WHERE"; $sql.=implode('AND',$cond); //$sql.=" "; $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); // $data=mysqli_fetch_assoc($query); //return $data; }else{ $sql="SELECT * FROM `$tablename`"; $query=mysqli_query($conn,$sql) or die(mysqli_error($conn)); } $all_data=mysqli_num_rows($query); // $all_data=array(); // while($row=mysqli_fetch_assoc($query)) // { // $all_data[]=$row; // } return $all_data; } class wine { function logo($conn,$table,$field) { $querylogo = "SELECT $field FROM `$table` WHERE status = 1 ORDER BY id DESC"; if($sql_selectlogo = $conn->query($querylogo)) { if($sql_selectlogo->num_rows>0) { $resultlogo = $sql_selectlogo->fetch_array(MYSQLI_ASSOC); return trim($resultlogo[$field]); } } } function getstatus($conn,$table) { $querystatus = "SELECT * FROM `$table` WHERE status = 1"; if($sql_selectstatus = $conn->query($querystatus)) { $num=$sql_selectstatus->num_rows; return $num; } } function getall($conn,$table) { $queryall = "SELECT * FROM `$table`"; if($sql_selectall = $conn->query($queryall)) { $numall=$sql_selectall->num_rows; return $numall; } } function getstatus1($conn,$table) { $querystatus1 = "SELECT * FROM `$table` WHERE status = 0"; if($sql_selectstatus1 = $conn->query($querystatus1)) { $num1=$sql_selectstatus1->num_rows; return $num1; } } function getInfo($conn,$table,$field,$id) { $queryinfo = "SELECT $field FROM `$table` WHERE id = '".$id."'"; if($sql_select = $conn->query($queryinfo)) { if($sql_select->num_rows>0) { $resultinfo = $sql_select->fetch_array(MYSQLI_ASSOC); return trim($resultinfo[$field]); } } } function getInfo2($conn,$table,$alias) { $queryinfo2 = "SELECT * FROM `$table` WHERE alias = '".$alias."'"; if($sql_select2 = $conn->query($queryinfo2)) { if($sql_select2->num_rows>0) { $resultinfo2 = $sql_select2->fetch_array(MYSQLI_ASSOC); return $resultinfo2; } } } function getdata($conn,$table,$field,$cond,$value) { $querydata = "SELECT $field FROM $table WHERE $cond = '".$value."' and status = '1'"; if($sql_selectdata = $conn->query($querydata)) { if($sql_selectdata->num_rows>0) { $resultdata = $sql_selectdata->fetch_array(MYSQLI_ASSOC); return trim($resultdata[$field]); } } } function getnewdata($conn,$table,$field,$cond,$value) { $query_data = "SELECT $field FROM $table WHERE $cond = '".$value."' "; if($sql_select_data = $conn->query($query_data)) { if($sql_select_data->num_rows>0) { $result_data = $sql_select_data->fetch_array(MYSQLI_ASSOC); return trim($result_data[$field]); } } } function getallrecord($conn,$table) { $queryrecord = "SELECT * FROM `$table` WHERE status=1 ORDER BY id DESC"; if($sql_selectrecord=$conn->query($queryrecord)) { if($sql_selectrecord->num_rows>0) { $resultrecord=$sql_selectrecord->fetch_array(MYSQLI_ASSOC); return $resultrecord; } } } function getnumrows($conn,$table) { $querynumrows = "SELECT * FROM `$table` WHERE status=1"; if($sql_selectnumrows = $conn->query($querynumrows)) { $num = $sql_selectnumrows->num_rows; return $num; } } function getallrecords($conn,$table) { $queryrecords = "SELECT * FROM `$table` WHERE status=1 ORDER BY id DESC"; if($sql_selectrecords=$conn->query($queryrecords)) { return $sql_selectrecords; } } function getlimit($conn,$table,$limit) { $querylimit = "SELECT * FROM $table WHERE status=1 ORDER BY id DESC $limit"; if($sql_selectlimit = $conn->query($querylimit)) { return $sql_selectlimit; } } function getconlimit($conn,$table,$cond,$limit) { $queryconlimit = "SELECT * FROM $table WHERE $cond AND status=1 ORDER BY id DESC $limit"; if($sql_selectconlimit = $conn->query($queryconlimit)) { return $sql_selectconlimit; } } function getconrecords($conn,$table,$cond) { $queryconrecords = "SELECT * FROM $table WHERE $cond ORDER BY id DESC"; if($sql_selectconrecords=$conn->query($queryconrecords)) { return $sql_selectconrecords; } } function getcolorrecords($conn,$table,$cond) { $querycolorrecords = "SELECT * FROM $table WHERE $cond GROUP BY id DESC"; if($sql_selectcolorrecords=$conn->query($querycolorrecords)) { return $sql_selectcolorrecords; } } function getconrecord($conn,$table,$cond) { $queryconrecord = "SELECT * FROM $table WHERE $cond AND status=1 ORDER BY id DESC"; if($sql_selectconrecord=$conn->query($queryconrecord)) { if($sql_selectconrecord->num_rows>0) { $resultconrecord = $sql_selectconrecord->fetch_array(MYSQLI_ASSOC); return $resultconrecord; } } } function getconimage($conn,$table,$field,$cond) { $queryconrecord = "SELECT $field FROM $table WHERE $cond ORDER BY id DESC"; if($sql_selectconrecord=$conn->query($queryconrecord)) { if($sql_selectconrecord->num_rows>0) { $resultconrecord = $sql_selectconrecord->fetch_array(MYSQLI_ASSOC); return trim($resultconrecord[$field]); } } } function gettotalitem($conn,$session_id) { $queryitem="SELECT * FROM cart WHERE session_id='$session_id' && status=1"; if($sql_selectitem=$conn->query($queryitem)) { $num=$sql_selectitem->num_rows; return $num; } } } $newobject = new wine(); ?> <?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 } ?>