real_escape_string(strtolower(stripslashes(strip_tags($link)))); $link = str_replace('/', '', $link); $sql = "SELECT * FROM `tracking` WHERE `id` = '$link' LIMIT 1;"; // Testing to see if the link has been visited before if($result = $shortdb->query($sql)){ if($row = $result->fetch_assoc()){ $sql = "UPDATE `tracking` SET `clicks` = `clicks` + 1 WHERE `id` = '$link'"; // Yes it has, increment clicks by 1 if($result = $shortdb->query($sql)){ if($result->num_rows == 0){ die ($shortdb->error); } } } }else{ $sql = "INSERT INTO `tracking` (id, clicks) VALUES ('$link', 1)"; // No it hasn't, add 1 click to the table if($result = $shortdb->query($sql)){ if($result->num_rows == 0){ die ($shortdb->error); } } } $sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;"; if($result = $shortdb->query($sql)){ if($row = $result->fetch_assoc()){ $link = $row['link']; //header("location:$link"); exit(5); // Stop script execution to save on resources } } } // exit codes: /* exit 0 - Good script exit 5 - Link redirection 10x exit codes exit 11 - Shortener Stats redirection exit 12 - Shortener Resolver redirection exit 13 - Shortener About redirection */ // This has been depreciated. Still here for backwards compatibility with existing links if(!empty($_GET['l'])){ followLink($shortdb, $_GET['l']); } // New way to check for valid short links, two characters shorter than the if statement above if(!empty($_GET)){ $key = key($_GET); if($key == "stats"){ header("location:http://s.lob.li"); exit(11); } if($key == "resolv"){ header("location:http://r.lob.li"); exit(12); } if($key == "about"){ header("location:http://a.lob.li"); exit(13); } followLink($shortdb, $key); } ?> lob.li - Objective Links

Please give me a link to shorten...

loading.... Please Wait