Skip to content

Instantly share code, notes, and snippets.

@ennjoy
Created June 18, 2019 19:42
Show Gist options
  • Save ennjoy/866a6e057e1acf85fe45ad1eaae715f7 to your computer and use it in GitHub Desktop.
Save ennjoy/866a6e057e1acf85fe45ad1eaae715f7 to your computer and use it in GitHub Desktop.
v-krimu.php
<?php
/*
Appointment: Проверка ссылок
File: away.php
Author: Leonid Rezvitsky
Данный код защищен авторскими правами
*/
include 'php_main/lock.php';
function cc_url_handler($id, $url, $ask = false, $s = false) {
$result = "http://catcut.net/go.php?h_i=$id";
$url = base64_encode($url);
$result .= "&h_u=$url";
if($ask) {
$result .= "&h_a=$ask";
}
if($s) {
$result .= "&s=1";
}
return $result;
}
$restricted_sql = mysqli_query($dbConnect, "SELECT id, domain, description FROM restricted_sites;", 1);
foreach ($restricted_sql as $item) {
$restricted[$item['domain']] = $item['description'];
}
function clean_url($url) {
if( $url == '' ) return;
$url = str_replace( "http://", "", strtolower( $url ) );
$url = str_replace( "https://", "", $url );
if( substr( $url, 0, 4 ) == 'www.' ) $url = substr( $url, 4 );
$url = explode( '/', $url );
$url = reset( $url );
$url = explode( ':', $url );
$url = reset( $url );
return $url;
}
if (in_array(clean_url($_GET['url']), array_keys($restricted))) {
$message = $restricted[clean_url($_GET['url'])];
} else {
$to = cc_url_handler(1688, $_GET['url']);
header("Location: ".$to);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment