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

    +160.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $createD = getdate($photki['createD']);
    $mon = '';
    if (strlen($createD['mon']) == 1)
      $mon = '0';
    if (strlen($createD['minutes']) == 1)
      $min = '0';
    $createdate = $createD['mday'] . '/' . $mon . $createD['mon'] . ' ' . $createD['hours'] . ':' . $min . $createD['minutes'];

    Преобразование $photki['createD'] (unixtime) в формат 18/04 20:43

    1ac1324, 18 Апреля 2010

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

    +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
    <?
    $fid = intval(check($_GET['fid']));
    if (empty($_GET['fid']))
    {
    echo "Ошибка!!!"; 
    ;}
    if (eregi("[^0-9]", $fid))
    {
    echo"Попытка взлома!!!";
    echo'<a href="../enter.php?'.$ses.'">Главная</a><br/>';
    ;}
    ?>

    Суровые борцы со взломом...

    Neformat, 18 Апреля 2010

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

    +164.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <?php
    if (isset ($_POST['logform'])) {$logform = $_POST['logform'];} else {$logform = $_POST['logform'];}
    echo $logform;
    
    if (isset ($_POST['pasform'])) {$pasform = $_POST['pasform'];} else {$pasform = $_POST['pasform'];}
    echo $pasform;
    
    ?>

    Контрольный в голову

    MoLe-X, 18 Апреля 2010

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

    +143.8

    1. 1
    foreach ($invoises as $invoiceId => $invoice) {

    Вот так и работаем с инвойсами...

    DiSH, 16 Апреля 2010

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

    +150.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $tttr = rand( 1, 2 );
    if ( $tttr == 1 )
    {
        $bonusik = "&dd=10|";
    }
    if ( $tttr == 2 )
    {
        $bonusik = "&dd=5|dd=5|";
    }

    Random and naming fails.

    Bobby, 16 Апреля 2010

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

    +153.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $db = new PDO("mysql:host=" . $config['dbhost'] . ";dbname=" . $config['dbname'], $config['dbuser'], $config['dbpassword']);
    $db->exec("set names utf8");
    $result = $db->query("call get_user_account('$session_id');");
    foreach ($result as $row)
    {
        die($row['account']);
    }
    die("err");

    Готический output.

    Bobby, 16 Апреля 2010

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

    +163.2

    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
    $t_total_rows = 100;
    		$t_row_ids = array();
    
    		// Check total profile rows.
    		for($i = 1; $i <= $t_total_rows; $i++)
    		{
    				$result = $database -> database_query("SELECT `profilevalue_$i` FROM `se_profilevalues`");
    
    				if($result != FALSE)
    				{
    						$t_row_ids[] = $i;
    				}
    		}

    Нашел еще один кусок кода :)))
    Оригинальный подход для подсчета полей :))

    Rain, 16 Апреля 2010

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

    +172.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
    if ($_POST['action']!=""){
        $action=$_POST['action'];
      } elseif ($_GET['action']!=""){
        $action=$_GET['action']; 
      }
      if ($_POST['pid']!=""){
        $pid=$_POST['pid'];
      } elseif ($_GET['pid']!=""){
        $pid=$_GET['pid']; 
      }
      if ($_POST['page']!=""){
        $page=$_POST['page'];
      } elseif ($_GET['page']!=""){
        $page=$_GET['page']; 
      }
      if ($_POST['cid']!=""){
        $cid=$_POST['cid'];
      } elseif ($_GET['cid']!=""){
        $cid=$_GET['cid']; 
      }
      if ($_POST['num']!=""){
        $num=$_POST['num'];
      } elseif ($_GET['num']!=""){
        $num=$_GET['num']; 
      }

    darkpreacher, 15 Апреля 2010

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

    +152.2

    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
    function ShowMsg($text)
    {
        if(session_is_registered('xynta')) $un = base64_decode(strrev($_SESSION['xynta']));
        else $un = "%USERNAME%";
        $text = str_replace("%%USERNAME%%",$un,$text);
        $text = preg_replace("/\[img\](.+?)\[\/img\]/is","<img src=\"\\1\" />",$text);
        $text = preg_replace("/\[bkb\](.+?)\[\/bkb\]/is","<span class=bkb>\\1</span>",$text);
        $text = preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee>\\1</marquee>",$text);
        $text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","<blockquote>\\1</blockquote>",$text);
        $text = preg_replace("/\[center\](.+?)\[\/center\]/is","<center>\\1</center>",$text);
        $text = preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$text);
        $text = preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$text);
        $text = preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$text);
        $text = preg_replace("/\[s\](.+?)\[\/s\]/is","<s>\\1</s>",$text);
        $text = preg_replace("/\[code\](.+?)\[\/code\]/is","<code>\\1</code>",$text);
        $text = preg_replace("/\[effekt\](.+?)\[\/effekt\]/is","<div style='padding: 20px;display:block;'><span id=effekt name=effekt>\\1</span></div>",$text);
        $text = preg_replace("/\[blink\](.+?)\[\/blink\]/is","<span id=blink name=blink>\\1</span>",$text);
        //    $text = preg_replace("/\[flash\](.+?)\[\/flash\]/is","<embed type='application/x-shockwave-flash' width=640 height=480 src=\\1 />",$text);
        $text = preg_replace_callback("/\[mp3\](.+?)\[\/mp3\]/is","mp3_safe_url",$text);
        $text = preg_replace("/\[bg=(.+?)\](.+?)\[\/bg\]/is","<span style='background:\\1'>\\2</span>", $text);
        $text = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=http://www.dereferer.org/?\\1 target=_blank>\\1</a>", $text);
        if(!strstr($text,"<br")) $text=nl2br($text);
        return $text;
    }

    diio, 15 Апреля 2010

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

    +149.8

    1. 1
    if( preg_match("#list(/$|$)#is", $requestUri) )

    Человек никогда не слышал про квантификаторы в регулярных выражениях.

    anei, 15 Апреля 2010

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