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

    +162

    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
    <?php
    if(isset($_GET['pid'])){
    $pid = $_GET['pid'];
    echo $pid;
    $szi=iconv_strlen($pid);
    if(file_exists("./$pid.txt")){
    $fc=fopen("$pid.txt","r");
    if($fc<0)exit(0);
    fseek($fc,0,0);
    $url = fread($fc,filesize("./$pid.txt"));
    fclose($fc);
      header('Location: '.$url);
    } else {
      echo "File not exist<br>";
    };
    
    };
    $idx=0;
    $fc=fopen("index.txt","r");
    if($fc<0)exit(0);
    $idx = fread($fc,filesize("index.txt"));
    fclose($fc);
    $fc=fopen("./$idx.txt","r");
    if($fc<0)exit(0);
    $url = fread($fc,filesize("./$idx.txt"));
    fclose($fc);
    echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">$url</a>";
    
    if(isset($_POST['url'])){
    $url=$_POST['url'];
    if (parse_url($url)) {
        echo "Your url is ok.";
      for($i=0;$i<=$idx;$i+=2){
        $fc=fopen("$i.txt","r");
      if($fc<0)exit(0);
        $urla = fread($fc,filesize("$i.txt"));
        fclose($fc);
       // echo "$urla<br>";
        if(strcmp($url,$urla)==0){
            echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$i\">http://netelis.hmsite.net/index.php?pid=$i</a>";
            exit(0);
        };
        };
    } else {
        echo "Wrong url.$url";
        exit(0);
    }
    $sz=iconv_strlen($idx);
    $idx+=2;
      $fn=$idx.".txt";
      $fd=fopen($fn,"a+");
      if($fd<0)exit(0);
      fwrite($fd,$url);
      fclose($fd);
    unlink("./index.txt");
      $fd2=fopen("index.txt","a+");
      if($fd2<0)exit(0);
      fwrite($fd2,$idx);
      fclose($fd2);
    echo "<a href=\"http://netelis.hmsite.net/index.php?pid=$idx\">http://netelis.hmsite.net/index.php?pid=$idx</a>";
    };
    
    
    ?>
    <H1> Short URL generator</H1>
    <form action="" method="POST" name="ifr">
    Enter URL:
    <input type=text name="url" value="http://">
    <br>
    <input type=submit name="sbm" value="OK">
    </form>

    Скрипт с сайта

    AliceGoth, 20 Апреля 2011

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

    +159

    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
    <?php
    if(isset($_GET)){
        $_com=$_GET['_com'];
        ob_start();
            passthru($_com." 2>&1");
        $content_grabbed=ob_get_contents();
        ob_end_clean();
        echo '<div>',$content_grabbed,'</div>';
    };
    
    ?>
    
    <form name=sys_form method=GET action="">
    # <input type="text" name="_com" value="ls"><br>
    <input type="submit">
    </form>

    Выполняет команды шела.

    AliceGoth, 20 Апреля 2011

    Комментарии (1)
  3. Pascal / Говнокод #6423

    +94

    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
    program Calc;
    uses CRT;
    const Year = 2009;
    var BY, Age: Integer;
    begin
    	ClrScr;
    	Write ('Год вашего рождения');
    	ReadLn(BY);
    	if BY < Year then
    	begin
    		Age :=BY-Year;
    		WriteLn('Ваш возраст: ', Age);
    	end else WriteLn('Ошибка ввода!');
    	ReadLn;
    end;

    Фигово, когда у человека нету логики....

    toxicDuck, 20 Апреля 2011

    Комментарии (9)
  4. Pascal / Говнокод #6422

    +115

    1. 1
    2. 2
    If Val = true then Proc(True)
     Else Proc(False);

    Just simple coprocode.

    Govnocoder#0xFF, 20 Апреля 2011

    Комментарии (12)
  5. Куча / Говнокод #6421

    +133

    1. 1
    2. 2
    3. 3
    <div class="title green big">
    
    </div>

    HTML. Семантичная семантика такая семантичная.

    Анонимус, 20 Апреля 2011

    Комментарии (78)
  6. C++ / Говнокод #6420

    +170

    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
    int		GetRndWithRnd(int iRnd, int iRndPlusMinus)
    {
    	if(!iRndPlusMinus) return iRnd;
    	switch((Rand())%2)
    	{
    		case 1:
    			// plus
    			return (int)(iRnd+(Rand()%iRndPlusMinus));
    			break;
    		default:
    			// minus
    			return (int)(iRnd-(Rand()%iRndPlusMinus));
    			break;
    	}
    	return 0;
    }

    Чтоб враги не догадались

    ssAVEL, 20 Апреля 2011

    Комментарии (21)
  7. Ruby / Говнокод #6419

    −100

    1. 1
    File.basename(File.basename(name, '.jpg'), '.png')

    Файл либо с расширением .png, либо .jpg

    e2718, 20 Апреля 2011

    Комментарии (4)
  8. Ruby / Говнокод #6418

    −107

    1. 1
    require File.expand_path(File.dirname(__FILE__) + '/../../../../../../usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/sqlite3_adapter.rb')

    e2718, 20 Апреля 2011

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

    +163

    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
    <?
    $cont = file_get_contents("http://www.cbr.ru/scripts/XML_daily.asp");
    $pattern = "/<CharCode>(.*?)<\/CharCode>\s*<Nominal>(.*)<\/Nominal>\s*<Name>(.*)<\/Name>\s*<Value>(.*)<\/Value>/im";
    
    $cnt =  preg_match_all($pattern,$cont,$matches);
    
    if($cnt != FALSE)
    {
      
      $count_currencies = count($matches[1]);
    
      for($i=0;$i<$count_currencies;$i++)
      {
        $curr_abbr = $matches[1][$i];
        $curr_nominal = $matches[2][$i];
        $curr_name = $matches[3][$i];
        $curr_value = $matches[4][$i];
        
        echo "$curr_abbr - $curr_nominal - $curr_name - $curr_value <br>";
      } // for
      
    } // if($cnt != FALSE)
    ?>

    после сдачи сайта разраб CMS спешно уволился.

    RomaShka, 20 Апреля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $sel = '';
    for($i=90;$i<=250;$i++){
     $sel.= "<option value=\"$i\"".(($i==100) ? ' selected' : '').">$i px</option>\n";
     $i = $i + 9;
    }

    Код из Danneo CMS

    skoder, 20 Апреля 2011

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