1. PHP / Говнокод #11274

    +50

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    <?php
     require('url_to_absolute.php');
    ini_set('display_errors','On');
    error_reporting('E_ALL');
    $ext=array(
    'pictures'=>array('bmp','jpg','jpeg','pgm','rgb','tga','png','gif','ico'),
    'docs'=>array('rtf','doc','docx','pdf','txt'),
    'html'=>array('shtml','html','xml','css','htm','xhtml'),
    'audio'=>array('mp3','mp4','mpeg','flv','3gp','webm'),
    'arch'=>array('zip','rar','gz','bz2','tar','7zip','ar','tar\.gz','tar\.bz2','xz'),
    'pack'=>array('deb','rpm','jar'),
    'scripts'=>array('sh','pl','py','php','js')
    );
    $murl="";
    $sext="";
    $routh='|((?<=[" ])[^" ]+/[a-z0-9-_%.]+\.';
    foreach($ext as $sk=>$sval){
    foreach($sval as $exts){
      $routh.='(?!'.$exts.'")';
    }
    }
    $routh.='[a-z0-9]{1,5}(?=[" ]))|i';
    echo $routh."<br\ >";
    if(isset($_GET['url'])){
    $url=$_GET['url'];echo $url."<br>";
    preg_match('|(ftp)?(http)?(?:s)?://[a-z0-9-]+\.[a-z]+(\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?|i',$url,$ures);
    if(!empty($ures[0])){echo $ures[0];$murl=$ures[0];echo "<br>murl ".$murl."<br> ";}
    $html=file_get_contents($url);
    
    foreach($ext as $key=>$val){
    echo "<h2>$key</h2><br\>";
    foreach($val as $mext){
    echo "$mext<br>";
    preg_match_all('|((/[.a-z0-9_-]*)*/[a-z0-9-_.%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
      if(!empty($result)){
      if(!empty($result[0])){
        $result[0]=array_unique($result[0]);
      foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
        echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    preg_match_all('|((http(?:s)?://)[a-z0-9-]+\.[a-z]+(?:\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?(?:/[a-z0-9_-.]*)/[.a-z0-9-_%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
      $result[0]=array_unique($result[0]);
      foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    preg_match_all('|((?<=[" ])[^" ]+\.'.$mext.'(?=[" ]))|i',$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
    $result[0]=array_unique($result[0]);
    foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    
    }
    }
    preg_match_all($routh,$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
    $result[0]=array_unique($result[0]);
    echo "<br><h2>Other documents</h2><br>";
    foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a><br \> ");
    }
    }
    }
    } else { printf("No url\n");}
    ?>

    Вытягивает ссылки на картинки с html файла

    AliceGoth, 21 Июня 2012

    Комментарии (6)
  2. PHP / Говнокод #11273

    +142

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    <?php
     require('url_to_absolute.php');
    ini_set('display_errors','On');
    error_reporting('E_ALL');
    $ext=array(
    'pictures'=>array('bmp','jpg','jpeg','pgm','rgb','tga','png','gif','ico'),
    'docs'=>array('rtf','doc','docx','pdf','txt'),
    'html'=>array('shtml','html','xml','css','htm','xhtml'),
    'audio'=>array('mp3','mp4','mpeg','flv','3gp','webm'),
    'arch'=>array('zip','rar','gz','bz2','tar','7zip','ar','tar\.gz','tar\.bz2','xz'),
    'pack'=>array('deb','rpm','jar'),
    'scripts'=>array('sh','pl','py','php','js')
    );
    $murl="";
    $sext="";
    $routh='|((?<=[" ])[^" ]+/[a-z0-9-_%.]+\.';
    foreach($ext as $sk=>$sval){
    foreach($sval as $exts){
      $routh.='(?!'.$exts.'")';
    }
    }
    $routh.='[a-z0-9]{1,5}(?=[" ]))|i';
    echo $routh."<br\ >";
    if(isset($_GET['url'])){
    $url=$_GET['url'];echo $url."<br>";
    preg_match('|(ftp)?(http)?(?:s)?://[a-z0-9-]+\.[a-z]+(\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?|i',$url,$ures);
    if(!empty($ures[0])){echo $ures[0];$murl=$ures[0];echo "<br>murl ".$murl."<br> ";}
    $html=file_get_contents($url);
    
    foreach($ext as $key=>$val){
    echo "<h2>$key</h2><br\>";
    foreach($val as $mext){
    echo "$mext<br>";
    preg_match_all('|((/[.a-z0-9_-]*)*/[a-z0-9-_.%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
      if(!empty($result)){
      if(!empty($result[0])){
        $result[0]=array_unique($result[0]);
      foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
        echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    preg_match_all('|((http(?:s)?://)[a-z0-9-]+\.[a-z]+(?:\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?(?:/[a-z0-9_-.]*)/[.a-z0-9-_%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
      $result[0]=array_unique($result[0]);
      foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    preg_match_all('|((?<=[" ])[^" ]+\.'.$mext.'(?=[" ]))|i',$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
    $result[0]=array_unique($result[0]);
    foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a> ");}
    }
    }
    
    }
    }
    preg_match_all($routh,$html,$result);
    if(!empty($result)){
    if(!empty($result[0])){
    $result[0]=array_unique($result[0]);
    echo "<br><h2>Other documents</h2><br>";
    foreach($result[0] as $vres){
        $aurl=url_to_absolute($url,$vres);
    echo("<a href=\"$aurl\">".$aurl."</a><br \> ");
    }
    }
    }
    } else { printf("No url\n");}
    ?>

    Вытягивает ссылки на картинки с html файла

    AliceGoth, 21 Июня 2012

    Комментарии (3)
  3. PHP / Говнокод #11272

    +41

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    <?php
    ini_set('display_errors','On');
    error_reporting('E_ALL');
    mysql_connect("localhost","MySQL","satanus") or die(mysql_error());
    echo "Connected to mysql<br>";
    mysql_select_db("myurl") or die(mysql_error());
    echo "Connected to Database";
    $ms=mysql_info();
    echo $ms;
    
    function isValidURL($url)
    {
    return preg_match('|^(http)(s)?://([a-z0-9-]+\.[a-z-]+)?(localhost)?(\.[a-z0-9-_/&+?=%]+)*(:[0-9]+)?(/[^.]+)?$|i', $url);
    }
    function parse_secure($arg){
      $txt=preg_replace('/((<[^>]*>(.*)<\/[^>]*>|\'|")|(<[^>]*>)|(?:(\s+|>|<|\d+)(?:SELECT|FROM|UNION|ORDER BY|GROUP BY|UPDATE|DELETE|INSERT|OR|AND|NOT)(\s+|>|<|\d+))|<)/i','',$arg);
      return $txt;
    }
    
    if(isset($_GET['pid'])){
        $pid=$_GET['pid'];
        $pid=parse_secure($pid);
        $options=array('options'=>array('min_range'=>0,'max_range'=>1000001));
          if(filter_var($pid,FILTER_VALIDATE_INT,$options)){
            printf("pid correct %d",$pid);
        } else {
            printf("pid incorrect");exit(2);  
        }
        $query="SELECT url FROM myurl.base WHERE id='$pid'";
        $res=mysql_query($query);
        if($res){
          $row=mysql_fetch_assoc($res);
          header('Location: '.$row['url']);
        }
    };
    
    if(isset($_GET['cat']) && isset($_GET['scat'])){
      $cat=$_GET['cat'];
      $cat=parse_secure($cat);
      if(isset($_GET['ps'])){
        $ps = $_GET['ps'];
        $ps=parse_secure($ps);
      } else {
      $ps =0;
      };
      $catl=iconv_strlen($thm);
      echo "<html><head><title>Short url generator</title></head><body>";
      echo "<h1>$cat</h1><br>";
          $qry="SELECT bs.id as pid,bs.url url,bs.subcategory scat,bs.category cat FROM base bs INNER JOIN category ct ON ct.id=bs.category WHERE bs.subcategory=\"".$_GET['scat']."\" AND bs.category=\"".parse_secure($_GET['cat'])."\"";
          $res=mysql_query($qry);
          if($res){
            while($row=mysql_fetch_assoc($res)){
              echo "<a href=\"http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?pid=".$row['pid']."\">http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?pid=".$row['pid']."</a> ".$row['url'];
              echo " <a href=\"http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?cat=".$row['cat']."&scat=".$row['scat']."\">http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?cat=".$row['cat']."&scat=".$row['scat']."</a>".$row['url'];
              echo "<br>";
            }
          }
    exit(3);
    };
    
    if(isset($_GET['cat'])){
      $cat=parse_secure($_GET['cat']);
      $scat=parse_secure($_GET['scat']);
      if(isset($_GET['ps'])){
        $ps = $_GET['ps'];
      } else {
      $ps =0;
      };
      $catl=iconv_strlen($thm);
      echo "<html><head><title>Short url generator</title></head><body>";
      echo "<h1>$cat</h1><br>";
          $qry="SELECT bs.id as pid,bs.url url,bs.subcategory scat,bs.category cat FROM base bs INNER JOIN category ct ON ct.id=bs.category WHERE bs.category=\"".$cat."\" OR ( bs.subcategory=\"".$scat."\" AND bs.category=\"".$cat."\")";
          $res=mysql_query($qry);
          if($res){
            while($row=mysql_fetch_assoc($res)){
              echo "<a href=\"http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?pid=".$row['pid']."\">http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?pid=".$row['pid']."</a>".$row['url'];
              echo " <a href=\"http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?cat=".$row['cat']."&scat=".$row['scat']."\">http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?cat=".$row['cat']."&scat=".$row['scat']."</a>".$row['url'];
              echo "<br>";
            }
          }
    };
    
    if(isset($_POST['url']) && (isset($_POST['category']) || isset($_POST['cat'])) && (isset($_POST['subcat']) || isset($_POST['scat']))){
      $url=$_POST['url'];
    $purl=substr($url,0,26);
      if($purl=="http://".$_SERVER['SERVER_NAME']."/")exit(0);
    $purl=substr($url,0,30);
      if($purl=="http://www.".$_SERVER['SERVER_NAME']."/")exit(0);
      $cat=parse_secure($_POST['category']);
      $catid=parse_secure($_POST['cat']);
      $scat=parse_secure($_POST['subcat']);
      $scatid=parse_secure($_POST['scat']);
      if($url) {
          if(!isValidURL($url))
    {
    $errMsg .= "* Please enter valid URL including http://<br>";

    AliceGoth, 21 Июня 2012

    Комментарии (10)
  4. PHP / Говнокод #11267

    +56

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ('cardiscon' == $key) {
    	echo '<td class="even cardiscon">'.$row['name'].':</td>';
    } elseif ('cardprice' == $key) {
    	echo '<td class="even cardiscon">'.$row['name'].':</td>';
    } else {
    	echo '<td class="even">'.$row['name'].':</td>';
    }

    Странная конструкция

    domaster, 21 Июня 2012

    Комментарии (5)
  5. PHP / Говнокод #11266

    +48

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    if (
        ($my_var[1] == "add_article" ||
         $my_var[1] == "add_topic" ||
         $my_var[1] == "add_topic2" ||
         $my_var[1] == "add_initiative"
        ) && (
            $_REQUEST["publish"] == "before" ||
            $_REQUEST["publish"] == "current")
    ) {
    
    } else {
    
        echo <<<EOD
    <!doctype html>
    
    EOD;
    
    }

    форматирование сохранено

    shmaltorhbooks, 21 Июня 2012

    Комментарии (22)
  6. PHP / Говнокод #11263

    +140

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
    	    $name_file = explode(".",$filename);
    		
    		if (!file_exists($name_file[0].".out")){
    		// заливаем в jar
            exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
            echo "Insert " . $filename . " Complete!\n\r";
    		
    		usleep(10000);
    		}
    		else echo "You have uploaded this file already!\n\r";
        }

    Copy-Paste, 20 Июня 2012

    Комментарии (10)
  7. PHP / Говнокод #11262

    +141

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
    	    $name_file = explode(".",$filename);
    		
    		if (!file_exists($name_file[0].".out")){
    		// заливаем в jar
            exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
            echo "Insert " . $filename . " Complete!\n\r";
    		
    		usleep(10000);
    		}
    		else echo "You have uploaded this file already!\n\r";
        }

    Copy-Paste, 20 Июня 2012

    Комментарии (0)
  8. PHP / Говнокод #11261

    +141

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
    	    $name_file = explode(".",$filename);
    		
    		if (!file_exists($name_file[0].".out")){
    		// заливаем в jar
            exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
            echo "Insert " . $filename . " Complete!\n\r";
    		
    		usleep(10000);
    		}
    		else echo "You have uploaded this file already!\n\r";
        }

    Copy-Paste, 20 Июня 2012

    Комментарии (0)
  9. PHP / Говнокод #11260

    +141

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
    	    $name_file = explode(".",$filename);
    		
    		if (!file_exists($name_file[0].".out")){
    		// заливаем в jar
            exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
            echo "Insert " . $filename . " Complete!\n\r";
    		
    		usleep(10000);
    		}
    		else echo "You have uploaded this file already!\n\r";
        }

    Copy-Paste, 20 Июня 2012

    Комментарии (1)
  10. PHP / Говнокод #11259

    +141

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
    	    $name_file = explode(".",$filename);
    		
    		if (!file_exists($name_file[0].".out")){
    		// заливаем в jar
            exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
            echo "Insert " . $filename . " Complete!\n\r";
    		
    		usleep(10000);
    		}
    		else echo "You have uploaded this file already!\n\r";
        }

    Copy-Paste, 20 Июня 2012

    Комментарии (0)