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

    +141.9

    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
    $month=$_POST["month"];
    $year=$_POST["year"];
    $week=$_POST["week"];
    $month_c=$month;
    switch($month_c){
    	case 1:
    	case 3:
    	case 5:
    	case 7:
    	case 8:
    	case 10:
    	case 12:
    		$c=31;
    		break;
    	case 2:
    		if (checkdate(2, 29,$year)) {
    			$c=29;
    		}else{
    			$c=28;}
    		break;
    	case 4:
    	case 6:
    	case 9:
    	case 11:
    	       $c=30;
    	       break;
    } // switch

    guest, 11 Июня 2009

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

    +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
    Html:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
     <head>
      <title>I LOVE ZEND FRAMEWORK!</title>  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  <link href="/zend/public/design/css/style.css" media="screen" rel="stylesheet" type="text/css" />  <link href="/zend/public/design/css/style.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/zend/public/design/css/teststyle.css" media="screen" rel="stylesheet" type="text/css" /></head>
    <body>
    
    PHP:
    
    <?php echo $this->doctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL); ?>
    <html>
     <head>
      <?php echo $this->headTitle('I LOVE ZEND FRAMEWORK!'); ?>
      <?php echo $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); ?>
      <?php echo $this->headLink()->appendStylesheet($this->baseUrl . 'design/css/style.css'); ?>
      <?php echo $this->headLink()->appendStylesheet($this->baseUrl . 'design/css/teststyle.css'); ?>
    </head>

    guest, 11 Июня 2009

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

    +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
    $answer = "";
    $word_arr = split (" ", $text);
    $rn = mt_rand(1,sizeof($word_arr))-1;
    $word = $word_arr[$rn];echo $rn." ";echo $word."_<br>";
    $i=1;
    $r = mt_rand(6,12);
    echo "r=".$r."<br>";
    while ($i < $r) :
      $result = mysql_query("SELECT * FROM suffixes WHERE (`prfx`='$word');");
      $j = 0;
      while ($j < mysql_numrows($result)) :
      $sffxs = mysql_result($result, $j, 'sffxs');
      $j++;
      endwhile;

    Сам не понял, что написал... =\

    guest, 10 Июня 2009

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

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    for ($i = 1; $i <= $num_pages; $i++) {
                        echo "<a href=index.php?page=$i>$i</a>";
                        echo " | "; 
                    }

    guest, 09 Июня 2009

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

    +152

    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
    if (@$_GET['sortid']=="asc") { $sortus="ORDER BY id ASC"; $urlsortid="desc"; }
     elseif (@$_GET['sortid']=="desc") { $sortus="ORDER BY id DESC"; $urlsortid="asc"; }	
     else { $urlsortid="desc"; }
     
     if (@$_GET['sortdatereg']=="asc") { $sortus="ORDER BY date_reg ASC"; $urlsortdatreg="desc"; }
    elseif (@$_GET['sortdatereg']=="desc"){ $sortus="ORDER BY date_reg DESC"; $urlsortdatreg="asc"; }
    else { $urlsortdatreg="asc";}
    
    
     if (@$_GET['sortmail']=="asc") { $sortus="ORDER BY email ASC"; $urlsortmail="desc"; }
    elseif (@$_GET['sortmail']=="desc"){ $sortus="ORDER BY email DESC"; $urlsortmail="asc"; }
     else { $urlsortmail="asc"; }
     
     if (@$_GET['sortname']=="asc") { $sortus="ORDER BY username ASC"; $urlsortname="desc"; }
    elseif (@$_GET['sortname']=="desc"){ $sortus="ORDER BY username DESC"; $urlsortname="asc"; }
     else { $urlsortname="asc"; }
     
      if (@$_GET['sortip']=="asc") { $sortus="ORDER BY reg_ip ASC"; $urlsortip="desc"; }
    elseif (@$_GET['sortip']=="desc"){ $sortus="ORDER BY reg_ip DESC"; $urlsortip="asc"; }
     else { $urlsortip="asc"; }

    guest, 09 Июня 2009

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

    +144

    1. 1
    <?php /* "Just what do you think you're doing Dave?" */ ?>

    Не говнокод, просто нашел в коде Wordpress :)

    guest, 08 Июня 2009

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

    +92.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    function atack_is_true(){
    // функция защиты от хакерских атак
    echo "AХТУНГ";
    // блокируем нарушителя
    while(1){}

    Нечто подобное видел в самописной "луТшей CMS в мире", с портфелем разрабов на фрихосте,с дизайном от монстров и ифреймом. Они её денег хотели))))

    guest, 08 Июня 2009

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

    +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
    <?php
    
    class Template {
    
    private $name='';
    
    function __construct() {
    	if(isset($_POST['name'])){
    	$this->name = $_POST['name'];
    	}
    }
    
    function __destruct(){
    echo "<center>конец</center>";
    }
    /*function get_name(){
    	if ( isset($_POST['name']) && (sizeof($_POST['name'])!=0 )) {
    		$this->name = $_POST['name'];
    		return true;
    	} else {
    	return false;
    	}
    } */
    
    
    function render() {
    if ($this->name != ''){
    	echo '
    	<form action="./index.php" method="post">
    	Введите имя:<input type="edit" name="name" size="20">
    	<input type="submit" name="addbutton" value="Отправить данные">
    	</form>';}
    	else {
    	echo "<center>$this->name<center>";
    	}
    }	
    };
    ?>

    guest, 08 Июня 2009

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

    +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
    <?php
    
    class Template {
    
    private $name;
    
    function __construct() {
    $this->name = $_POST['name'];
    }
    
    /*function get_name(){
    	if ( isset($_POST['name']) && (sizeof($_POST['name'])!=0 )) {
    		$this->name = $_POST['name'];
    		return true;
    	} else {
    	return false;
    	}
    } */
    
    
    function render() {
    if ($this->name == ''){
    	echo '
    	<form action="./index.php" method="post">
    	Введите имя:<input type="edit" name="name" size="20">
    	<input type="submit" name="addbutton" value="Отправить данные">
    	</form>';}
    	else {
    	echo "<center>this->$name<center>";
    	}
    }	
    };
    ?>

    отакой клас

    guest, 08 Июня 2009

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

    +133.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    function address_addvar($vn,$v) {
    /** \brief добавит переменную или изменит ее в адресной строке
        \arg \c $vn имя переменной которую надо добавить или изменить
        \arg \c $vn имя значение передаваемой переменной
        \return сформированный линк для вставки в <a href после ? */
        foreach ($_GET as $ELNAME=>$EL) {
            if ($ELNAME==$vn) {$EL=$v;$found=true;}
            $T=$T.$ELNAME."=".$EL."&";
        }
        if ($found==false) {$T=$T.$vn."=".$v;}
        return $T;
    }

    guest, 07 Июня 2009

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