<?php
/**
 * Project:        M.VuiZ.Net
 * Author:         nampt.me <admin@vuiz.net>
 * Copyright:      © 2025 vuiz.net All rights reserved.
 */

set_time_limit(0);
if(isset($_POST['domain'])){
	error_reporting(0);
	$domain = isset($_POST['domain'])?htmlentities($_POST['domain']):'';
	$data = getcontent('http://wapupload.tk/cloudflare.php?domain='.Domain($domain));
	echo $data;
}
else{
	$key = 'Kiểm tra IP Site Dùng DNS CloudFlare';
	$mkey = 'Lấy ip website dùng cloudflare,check ip cloudflare, check cloudflare, crimeflare, find real ip website, find real ip cloudflare, show real ip cloudflare, crimeflare, check ip website, bypass cloudflare website';
	require '../template/header.php';
?>
	<div class="col-right-xs">
		<div class="mainblok">
			<div class="phdr">
					<div vocab="https://schema.org/" typeof="BreadcrumbList">
						<span property="itemListElement" typeof="ListItem">
							<a href="/"  property="item" typeof="WebPage">
								<i class="fa fa-home"></i> <span property="name">Home</span>
							</a>
							<meta property="position" content="1">
						</span>
						<i class="fa fa-angle-right"></i>
						<span property="itemListElement" typeof="ListItem">
							<a href="/tools/"  property="item" typeof="WebPage">
								<i class="fa fa-wrench"></i> <span property="name">Công cụ</span>
							</a>
							<meta property="position" content="2">
						</span>
						<i class="fa fa-angle-right"></i>
						<span property="itemListElement" typeof="ListItem">
							<span property="name">Kiểm tra ip CloudFlare</span>
							<meta property="position" content="3">
						</span>
					</div>
			</div>
			<div class="menu">Công cụ giúp Tìm IP thật của website sử dụng dịch vụ DNS của Cloudflare để ẩn IP. Lấy IP thật của Website dùng CloudFlare.</div>
			<div class="menu">
				<form id="form" method="post" onSubmit="return false;">
					Domain: <input type="text" style="width: 50%;" placeholder="Nhập tên miền, VD:phimmoi.net" name="domain" id="domain" /> <input value="Whois" class="btn btn-warning" type="submit" id="submit" name="submit" /> <input type="reset" class="btn btn-primary" value="Reset" id="reset" name="reset"/>
				</form>
			</div>
			<div id="checkipcloudflare">
			</div>
		</div>
	</div>
	<div class="col-left-xs">
<?php require './toolslist.php'; ?>
	</div>
	<div class="clear"></div>

<script>
	$(document).ready(function(){
		$("#submit").click(function(){
			$("#submit").addClass('disabled');
			$("#checkipcloudflare").hide();
			$("#checkipcloudflare").html('<div class="gmenu" style="text-align: center;"><img src="/template/images/loading.svg" /></div>').slideDown('slow');
			getLink();
		});
		$("#reset").click(function(){
			$("#checkipcloudflare").html('');
		});
		function getLink(){
			var form = $('#form')[0];
			var formData = new FormData(form);
			$.ajax({
				url: "cloudflare.php",
				type: "POST",
				data:  formData,
				contentType: false,
				cache: false,
				processData:false,
				success: function(rs)
				{
					res = JSON.parse(rs);
					if(res.success){
						$("#submit").removeClass('disabled');
						$("#checkipcloudflare").hide();
						$("#checkipcloudflare").html(''+res.success+'').slideDown('slow');
					}
					if(res.error){
						$("#submit").removeClass('disabled');
						$("#checkipcloudflare").hide();
						$("#checkipcloudflare").html('<div class="gmenu" style="text-align: center;"><i style="color:red">'+res.error+'</i></div>').slideDown('slow');
					}
				},
				error: function() 
				{
					$("#submit").removeClass('disabled');
					$("#checkipcloudflare").hide();
					$("#checkipcloudflare").html('<div class="gmenu" style="text-align: center;"><i style="color:red">Hệ thống bận, thử lại sau!</i></div>').slideDown('slow');
				}           
			});
		}

	});
</script>

<?php
	include '../template/footer.php';
}

function Domain($domain)
{
	$domain = str_replace('http://', '', $domain);
	$domain = str_replace('https://', '', $domain);
	$domain = str_replace('www.', '', $domain);
	$domain = explode('/', $domain);
	$domain = $domain[0];
	return $domain;
}
function getcontent($dkm) {
	$ch = @curl_init();
	curl_setopt($ch, CURLOPT_URL, $dkm);
	$head[] = "Connection: keep-alive";
	$head[] = "Keep-Alive: 300";
	$head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
	$head[] = "Accept-Language: en-us,en;q=0.5";
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/45.0 Chrome/39.0.2171.95 Safari/537.36');
	curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_ENCODING , 'gzip, deflate');
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
	$nd = curl_exec($ch);
	curl_close($ch);
	return $nd;
}