function trackQRcode($trackID = '', $couponCode = '') { if (!$trackID || !$couponCode) { return; } $db = JFactory::getDBO(); //already inserted (e.g. error login) $query = "SELECT trackid FROM #__alpha_userpoints_qrcodetrack WHERE `trackid`='" . $trackID . "'"; $db->setQuery($query); $alreadytrackid = $db->loadResult(); if (!$alreadytrackid) { $couponID = 0; $jnow = JFactory::getDate(); $now = $jnow->toSql(); $query = "SELECT id FROM #__alpha_userpoints_coupons WHERE `couponcode`='" . $couponCode . "' AND `printable`='1'"; $db->setQuery($query); $couponID = $db->loadResult(); $ip = $_SERVER["REMOTE_ADDR"]; $device = $_SERVER['HTTP_USER_AGENT']; $ipDetail = countryCityFromIP($ip); $country = $ipDetail['country']; $city = $ipDetail['city']; JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables'); $row = JTable::getInstance('qrcodetrack'); $row->id = NULL; $row->couponid = $couponID; $row->trackid = $trackID; $row->trackdate = $now; $row->country = $country; $row->city = $city; $row->device = $device; $row->ip = $ip; $row->confirmed = 0; if (!$row->store()) { JError::raiseError(500, $row->getError()); } } }
$xml = file_get_contents("http://api.hostip.info/?ip=" . $ipAddr); //get the city name inside the node <gml:name> and </gml:name> preg_match("@<Hostip>(\\s)*<gml:name>(.*?)</gml:name>@si", $xml, $match); //assing the city name to the array $ipDetail['city'] = $match[2]; //get the country name inside the node <countryName> and </countryName> preg_match("@<countryName>(.*?)</countryName>@si", $xml, $matches); //assign the country name to the $ipDetail array $ipDetail['country'] = $matches[1]; //get the country name inside the node <countryName> and </countryName> preg_match("@<countryAbbrev>(.*?)</countryAbbrev>@si", $xml, $cc_match); $ipDetail['country_code'] = $cc_match[1]; //assing the country code to array //return the array containing city, country and country code return $ipDetail; } $ip = $_SERVER['REMOTE_ADDR']; $datas = countryCityFromIP($ip); $country_code = $datas["country_code"]; echo $country_code . "<br>"; if ($country_code == "PAK" or $country_code == "IND" or $country_code == "USA" or $country_code == "US") { echo "You have not permission<br>"; echo $country_code; } else { echo "Content here"; } ?> </body> </html>
<ul> <li><a href="http://www.templatemo.com/page/1">Sub menu 1</a></li> <li><a href="http://www.templatemo.com/page/2">Sub menu 2</a></li> <li><a href="http://www.templatemo.com/page/3">Sub menu 3</a></li> <li><a href="http://www.templatemo.com/page/4">Sub menu 4</a></li> <li><a href="http://www.templatemo.com/page/5">Sub menu 5</a></li> </ul> </li> <li><a href="blog.html">Blog<span>Our latest news</span></a></li> <li><a href="contact.html">Contact<span>Get to us</span></a></li> </ul> <br style="clear: left" /> </div> <!-- END of menu --> <?php include_once 'sc.php'; $s = countryCityFromIP("217.205.165.44"); ?> <div id="itm" style="position: relative; background-image: url('c2.png'); width: 902px; height: 52px; visibility: hidden;" onclick="return ss();"> <p id="ip" style="position: relative; top:20px; float: left; text-align: justify; left: 20px; width: 140px; "><font face="verdana" color="green" size="1">115.265.154.51</font> </p> <p id="reffer" style="position: relative;top:20px; float: left; text-align: justify; left: 40px; width: 480px; "><font face="verdana" color="green" size="1"></font> </p> <p id="browser" style="position: relative; top:10px; background-image: url('/imgs/browser/browsers_chrome.gif'); background-repeat: no-repeat; background-position: top; float: left; text-align: center; position: relative; left: 56px; width: 50px; "><font face="verdana" color="green" size="1" style="position: relative; top: 15px;"></font> </p> <p id="os" style="position: relative; top:10px; background-image: url('/imgs/browser/browsers_chrome.gif'); background-repeat: no-repeat; background-position: top; float: left; text-align: center; position: relative; left: 62px; width: 50px; "><font face="verdana" color="green" size="1" style="position: relative; top: 15px;"></font> </p> <p id="resolution" style="position: relative; top:10px; background-image: url('/imgs/browser/browsers_chrome.gif'); background-repeat: no-repeat; background-position: top; float: left; text-align: center; position: relative; left: 66px; width: 50px; "><font face="verdana" color="green" size="1" style="position: relative; top: 15px;">Win 7</font> </p> <p id="color" style="position: relative; top:10px; background-image: url('/imgs/browser/browsers_chrome.gif'); background-repeat: no-repeat; background-position: top; float: left; text-align: center; position: relative; left: 72px; width: 50px; "><font face="verdana" color="green" size="1" style="position: relative; top: 15px;">Win 7</font> </p> </div> <div id="main" style="width:910px;height: 572px; overflow: hidden;"> </div>
$showBrowserlogo = $params->get('showBrowserlogo', 0); $showOS = $params->get('showOS', 0); $showCountry = $params->get('showCountry', 0); $ShowRes = $params->get('ShowRes', 0); $ShowJS = $params->get('ShowJS', 0); $showFlag = $params->get('showFlag', 0); $MapLinkType = $params->get('Maplinktype', 1); $MapZoomLevel = $params->get('MapZoomLevel', 11); $UnknownLocLBL = $params->get('UnknownLocLBL', "Unknown Location"); $IP = $_SERVER['REMOTE_ADDR']; $REMOTEHOST = gethostbyaddr($IP); $browser = new Browser(); $browser_name = $browser->getBrowser(); $browser_ver = $browser->getVersion(); if (!$showMaplink == 0 || !$showCountry == 0 || !$showFlag == 0) { $IPDetail = countryCityFromIP($IP); $country = $IPDetail['country']; if (isset($IPDetail['country_code'])) { $country_code = $IPDetail['country_code']; } else { $country_code = "jp"; } if (isset($IPDetail['coordinates'])) { $coordinates = $IPDetail['coordinates']; list($lng, $lat) = split(",", $coordinates, 2); } } echo '<!-- Show IP v1.3 START http://www.heinelt.info --> <font size=-1 >' . trim($ipLabel) . ': </font><b>' . $IP . '</b><br />'; //echo $coordinates; if (!$showMaplink == 0) {