<?php
include('../config.php');
include('../fungsi.php');

$grup = mysqli_real_escape_string($con,$_GET['url']);

$query = mysqli_query($con,"SELECT * FROM grup WHERE id='$grup'");
$check = mysqli_fetch_array($query,MYSQLI_NUM);
if (isset($check[0])) {
    $idgrup = $check[0];
	$namagrup =$check[1];
	$f1 =$check[11];
	$f2 =$check[12];
	$f3 =$check[13];
	$cap =$check[14];
	
	IF($check[20]==0){
        $action = $weburl.'subs.php';
    }elseIF($check[20]==1){
        $action = $weburl.'subs2.php';  
    }elseIF($check[20]==2){
        $action = $weburl.'subs.php';  
    }
}	

$pesan = 'Ada pengunjung yang membuka Landing Page Form Grup '.$grup.' via '.$media.' ';
mysqli_query($con,"insert into pesan1 values(NULL, '$pesan','8', '$nowtgl')");
$message_text = $pesan;
sendMessage($telegram_id, $message_text, $secret_token);
				
?>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Form - <?php echo $namagrup ?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="shortcut icon" href="../images/abt.png" />
	<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
	<link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
	<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
	<link rel="stylesheet" type="text/css" href="css/util.css">
	<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>

	<div class="contact1">
		<div class="container-contact1">
			<div class="contact1-pic js-tilt" data-tilt>
				<!--<img src="images/img-01.png" alt="IMG"> -->
				
				<?php
				$tempdir = "tempqr/"; 
                if (!file_exists($tempdir))
                    mkdir($tempdir);
        
                $data=mysqli_fetch_row(mysqli_query($con,"select * from akunn where id=1"));
                $logo = $data[18];
                
                

				$link = $weburl.'form/'.$grup;
				$isi_teks = $link;
                $logopath = '../'.$logo;
                //echo $link;
                $namafile = $idgrup.".png";
                
                qrcodelogo($isi_teks, $namafile,$tempdir,$logopath);
				
				echo '<figure> <!-- <img src="'.$weburl.'qrcode.php?view='.$link.'" width="100%"/> -->
				    <img src="'.$weburl.'form/tempqr/'.$namafile.'" width="100%"/> 
				    <figcaption><center>QRCode halaman Form Grup '.$grup.'</figcaption></center></figure>
				    ';
				?>
			</div>
			
			<form action="<?php echo $action ?>" method="post" class="contact1-form validate-form">
				<span class="contact1-form-title">
					<?php echo $f1 ?>
				</span>

				<div class="wrap-input1 validate-input" data-validate = "Name is required">
					<input class="input1" type="text" name="name" placeholder="Name" required>
					<span class="shadow-input1"></span>
				</div>

				<div class="wrap-input1 validate-input" data-validate = "Valid email is required: ex@abc.xyz">
					<input class="input1" type="email" name="email" placeholder="Email" required>
					<span class="shadow-input1"></span>
				</div>

				<div class="wrap-input1 validate-input" data-validate = "Subject is required">
					<input class="input1" type="number" name="hp" placeholder="081234567890" required>
					<input type="hidden" name="grup" value="<?php echo $grup ?>"/>
					<span class="shadow-input1"></span>
				</div>
                
                <?php
                IF($cap==1){
                    echo '<div class="input-group form-group">
    						<img src="../login/Captcha.php" alt="gambar" /> <br>
    						<input name="nilaiCaptcha" class="input1" value="" maxlength="6" placeholder="Ketik kode Captcha" required/>
    				</div> ';
                }	
                ?>
                
				<div class="container-contact1-form-btn">
					<button class="contact1-form-btn">
						<span>
							<?php echo $f3 ?>
							<i class="fa fa-long-arrow-right" aria-hidden="true"></i>
						</span>
					</button>
				</div>
				<?php echo $f2; 
				IF($media == 'HP Android'){
				    
    				echo '<figure> <!-- <img src="'.$weburl.'qrcode.php?view='.$link.'" width="100%"/> -->
    				    <img src="'.$weburl.'form/tempqr/'.$namafile.'" width="100%"/> 
    				    <figcaption><center>QRCode halaman Form Grup '.$grup.'</figcaption></center></figure>
    				    ';
				}
				?>
			</form>
		</div>
	</div>

	<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
	<script src="vendor/bootstrap/js/popper.js"></script>
	<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="vendor/select2/select2.min.js"></script>
	<script src="vendor/tilt/tilt.jquery.min.js"></script>
	<script >
		$('.js-tilt').tilt({
			scale: 1.1
		})
	</script>

	<script src="js/main.js"></script>

</body>
</html>
