Fadly31337

No Redirect (Web Based)

Oct 25th, 2020 (edited)
2,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1. <?php
  2. function stripFile($in){
  3.     $pieces = explode("/", $in);
  4.     if(count($pieces) < 4) return $in . "/";
  5.     if(strpos(end($pieces), ".") !== false){
  6.         array_pop($pieces);
  7.     }elseif(end($pieces) !== ""){
  8.         $pieces[] = "";
  9.     }
  10.     return implode("/", $pieces). "/";
  11. }
  12.  function url_get_contents ($url) {
  13.     if (function_exists('curl_exec')){
  14.         $conn = curl_init($url);
  15.         curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, true);
  16.         curl_setopt($conn, CURLOPT_FRESH_CONNECT,  true);
  17.         curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
  18.         $url_get_contents_data = (curl_exec($conn));
  19.         curl_close($conn);
  20.     }elseif(function_exists('file_get_contents')){
  21.         $url_get_contents_data = file_get_contents($url);
  22.     }elseif(function_exists('fopen') && function_exists('stream_get_contents')){
  23.         $handle = fopen ($url, "r");
  24.         $url_get_contents_data = stream_get_contents($handle);
  25.     }else{
  26.         $url_get_contents_data = false;
  27.     }
  28. $data = str_replace('<a href="','<a href="'.'http://' . $_SERVER['HTTP_HOST'].$_SERVER["PHP_SELF"].'?url='.stripFile($url),$url_get_contents_data);
  29. $data = str_replace('<head>','<head><base href="'.stripFile($url).'">',$data);
  30. return $data;
  31. }
  32. if(!isset($_GET['url'])){ ?>
  33. <form><span>URL : </span><input name="url" value="" type="text"><input value="Gas!" type="submit"></form>
  34. <?php  
  35. }
  36. else{
  37.     if(substr($_GET['url'], 0, 4) == 'http'){
  38.     echo '<center><form><span>URL : </span><input name="url" value="'.htmlspecialchars($_GET['url']).'" type="text"><input value="GO" type="submit"></form></center>';
  39.     echo url_get_contents (htmlspecialchars($_GET['url']));
  40.     }
  41.     else{
  42.         echo '<form><span>URL : </span><input name="url" value="'.htmlspecialchars($_GET['url']).'" type="text"><input value="Gas!" type="submit"></form>';
  43.         echo "Tambahin http atau https njing, gabisa jalan toolsnya :|</center>";
  44.     }
  45. }
  46. ?>
Add Comment
Please, Sign In to add comment