1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #1305

    +153

    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
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
        <HEAD>
        <title>
        </HEAD>
    <BODY>
    <?php
    include("connect.php");
    /* вводим переменную которая соединяется с бд */
            $db = @mysql_connect ($host, $user, $psw);
            mysql_query($db);
    /* выбираем бд с использованием предыдущей */
    /*переменной для соединения с бд*/
            $sdb = @mysql_select_db("zforum", $db);
    
    /* для наглядности показываем месагу результата выполнения скрипта */
    if(empty($sdb)) { $info=$info.mysql_error();
            };
    $datevar="date()";
    $usrn="select * from users where usrnick='$_POST[nick]'";
    $usrnick=mysql_query($usrn);
    $rows_usrnick=mysql_num_rows($usrnick);
    $usrm="select * from users where usrmail='$_POST[email]'";
    $usrmail=mysql_query($usrm);
    $rows_usrmail=mysql_num_rows($usrmail);
    $ins_new_usr="INSERT INTO users SET usrnick='$_POST[nick]', usrpsw='$_POST[pass]', usrmail='$_POST[email]',usrabout='$_POST[about]',regdate='$datevar'";
    ?>
    <form action=" <?php include("go_reg.php") ?>" method=post target="_self">
    <Table border="5">
    <tr><th COLSPAN=2>Registration form</th></tr>
    <tr><td>Nickname</td><td><input type="text" size=26 name="nick" maxlegth="16" size="16" value=""></td></tr>
    <tr><td>Password</td><td><input type="password" name="pass" size=26 maxlength=24 size="16" value=""></td></tr>
    <tr><td>Password again</td><td><input type="password" name="pass2" size=26 maxlength="24" size="16" value=""></td></tr>
    <tr><td>E-mail</td><td><input type="text" name="email" maxlength="50" size=26 value=""></td></tr>
    <tr><td>About</td><td><textarea name="about" maxlength="100" wrap="virtual" rows=4></textarea></tr>
    <tr><th colspan=2><input type="submit" value="enter"></th></tr>
    <h1> <?php echo("$info$error") ?> </h1>
    </table>
    
    
    2ой файл "go_reg.php"
    
    <?php
    if(isset($_POST[nick]) && isset($_POST[pass]) && isset($_POST[pass2]) && isset($_POST[email]))
       {
    if($rows_usrnick>0) {$error="Такой ник уже занят<BR>";
       }
    if($rows_usrmail>0) {$error="$error На этот е-меил уже зарегистрирован пользователь<BR>";
       }
    if($_POST[pass2]==$_POST[pass]) {;} else {$error="$error Пароль введен не верно<BR>";
    }
    };
    if(!isset($error)) {mysql_query($ins_new_usr);}
    ?>
    </body>

    guest, 01 Июля 2009

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

    +158.8

    1. 1
    $col=array('red','blue','green','black','yellow','magenta','blue','gray','red','blue','green','black','yellow','blue','gray','red','blue','green','black','yellow','blue','gray');

    А какие ты знаешь цвета?

    guest, 30 Июня 2009

    Комментарии (1)
  4. Java / Говнокод #1289

    +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
    /**
    	 * public static final int ARRAY 2003 public static final int BIGINT -5
    	 * public static final int BINARY -2 public static final int BIT -7 public
    	 * static final int BLOB 2004 public static final int BOOLEAN 16 public
    	 * static final int CHAR 1 public static final int CLOB 2005 public static
    	 * final int DATALINK 70 public static final int DATE 91 public static final
    	 * int DECIMAL 3 public static final int DISTINCT 2001 public static final
    	 * int DOUBLE 8 public static final int FLOAT 6 public static final int
    	 * INTEGER 4 public static final int JAVA_OBJECT 2000 public static final
    	 * int LONGVARBINARY -4 public static final int LONGVARCHAR -1 public static
    	 * final int NULL 0 public static final int NUMERIC 2 public static final
    	 * int OTHER 1111 public static final int REAL 7 public static final int REF
    	 * 2006 public static final int SMALLINT 5 public static final int STRUCT
    	 * 2002 public static final int TIME 92 public static final int TIMESTAMP 93
    	 * public static final int TINYINT -6 public static final int VARBINARY -3
    	 * public static final int VARCHAR 12
    	 */
    	public Class getColumnClass(int column) {
                ...
            }

    guest, 30 Июня 2009

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

    +150

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private int style;
    public int Style
    {
       get
       {
          return style;
       }
       {
          Style = value;
       }
    }

    Вечный двигатель!

    guest, 30 Июня 2009

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

    +148

    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
    <?php
    
    class db {
    
    function db_conn ($host,$user,$pass,$db) {
    	if((!$this->link = @mysqli_connect($host,$user,$pass)))
    		{
    		echo "<font color=\"red\">Error:</font> connect to host: $host";
    		exit();
    		}
    	if(!mysqli_select_db($this->link,$db))
    		{
    		echo "<font color=\"red\">Error:</font> select database $db";
    		exit();
    		}
    	}
    
    function sql_query ($query) {
    	$this->link = mysqli_query($this->link, $query);
    		if (!$this->link)
    			{
    			$this->error_msg = mysqli_error ($this->link);
    			return $this->error_msg;
    			}
    	return $this->link;
    	}
    
    function sql_fetch_assoc ($query) {
    		$res=$this->sql_query($query);
    		$array = array();
    		$row = mysqli_fetch_array($res);
    			/*{
    			$array[]=$cur;
    			}*/
    		mysqli_free_result($res);
    		return $row;
    	}
    }
    
    ?>

    guest, 26 Июня 2009

    Комментарии (1)
  7. C# / Говнокод #1260

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    if((5<a).toString() == "true")
    {
    ля-ля
    }

    guest, 26 Июня 2009

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

    +139.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
    unction int2hex($intega){
       $Ziffer = "0123456789ABCDEF";
    return $Ziffer[($intega%256)/16].$Ziffer[$intega%16];
    }
    
    function url_encode($text){
       $text = urlencode($text);
       if(!strpos($text,"%C3"))
           for($i=129;$i<255;$i++){
               $in = "%".int2hex($i);
               $out = "%C3%".int2hex($i-64);
               $text = str_replace($in,$out,$text);
           }
    return $text;
    }
    
    function tounicode ($string){
    $unistring="";
    for($i=0;$i<strlen($string);$i++){
    	$current=$string[$i];
    	$codcurrent=ord($current);
    	if($codcurrent>255):
           		$unicurrent=utf8_encode($current);
    		$unistring=$unistring.$unicurrent;
    	elseif($codcurrent<192):
    		if($codcurrent==184):
                           $unicurrent=chr(209).chr($codcurrent-39);
                           $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==168):
                           $unicurrent=chr(208).chr($codcurrent-39);
                           $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==147):
    				$unicurrent=utf8_encode("\"");
                            $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==148):
    				$unicurrent=utf8_encode("\"");
                            $unistring=$unistring.$unicurrent;
    		elseif($codcurrent==151):
    				$unicurrent=utf8_encode("-");
                            $unistring=$unistring.$unicurrent;
    		
    		else:
                  		$unicurrent=utf8_encode($current);
                   		$unistring=$unistring.$unicurrent;
    		endif;
    	
    	else:
    		if ($codcurrent<240):
    			$unicurrent=chr(208).chr($codcurrent-48);
    			$unistring=$unistring.$unicurrent;
    		else:
    			$unicurrent=chr(209).chr($codcurrent-112);
    			$unistring=$unistring.$unicurrent;
    		endif;
    		
    	endif;
    }
    return $unistring;
    }

    guest, 25 Июня 2009

    Комментарии (1)
  9. JavaScript / Говнокод #1244

    +150.7

    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
    function login() {
    
    
    // Optional: Show a waiting message in the layer with ID ajax_response
    
    	var img_load="<img src=images/wait.gif alt=\"error\" width=\"100\" height=\"100\" /> ";
    	document.getElementById('login_response').innerHTML = img_load;
    	// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
    	var email = encodeURI(document.getElementById('emailLogin').value);
    	var psw = encodeURI(document.getElementById('pswLogin').value);
    	//var rem = encodeURI(document.getElementById('chkrem').value);
    	var rem = document.getElementById('chkrem').checked;
    if(document.getElementById('chkrem').checked==true)
    	{
           rem=1;
    	}
    	else
    if(document.getElementById('chkrem').checked==false)
    	{
              rem=0;
    	}
    	else
    	{
    		rem=0;
    	}
    
    
    		// Set te random number to add to URL request
    		nocache = Math.random();
    		// Pass the login variables like URL variable
    		var act;
    
    		act='login.php?email='+email+'&psw='+psw+'&remchk='+rem+'&nocache='+nocache;
    		//alert(act);
    		http.open('get', 'login.php?email='+email+'&psw='+psw+'&remchk='+rem+'&nocache='+nocache);
    		http.onreadystatechange = loginReply;
    		http.send(null);
    }

    Взято с одного непонятно кем разработанного зарубежного сайта, который (судя по забагованности и унылости) всё никак не может добраться до релиза.

    Код интересен двумя пассажами: строки 13-25 и 33-35

    guest, 24 Июня 2009

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

    +143.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (isset($_COOKIE['wrboardname'])) {
    	$wrboardname=$_COOKIE['wrboardname'];
    }
    
    // если в куках есть wrboardname, то забиваем данные куков в переменные, иначе выводим форму для входа
    if (isset($wrboardname)) {
    	print "<td align=right style='FONT-SIZE: 11px' width=100%><a href='tools.php?event=profile&pname=$wrboardname'>Ваш Профиль</a>&nbsp;&nbsp;<a href='tools.php?event=clearcooke'>Выход [$wrboardname]</a>";
    }

    Показан прекрасный метод, как нужно юзать куки))(wr-board 1.1)

    guest, 19 Июня 2009

    Комментарии (1)
  11. Java / Говнокод #1219

    +148

    1. 1
    2. 2
    3. 3
    IAssignment assignment = serviceCall.getAssignment();
    assignment.setAssWorkgroup(object);
    assignment.transfer();

    Кусок кода с использованием API HP ServiceDesk

    guest, 18 Июня 2009

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