Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set("America/Sao_Paulo");
- //define("SERVER", "LOCAL");
- define("SERVER", "WEB");
- function configurations() {
- if(SERVER == "LOCAL") {
- error_reporting(1);
- ini_set('display_errors', true);
- define("URL", "http://".$_SERVER['HTTP_HOST']."/GRANAFACIL/BLOG");
- } else {
- error_reporting(0);
- ini_set('display_errors', false);
- define("URL", "http://".$_SERVER['HTTP_HOST']."");
- }
- }
- function decoder($hex){
- $string='';
- for ($i=0; $i < strlen($hex)-1; $i+=2){
- $string .= chr(hexdec($hex[$i].$hex[$i+1]));
- }
- return $string;
- }
- function urlAtual(){
- $dominio= $_SERVER['HTTP_HOST'];
- $url = "http://" . $dominio. $_SERVER['REQUEST_URI'];
- return $url;
- }
- function limitar($text, $qntd) {
- return substr_replace($text, (strlen($text) > $qntd ? '...' : ''), $qntd);
- }
- function countryGet($ip_address) {
- require "dbip.class.php";
- try {
- $db = new PDO("mysql:host=mysql.granasocial.com.br;dbname=granasocial", "granasocial", "123Bo456");
- $dbip = new DBIP($db);
- $inf = $dbip->Lookup($ip_address);
- return $inf->country;
- } catch (DBIP_Exception $e) {
- }
- }
- configurations();
- function openConnection() {
- global $mysqli;
- $host = (SERVER == "LOCAL") ? "localhost" : "mysql.granasocial.com.br";
- $user = (SERVER == "LOCAL") ? "root" : "granasocial";
- $pass = (SERVER == "LOCAL") ? "" : "123Bo456";
- $data = (SERVER == "LOCAL") ? "granafacil" : "granasocial";
- $mysqli = new mysqli($host, $user, $pass, $data);
- if ($mysqli->connect_error) {}
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement