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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    foreach ($_REQUEST as $key => $value)
    		{
    			if (substr($key, 0, strlen("ORDER_PROP_"))=="ORDER_PROP_")
    				$arPropValsTmp[$key] = htmlspecialchars($value);
    		}

    Забавная проверка.. Из битрикса.

    revis0r, 07 Марта 2011

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

    +165

    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
    <?php
    session_start();
    mysql_connect("localhost","root","1234") or die('Problema s podklucheniem');
    mysql_query("SET NAMES 'cp1251'");
    mysql_select_db("test2");
    $qu='select * from Users where login="'.$log.'"';
     $res=mysql_query($qu);
     if(!$res) {echo"AAAAA ebat!!!!!";
         exit();}  
    $user=mysql_fetch_array($res,MYSQL_ASSOC);
     $pas1=md5($pas);
     if ($user['password']!=$pas1) {echo"parol ne tot!!";
         exit();}  
             $s=$user['login'].'|'.$user['password'].'|';
            /*setcookie("use",$s,time()+604800,'/'); 
            $mod=strtok($s, '|');
            echo $mod;
            $mod=strtok('|');
            echo '     '.$mod; */
            $_SESSION['username']=$user['name'];
            $_SESSION['userfname']=$user['fname'];
            echo    $_SESSION['username'].'    '.$_SESSION['userfname'];

    qbasic, 07 Марта 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <? session_start();
      if (isset($_session['username'])) $s=$_session['username'];
         else $s="Beda!!!!" 
    echo $s;
    ?>

    qbasic, 07 Марта 2011

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

    +165

    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
    /*
                    CONNECT
            */
            function connect( $server, $user, $pass )
            {
                    return mysql_connect( $server, $user, $pass );
                    mysql_query("SET NAMES 'utf8'");
            }
     
            /*
                    PCONNECT
            */
            function pconnect( $server, $user, $pass )
            {
                    return mysql_pconnect( $server, $user, $pass );
                    mysql_query("SET NAMES 'utf8'");
            }
     
            /*
                    SELECT DB
            */
            function select_db($database,$link_id)
            {
                    return mysql_select_db($database,$link_id);
                    mysql_query("SET NAMES 'utf8'");
            }

    qbasic, 07 Марта 2011

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

    +158

    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
    function buildKust( $queryId )
    {
        $commentQuery = getElementsBy('queryncomment', 'query', $queryId);
        IF($commentQuery)
         foreach($commentQuery as $key=>$CQ)
          {
           $query = mysql_query("SELECT * FROM comments WHERE lev = 0 AND id = '".$CQ['comment']."' ");
           while($comment = mysql_fetch_array($query))
            $nullLevel[] = $comment; 
          } 
          IF($nullLevel)
         foreach($nullLevel as $key=>$nullComment)
          {
             $nullComment['level'] = 0;
              $brunch[0] = $nullComment;
            $kust[] = getChildren($nullComment,$brunch, 1);
          }      
      return $kust;
    }

    Коменты

    GogaF, 06 Марта 2011

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

    +158

    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
    function make_category_select($name,$selected='',$not='',$additional='')
            {
                    global $udb,$admin,$evoLANG,$cat_cache;
                    
                    $this->parent_name = $this->parent_name != "" ? $this->parent_name : $evoLANG['noparent'];
            
                    if ($this->onlyoptions != 1)
                    {
                            $a .= "<select name=\"".$name."\" ".$additional.">\n";
                    }
                    
                    $a .=  '<option value=""> '.$this->parent_name." </option>\n";
                    
     
                    $a .= $this->make_cat_options('0',$selected,1,$not);
     
                    if ($this->onlyoptions != 1)
                    {
                            $a .= '</select>';
                    }
     
                    return $a;
            }

    qbasic, 06 Марта 2011

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

    +159

    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
    function make_cat_options($pid='0',$selected='',$depth=1,$not='')
    {
    	global $cat_cache,$udb,$database,$admin;
    	if ( !is_array($cat_cache) )
    	{
    		$sql = $udb->query('SELECT * FROM '.$database['cat'].' ORDER BY orders ASC, cid ASC');
    		while ($row = $udb->fetch_array($sql))
    		{
    			$cat_cache[$row['pid']][$row['cid']] = $row;
    		}
    	}
    	$cache = $cat_cache;
    	$xaccess = explode(",",$not);
    	if(!isset($cache[$pid])) return;
    	while (list($parent,$category) = each($cache[$pid]))
    	{
    		if ( $this->cattpl != '' )
    		{
    			$a .= str_replace( 
    				array('{url}','{description}','{name}'),
    				array( 
    						$this->link_cat( $category[$this->sestype_cat()]),
    						$admin->superhtmlentities($category['description']),
    						str_repeat(' ',$depth-1)." ".$category['name']
    					),
    			
    				$this->cattpl );
    		}
    		else
    		{
    			$category['name'] = $this->hsc == 1 ? $admin->superhtmlentities($category['name']) : $category['name'];
    			unset($sel);
    			if ($category['cid'] == $selected)
    			{
    				$sel = 'selected="selected"';
    			}			       
    			if ( !in_array($category['cid'],$xaccess) )
    			{
    				if ( $category['disabled'] != 1 )
    				{
    					$a .= '<option value="'.($this->cat_name == 1 ? $this->link_cat($category[$this->sestype_cat()]) : $category['cid']).'" '.$sel.'>';
    					if ($depth > 1)
    					{ 
    						$a .= str_repeat("-",$depth-1)." ".$category['name']."</option>"."\n";
    					}
    					else
    					{
    						$a .= $category['name']."</option>";
    					}
    				}
    				else
    				{
    					$a .= '<optgroup label="'. str_repeat("-",$depth-1)." ".$category['name'].'">';
    					$closegroup = 1;
    				}
    			}
    		}
    		$a .= $this->make_cat_options($category['cid'],$selected,$depth+1,$not);
    		if ( $closegroup == 1 )
    		{
    			$a .= "</optgroup>\n";
    		}
    	} 
    	$udb->free_result($sql);
    	return $a;
    }

    qbasic, 06 Марта 2011

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

    +159

    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 get_list_templ()
    {
    $list = array();
    $odir = opendir("../templetes");
    while (($rdir = readdir($odir)) != false)
    {
    if ($rdir !== '.' and $rdir !== '..' and !strpos($rdir, '.'))
    {
    echo $rdir.': ';
    $odir2 = opendir("../templetes/$rdir");
    while($rdir2 = readdir($odir2))
    if ($rdir2 !== '.' and $rdir2 != '..' and strpos($rdir2, '.'))
    {
    if ($rdir2 === 'index.php')
    {
    echo $rdir2."<br />";
    } else
    {
    
    echo 'No exits index.php<br />';
    }
    }
    }
    }

    qbasic, 06 Марта 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    <input type="text" name="quantity- <?php echo $row['id']; ?>" size="2" style="text-align:center" value="<?php echo $_SESSION['cart'][$row['id']]['quantity']; ?>" id='inp_<? echo $er;?>' onBlur='calculate(this.value, "<?php echo $row['cena'];?>", "bdo_<? echo $er;?>")'/>
    
    <? 
    if ($_SESSION['cart'][$row['id']]['quantity'] != $_POST['quantity-'.$row['id']]) $_SESSION['cart'][$row['id']]['quantity'] = $_POST['quantity-'.$row['id']];

    qbasic, 06 Марта 2011

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

    +159

    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
    <?
    $xml = xml_parser_create();
    xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE,1);
    xml_parse_into_struct($xml, file_get_contents($url), $el, $fe);
    xml_parser_free($xml);
    
    for($i=0; $i<5; $i++){
       $m = $fe['ITEM'][$i];
       $title = $el[$m+1]['value'];
       $link = $el[$m+2]['value'];
       $time = $el[$m+4]['value'];
       $desc = mb_substr( $el[$m+3]['value'], 0, 80, 'UTF-8');
       echo '<br/><strong>'.$title.'</strong> <br/>['.
        $time.']<br/>'.$desc.'<br/><a href="'.$link.'">читать...</a>';
    }

    qbasic, 06 Марта 2011

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