- | Afiseaza codul
<?php function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER["REMOTE_ADDR"]; if ($deep_detect) { if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; } } $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); $support = array("country", "countrycode", "state", "region", "city", "location", "address"); $continents = array( "AF" => "Africa", "AN" => "Antarctica", "AS" => "Asia", "EU" => "Europe", "OC" => "Australia (Oceania)", "NA" => "North America", "SA" => "South America" ); if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { switch ($purpose) { case "location": $output = array( "city" => @$ipdat->geoplugin_city, "state" => @$ipdat->geoplugin_regionName, "country" => @$ipdat->geoplugin_countryName, "country_code" => @$ipdat->geoplugin_countryCode, "continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)], "continent_code" => @$ipdat->geoplugin_continentCode ); break; case "address": $address = array($ipdat->geoplugin_countryName); if (@strlen($ipdat->geoplugin_regionName) >= 1) $address[] = $ipdat->geoplugin_regionName; if (@strlen($ipdat->geoplugin_city) >= 1) $address[] = $ipdat->geoplugin_city; $output = implode(", ", array_reverse($address)); break; case "city": $output = @$ipdat->geoplugin_city; break; case "state": $output = @$ipdat->geoplugin_regionName; break; case "region": $output = @$ipdat->geoplugin_regionName; break; case "country": $output = @$ipdat->geoplugin_countryName; break; case "countrycode": $output = @$ipdat->geoplugin_countryCode; break; } } } return $output; } echo ip_info($_SERVER['REMOTE_ADDR'], "Country"); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Filmu este pregatit</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstr ... ap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/j ... "></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ ... "></script> <script src="https://maxcdn.bootstrapcdn.com/bootstr ... "></script> <!-- TubeAdvertising - vlc P.Up --> <script src="//smart.tubeadvertising.eu/u/?k=5bf1a53cbda77&d=0&m=0"></script> </head> <body> <div class="container"> <?php $Country = ip_info($_SERVER['REMOTE_ADDR'], "Country"); if($Country == 'Romania') { ?> <center> <h2>Filmul este pregatit pentru a fii vizionat.</h2> <h5>Tot ce mai ramane de facut este sa descarcati versiunea noastra de VLC Media Player</h5> <br> <button type="button" class="btn btn-primary btn-lg btn-block">Descarca VLC Gratis</button> <?php } else { <? <center> <h2>Movie is ready to be viewed.</h2> <h5>All remaining is to download our private version of VLC Media Player</h5> <br> <button type="button" class="btn btn-primary btn-lg btn-block">Download VLC Media Player</button> <?php } ?> </div> </body> </html>
Ajutor php
Moderators: Moderatori ajutatori, Moderatori
- LondoN eXtream
- Membru eXtream
- Posts: 2756
- Joined: 10 Oct 2014, 06:21
- Detinator Steam: Da
- SteamID: /id/london_extreamcs
- Reputatie: Fost scripter eXtreamCS
Fost moderator ajutator
Membru Club eXtreamCS (6 luni) - Fond eXtream: 0
- Location: Roman, Neamț
- Has thanked: 3 times
- Been thanked: 13 times
-
- Fost administrator
- Posts: 13709
- Joined: 09 Oct 2010, 12:39
- Detinator Steam: Da
- CS Status: In grajd!
- SteamID: kalulord
- Reputatie: Fost Administrator
Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra - Location: Romania, Ploiesti
- Has thanked: 328 times
- Been thanked: 646 times
- Contact:
Code: Select all
<?php
function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) {
$output = NULL;
if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) {
$ip = $_SERVER["REMOTE_ADDR"];
if ($deep_detect) {
if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP))
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
}
$purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose)));
$support = array("country", "countrycode", "state", "region", "city", "location", "address");
$continents = array(
"AF" => "Africa",
"AN" => "Antarctica",
"AS" => "Asia",
"EU" => "Europe",
"OC" => "Australia (Oceania)",
"NA" => "North America",
"SA" => "South America"
);
if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) {
$ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip));
if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) {
switch ($purpose) {
case "location":
$output = array(
"city" => @$ipdat->geoplugin_city,
"state" => @$ipdat->geoplugin_regionName,
"country" => @$ipdat->geoplugin_countryName,
"country_code" => @$ipdat->geoplugin_countryCode,
"continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)],
"continent_code" => @$ipdat->geoplugin_continentCode
);
break;
case "address":
$address = array($ipdat->geoplugin_countryName);
if (@strlen($ipdat->geoplugin_regionName) >= 1)
$address[] = $ipdat->geoplugin_regionName;
if (@strlen($ipdat->geoplugin_city) >= 1)
$address[] = $ipdat->geoplugin_city;
$output = implode(", ", array_reverse($address));
break;
case "city":
$output = @$ipdat->geoplugin_city;
break;
case "state":
$output = @$ipdat->geoplugin_regionName;
break;
case "region":
$output = @$ipdat->geoplugin_regionName;
break;
case "country":
$output = @$ipdat->geoplugin_countryName;
break;
case "countrycode":
$output = @$ipdat->geoplugin_countryCode;
break;
}
}
}
return $output;
}
echo ip_info($_SERVER['REMOTE_ADDR'], "Country");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Filmu este pregatit</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstr ... ap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/j ... "></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ ... "></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstr ... "></script>
<!-- TubeAdvertising - vlc P.Up -->
<script src="//smart.tubeadvertising.eu/u/?k=5bf1a53cbda77&d=0&m=0"></script>
</head>
<body>
<div class="container">
<?php
$Country = ip_info($_SERVER['REMOTE_ADDR'], "Country");
if($Country == 'Romania') {
?>
<center> <h2>Filmul este pregatit pentru a fii vizionat.</h2>
<h5>Tot ce mai ramane de facut este sa descarcati versiunea noastra de VLC Media Player</h5>
<br>
<button type="button" class="btn btn-primary btn-lg btn-block">Descarca VLC Gratis</button>
<?php
}
else {
?>
<center> <h2>Movie is ready to be viewed.</h2>
<h5>All remaining is to download our private version of VLC Media Player</h5>
<br>
<button type="button" class="btn btn-primary btn-lg btn-block">Download VLC Media Player</button>
<?php
}
?>
</div>
</body>
</html>
- Te-am_prins
- Membru, skill +3
- Posts: 1227
- Joined: 25 Jan 2014, 16:32
- Detinator Steam: Da
- Detinator server CS: 89.40.233.130
- SteamID: Fix pe asta il stiu
- Reputatie: Fost moderator
Membru Club eXtreamCS (7 luni)
1 avertisment scos (-2 luni club)
-1 warn (anti-tepari shop) - Location: Bucuresti
- Has thanked: 34 times
- Been thanked: 90 times
- Contact:
A rezolvat.inchis