]]jkjjgdjffksdkdxmnvbcbcvbvcbbbbbbbbbvcbcbvcbmnmbnwqeqwewqskfgj
במ12[cvbnvbnvcvbcvbcvbvvvccccccccccccccvbcvbcvbnmnmqewv;'
/
home
/
u729855735
/
public_html
/
truckinsurance
/
Upload FileeE
HOME
<?php require('vendor/autoload.php'); $cname = $_POST['cname']; $address = $_POST['address']; $zip = $_POST['zip']; date_default_timezone_set('America/New_York'); $currentDateTimeUS = date("m/d/Y h:i A"); $user_email = $_POST['user_email']; $uid = $_POST['user_id']; if($_POST['optional_email']!=''){ $optional_email = $_POST['optional_email']; }else{ $optional_email=''; } $db_host = "localhost"; // Replace with your database hostname $db_user = "u729855735_bazwa"; // Replace with your database username $db_pass = "Kyptronix2023"; // Replace with your database password $db_name = "u729855735_bazwa"; // Replace with your database name // Connect to the database $conn = new mysqli($db_host, $db_user, $db_pass, $db_name); // Check for database connection errors if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $exist_cert = "SELECT * FROM users WHERE id='$uid'"; $run_cert = mysqli_query($conn, $exist_cert); $get_cert = mysqli_fetch_assoc($run_cert); // Update and retrieve the visitor count $check_count = "SELECT count FROM visitor_count"; $run_count = mysqli_query($conn,$check_count); $fetch_count = mysqli_fetch_assoc($run_count); if($fetch_count['count'] == 100){ $mod = "UPDATE visitor_count SET count = 0"; $mod_run = mysqli_query($conn,$mod); } $sql_update = "UPDATE visitor_count SET count = count + 1"; $sql_select = "SELECT count FROM visitor_count"; if ($conn->query($sql_update) === TRUE) { $result = $conn->query($sql_select); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $visitorCount = $row["count"]; } else { $visitorCount = 0; } } else { echo "Error: " . $conn->error; } $conn->close(); //certificate generate and download if(isset($_POST['download'])){ $html ='<img src="admin/media/'.$get_cert['certificate'].'">'; $html .= '<p style="position:absolute;top:3rem;left:35rem;"><b>EMPIRE-'.$visitorCount.'</b></p><p style="position:absolute;top:5.5rem;left:42.3rem;font-size:10px;font-weight:600">'.$currentDateTimeUS.'</p>'; $html .= '<div style="position:absolute;bottom:16rem;left:6rem;padding-left:5px;padding-right:5px;width:280px;height:70px"><p style="margin:0;font-family: sans-serif;font-size:12px">'.$cname.'</p><p style="margin:0;font-family: sans-serif;font-size:12px">'.$address.'</p><p style="margin:0;font-family: sans-serif;font-size:12px">'.$zip.'</p></div>'; $mpdf=new \Mpdf\Mpdf(); $mpdf->WriteHTML($html); $file='Certificate-bazwa/'.time().'.pdf'; $pdf = $mpdf->output($file,'I'); } //certificate send to mail else{ $html ='<img src="admin/media/'.$get_cert['certificate'].'">'; $html .= '<p style="position:absolute;top:3rem;left:35rem;"><b>EMPIRE-'.$visitorCount.'</b></p><p style="position:absolute;top:5.5rem;left:42.3rem;font-size:10px;font-weight:600">'.$currentDateTimeUS.'</p>'; $html .= '<div style="position:absolute;bottom:16rem;left:6rem;padding-left:5px;padding-right:5px;width:280px;height:70px"><p style="margin:0;font-family: sans-serif;font-size:12px">'.$cname.'</p><p style="margin:0;font-family: sans-serif;font-size:12px">'.$address.'</p><p style="margin:0;font-family: sans-serif;font-size:12px">'.$zip.'</p></div>'; $mpdf=new \Mpdf\Mpdf(); $mpdf->WriteHTML($html); $file='Certificate-bazwa/'.time().'.pdf'; //$pdf = $mpdf->output($file,'D'); $pdfData = $mpdf->Output('', \Mpdf\Output\Destination::STRING_RETURN); //D //I //F //S // Set up email parameters //$to = 'khlid.kyptronix@gmail.com'; $admin_email = 'advisorinsurance996@gmail.com'; $subject = 'Bajwa Empire Certificate'; $message = "Hi user,\n\nPlease find your attached certificate below.\n\nRegards,\nBajwa empire llc\nRamandeep Kaur\n(408)930-6894"; $from = 'advisorinsurance996@gmail.com'; // Create a boundary for the email $boundary = md5(uniqid()); // Headers $headers = "From: $from\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"; $headers .= "Cc: $optional_email\r\n"; // Add the CC recipient(s) here // Message Body $body = "--$boundary\r\n"; $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $body .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $body .= $message . "\r\n"; // Attach the PDF $body .= "--$boundary\r\n"; $body .= "Content-Type: application/pdf; name=\"$file\"\r\n"; $body .= "Content-Transfer-Encoding: base64\r\n"; $body .= "Content-Disposition: attachment; filename=\"$file\"\r\n\r\n"; $body .= chunk_split(base64_encode($pdfData)) . "\r\n"; // Send the email if (mail($user_email, $subject, $body, $headers)) { echo "<script>alert('Thanks! Certificate has been sent to your Email.');location.href='index.php'</script>"; } else { echo "<script>alert('Something went wrong! Try again');</script>"; } //send the email to admin $admin_msg = "Hello Admin,\n\nYour user has generated a certificate. Please find the certificate from below.\n\nRegards,\nBajwa Empire"; // Send the email to the user $headers = "From: $from\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"; $body = "--$boundary\r\n"; $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $body .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $body .= $admin_msg . "\r\n"; $body .= "--$boundary\r\n"; $body .= "Content-Type: application/pdf; name=\"$file\"\r\n"; $body .= "Content-Transfer-Encoding: base64\r\n"; $body .= "Content-Disposition: attachment; filename=\"$file\"\r\n\r\n"; $body .= chunk_split(base64_encode($pdfData)) . "\r\n"; mail($admin_email, $subject, $body, $headers); } ?>