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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    $_POST['img_src'] = explode("/", "", $_POST['img_src']);
    $_POST['img_src'] = $_POST['img_src'][count($_POST['img_src'])-1];
    $_POST['img_src'] = str_replace("_1", "", $_POST['img_src']);
    $user_file->tmp_insert($_POST['img_src']);

    Магия...

    advvzlol, 16 Декабря 2010

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

    +157

    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
    $query = "SELECT * FROM records WHERE  id_film='$id_film'";        
    $results = mysql_query($query);
    $var1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $var1 = $var1. "<playlist>\n";     
    while($line = mysql_fetch_assoc($results))
      {
    $tmp_us = $tmp_us.$line['id_user'];
      $var1 = $var1."<vid src=\"http://homelinux.com:8080/sample1/content/audiorecord/"
      . $line['id_user']
      ."/"
      . $line["file_name"]
      ."_d.flv"
      . "\" label=\""
      . $line["file_name"]
      ."\""
      ." id_film=\""
      . $line["id_film"]
      ."\""
      ." time_begin=\""
      . $line["time_begin"]
      ."\""
      ." time_end=\""
      . $line["time_end"]
      ."\""
      ." id_user=\""
      . $line["id_user"]
      ."\""  
      ." sh_val=\""
      . $line["sh_val"]
      ."\""
      ." id_record=\""
      . $line["id_record"]
      ."\""
      ."/>\n";
    }
    $var1 = $var1."</playlist>\n"; 
    echo "var1=$var1";

    Вот так некоторые Flash-еры формируют xml пакеты

    Agel_Nash, 16 Декабря 2010

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    function Add($WEB_FORM_ID, $arrVALUES=false, $CHECK_RIGHTS="Y", $USER_ID=false)
    {
    		global ... $_REQUEST, ...;
    ...
    }

    Битрикс

    elw00d, 16 Декабря 2010

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

    +162

    1. 1
    $str = strip_tags(htmlentities($str));

    простовато, но...
    Тэги не пройдут!!!

    fork, 15 Декабря 2010

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

    +158

    1. 1
    2. 2
    3. 3
    $where = "(`user_id` = ".$id." and `user_fr` = ".$user->Get('u_id').") or (`user_id` = ".$user->Get('u_id')." and `user_fr` = ".$id.")";
        
    $inc = array_merge($db->Select('friends', $where), $db->Select('friends_incoming', $where));

    Проверка на существования дружбы или предложений дружбы между двумя пользователями (каунтом $inc).

    Мартин, 15 Декабря 2010

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

    +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
    <?
    	if ($_GET['view'] == 'login') {
    		$_POST[email2] = htmlspecialchars(stripslashes($_POST[email]));
    		$_POST[pass2]  = htmlspecialchars(stripslashes($_POST[pass]));
    		if($_POST['email'] == $_POST['email2'] && $_POST['pass'] == $_POST['pass2']) {
    			if($_POST['email2'] && $_POST['pass2']) {				
    				$result_310 = mysql_query("SELECT * FROM `gameuser` WHERE `emailx` = '$_POST[email2]'");
    				$zapros_310 = mysql_fetch_array($result_310);
    				if($zapros_310['emailx']) {
    					if($zapros_310['passwordx'] != '' && $zapros_310['passwordx'] == md5($_POST['pass2'])) {
    						$ipd1       = $_SERVER["REMOTE_ADDR"];						
    						$result_105 = mysql_query("SELECT * FROM `ipblock` WHERE `ip` = '$ipd1'");
    						$zapros_105 = mysql_fetch_array($result_105);
    						if($zapros_105['id'] == '' && $zapros_105['ip'] != $ipd1) {
    							setcookie("iduser", $zapros_310['id']);
    							setcookie("emailuser", $zapros_310['emailx']);
    							setcookie ("passuser", $zapros_310['passwordx']);
    							
    							if($_COOKIE['code'])
    								if($_COOKIE['code'] != $zapros_310['id'])
    									mysql_query("INSERT INTO `statistic2` (info, date) VALUES ('".$_COOKIE['code']." change on ".$zapros_310['id']."', now());");
    							setcookie("code", $zapros_310['id'], time() + 2419200);
    							
    							$http_host5 = $_SERVER['HTTP_HOST'];
    							if ($http_host5 == 'dreamdivision.ru') {$http_host5 = "www.dreamdvision.ru";}
    							if ($http_host5 == 'dreamdivision.ru')     {$http_host5 = "www.dreamdivision.ru";}
    							if($zapros_310['id'] != '1') {$result_311 = mysql_query("UPDATE `gameuser` SET `ip` = '".$_SERVER["REMOTE_ADDR"]."', `host` = '$http_host5'  WHERE `id` = '$zapros_310[id]' LIMIT 1");}
    							$result_312 = mysql_query("SELECT * FROM `iploguser` WHERE `id` = '$zapros_310[id]'");
    							$zapros_312 = mysql_fetch_array($result_312);
    							if($zapros_312['ip'] != $ipd1) {
    								$result_313 = mysql_query("INSERT INTO `iploguser` ( `ip` , `id` ) VALUES ( '$ipd1', '$zapros_310[id]' );");
    							}
    							if ($zapros_310['tpcht'] == '0') {
    								$href1 = "updates.php";
    							} else if($zapros_310['tpcht'] == '1'){
    								$href1 = "main.php";
    							}
    							header("Location: $href1"); 
    						} else {
    							$smarty->assign('case', '2');
    							$smarty->assign('message', 'Пароль не верный.');
    							$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
    						}
    					} else {
    						$smarty->assign('case', '2');
    						$smarty->assign('message', 'Пароль не верный.');
    						$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
    					}
    				} else {
    					$smarty->assign('case', '2');
    					$smarty->assign('message', 'E-mail не верный.');
    					$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
    				}
    			} else {
    				$smarty->assign('case', '2');
    				$smarty->assign('message', 'Заполните все поля.');
    				$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
    			}
    		} else {
    			$smarty->assign('case', '2');
    			$smarty->assign('message', 'E-mail и/или Пароль содержат недопустимые символы.');
    			$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
    		}
    	}
    $smarty->assign('case', '3');
    $smarty->display("index.tpl",$user_theme_name,$user_theme_name);

    qbasic, 15 Декабря 2010

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    while ($iii<$_POST["nnn"])
    {
    $Klass = takeYearKlass($Klass,$_POST["vipl_".$iii."ygod"]);
    print ("<br>За ".$iii."-й год было ".$_POST["vipl_".$iii."ygod"]." выплат и класс стал ".$Klass);
    $iii++;
    }
    print ("<br><b>Итоговый класс:</b> $Klass");

    В добавок к чудному явасрипту (http://govnokod.ru/4929) мне достался и сам код на php....
    В прочем там такого добра хватает))) можно и html, и css выложить)))
    Как говориться, буду писать еще))

    Zuzzuk, 15 Декабря 2010

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

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    /**
    * custom_field_sort used to sort the custom fields array
    */
    	function custom_field_sort(&$array) {
    		if(!$array) return $keys;
    
    		$keys=func_get_args();
    
    		array_shift($keys);
    		custom_field_sort_func($keys);
    		usort($array, "custom_field_sort_func");
    	}

    Файл тот же что и http://govnokod.ru/4920, просто следующая функция.

    zabuhailo, 15 Декабря 2010

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

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    class C
    {
    ...
    static function ModulesList()
    {
                    global $config;
                    return $config;
    }
    ...
    }

    ООП в действии

    elw00d, 15 Декабря 2010

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

    +36

    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
    //
                  <?php if (arg(0) == 'taxonomy' && arg(1) == 'term') {
                   $term = taxonomy_get_term(arg(2));
                   if ($term->vid == 2) { ?>
                     LCD TV Listings
                   <?php } elseif ($term->vid == 1) { ?>
                     Size LCD TV Listings
                   <?php } elseif ($term->vid == 8) { ?>
                     Questions
                   <?php } elseif ($term->vid == 10) { ?>
                     LCD TV News
                   <?php } elseif ($term->vid == 11) { ?>
                     Related LCD TV News
                   <?php } ?>
               <?php } ?>

    Вот такое прямо в шаблоне.... no comments

    brainstorm, 15 Декабря 2010

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