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

    +167

    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
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    $resultat = mysql_query("SELECT * FROM tovar WHERE t_akcia='1' ");
    $myrowat = mysql_fetch_array($resultat);
    if (isset($myrowat[t_name])){$rstt=$myrowat[t_name]; if ($rstt==''){unset($rstt);}}
    if (isset($rstt)){
    $ft=0;
    do 
    {
    $t_namet=$myrowat[t_name];
    if ($t_namet==''){unset($t_namet);} 
    if (isset($t_namet)){ $ft=$ft+1; } 
    }
    while ($myrowat = mysql_fetch_array($resultat));
    $vidt=rand(1,$ft);
    $vidst=$vidt-1;
    $resultact = mysql_query("SELECT * FROM tovar WHERE t_akcia='1' LIMIT $vidst,1 ");
    $myrowact = mysql_fetch_array($resultact);
    print<<<HERE
    <div style="margin-top:11px;">
    <table width="182" border="0" cellspacing="0" cellpadding="0">
    <tr><td height="29" align="center" valign="middle" bgcolor="#fe0000"><div class="tit_block"><a class="tit_block" href="akcia.php">ÀÊÖÈÈ</a></div></td></tr>
    <tr><td>
    <div style="margin-top:11px; margin-bottom:11px;">
      <table width="182" border="0" cellspacing="0" cellpadding="0" style="background-image:url(../img/block_center.jpg); background-position:center; background-repeat:repeat-y;">
       <tr>
       <td>
       <img src="../img/block_top.jpg" align="top" border='0' />
    <div style="margin-top:11px; margin-bottom:11px;">   
    HERE;
    if (isset($myrowact[t_name]))
    {
    $t_namet=$myrowact[t_name];
    $t_fotot=$myrowact[t_foto];
    $t_pricet=$myrowact[t_price];
    $t_old_rpicet=$myrowact[t_old_rpice];
    $t_idt=$myrowact[t_id];
    $t_valutt=$myrowact[t_valut];
    if (isset($t_valutt)){
    $resultvt = mysql_query("SELECT * FROM valut WHERE v_id='$t_valutt' ");
    $myrowvt = mysql_fetch_array($resultvt);
    $valutt=$myrowvt[v_name];
    $kurst=$myrowvt[v_kurs];
    $v_znakt=$myrowvt[v_znak];
    $t_pricet=ceil($t_pricet*$kurst);
    $t_old_rpicet=ceil($t_old_rpicet*$kurst); 
    }
    if ($t_namet==''){unset($t_namet);}
    if (isset($t_namet))
    {
    $size_imgt=imagecreatefromjpeg("img_tovar/$t_fotot");
    $w_srct = imagesx($size_imgt);
    $h_srct = imagesy($size_imgt);
    if ($w_srct > $h_srct){$widtht=120; $heightt='';}else{$widtht=''; $heightt=120;} 
    print<<<HERE
    <table width='182' border='0' cellspacing='0' cellpadding='0'>
    <tr><td><div class='block_left' style='margin-left:2px; margin-right:2px;'>
    <a class='text' style='text-decoration:none;' href='tovar.php?t_id=$t_idt'>
    HERE;
    if ($heightt > $widtht){echo"<img src='img_tovar/$t_fotot' height='$heightt' hspace='5' vspace='5' align='middle' border='0' />";}
    if ($widtht > $heightt){echo"<img src='img_tovar/$t_fotot' width='$widtht' hspace='5' vspace='5' align='middle' border='0' />";}
    print<<<HERE
    <br><br><strong>$t_namet</strong><br><br>
    <div style='text-align:center' class='price' style='margin-top:15px; margin-bottom:15px;'><span class='old_price'>$t_old_rpicet</span>$t_pricet<span class='valut'>ãðí</span></div></a><br>
    <a href='buy.php?t_id=$t_idt' title='$t_namet'><img src='../img/kypit.jpg' alt='$t_titlet' border='0' /></a><br>
    <div>
    </td></tr>
    </table>
    HERE;
    }
    }
    print<<<HERE
    </div>   
       <img src="../img/block_down.jpg" align="bottom" border='0' />
       </td>
       </tr>
    </table>
    </div>
    </td>
    </tr>
    </table>
    </div>
    HERE;
    }

    Хотел накласть только кусочек, но оно всё такое вкусное :)
    Показывает 1 рандомный товар

    proglammer, 27 Августа 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    function prepare_graph_query($query, $date_column, $date_format="%b %d") {
    	$date_format = empty($date_format) ? "%Y %b" : $date_format;
    	//...
    }

    Lowezar, 26 Августа 2011

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

    +167

    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
    class xsspolice 
    { 
    function getip() { 
    $ipno = getenv("REMOTE_ADDR");  
    return $ipno; 
    } 
    function look_data($data) { 
    $ip=$this->getip(); 
    $data = strtolower($data); 
    $br=$_SERVER['HTTP_USER_AGENT']; 
    $datenow=date("y-m-d h:m:s"); 
    if(isset($_SESSION['user'])) { 
    $username=$_SESSION['user']; 
    }else { 
    $username="unknown"; 
    } 
    if (strstr($data,"<") OR strstr($data,">") OR strstr($data,"(") OR strstr($data,")") OR 
    strstr($data,"..") OR 
    strstr($data,"%") OR 
    strstr($data,"*") OR 
    strstr($data,"+") OR 
    strstr($data,"!") OR 
    strstr($data,"@")) { 
    $this->validate_befor(); 
    $dirtystuff = array("\"", "\\", "/", "*", "'", "=", "- 
    ", "#", ";", "<", ">", "+", "%","(",")","}","{"); 
    $data = str_replace($dirtystuff, "", $data); 
    $data = htmlspecialchars($data); 
    $data = strip_tags($data); 
    $sql="INSERT INTO `attack` (`attacker_id`, `attacker_ip`, `attacker_username`, `attacker_date`, `attacker_comname`, `attacker_browsername`) VALUES (NULL, '".$ip."', '".$username."', '".$datenow."', 'test', '".$br."')";
    mysql_query($sql)or die("ٍError message"); 
    return $data; 
    }else 
    { 
    return $data; 
    } 
    } 
    function validate_befor() { 
    $ip=$this->getip(); 
    $sql="SELECT COUNT(`attacker_id`) FROM `attack` WHERE `attacker_ip`='".$ip."'"; 
    $sql=mysql_query($sql); 
    $sql=mysql_fetch_row($sql); 
    if ($sql[0]>=3) { 
    header("location: police.htm"); 
    } 
    } 
    } 
    ?>

    По ходу у Попова учился...
    Доставляет всё(к die() уже прувык...), но строка 26-29 О_о
    Это мания ???
    [url]http://www.phpclasses.org/package/7110-PHP-Block-accesses-attempting-to-perform-XSS-attacks.html[/url]

    AlexanderC, 26 Августа 2011

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

    +161

    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
    <?php
    
    header('content-type: application/x-javascript; charset=windows-1251');
    
    function utf8win1251($s){
      $out=""; $c1=""; $byte2=false;
      for ($c=0;$c<strlen($s);$c++){
        $i=ord($s[$c]); if ($i<=127) $out.=$s[$c];
        if ($byte2) { $new_c2=($c1&3)*64+($i&63); $new_c1=($c1>>2)&5;
          $new_i=$new_c1*256+$new_c2;
          if ($new_i==1025) $out_i=168; else
          if ($new_i==1105) $out_i=184; else $out_i=$new_i-848;
          $out.=chr($out_i); $byte2=false; }
        if (($i>>5)==6) {$c1=$i;$byte2=true; } }
     return $out; }
    
     
    $src = file_get_contents("http://letopisi.ru/index.php/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%97%D0%BD%D0%B0%D0%B5%D1%82%D0%B5_%D0%BB%D0%B8_%D0%B2%D1%8B");
    
     $tmp = preg_replace('/.*<ul><li>(.*)<\/ul>.*<div class="printfooter">.*/s', '$1', $src);
     $tmp = trim(preg_replace('/href="/', 'href="http://letopisi.ru', $tmp));
     $matches = explode('</li>', $tmp);
    
     if (sizeof($matches) > 1) {
       $trans = Array("\x0D" => "", "\x0A" => " ");
       do { 
         $quote = trim($matches[rand(0, sizeof($matches)-2)]); 
       } while (empty($quote));
       $quote = str_replace('<li>', '', utf8win1251(strtr($quote, $trans)));
       $quote = preg_replace('/<div class="thumb.*<\/div>/', '', $quote);
       $quote = str_replace('"', '\"', $quote);
       print 'document.write("' . $quote . '");';
     }
    
     ?>

    Аа, блин, надо было сразу все кидать.
    Нужна возможность удалять свои коды в течение 10 минут.

    7ion, 25 Августа 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?php
    
    header('content-type: application/x-javascript; charset=windows-1251');
    
    // Здесь сам скрипт
    
     print 'document.write("' . $quote . '");';
    
     ?>

    А вот до такого еще додуматься надо.
    http://letopisi.ru/index.php/Знаете-ли-что%3F_скрипт

    7ion, 25 Августа 2011

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

    +157

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function utf8win1251($s){
      $out=""; $c1=""; $byte2=false;
      for ($c=0;$c<strlen($s);$c++){
        $i=ord($s[$c]); if ($i<=127) $out.=$s[$c];
        if ($byte2) { $new_c2=($c1&3)*64+($i&63); $new_c1=($c1>>2)&5;
          $new_i=$new_c1*256+$new_c2;
          if ($new_i==1025) $out_i=168; else
          if ($new_i==1105) $out_i=184; else $out_i=$new_i-848;
          $out.=chr($out_i); $byte2=false; }
        if (($i>>5)==6) {$c1=$i;$byte2=true; } }
     return $out; }

    Я ничо не понял, но это круто.

    http://letopisi.ru/index.php/Знаете-ли-что%3F_скрипт

    7ion, 25 Августа 2011

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

    +147

    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
    $prim = mysql_result($result,$i,"prim");
    $gruz = mysql_result($result,$i,"gruz");
    $kuzov = mysql_result($result,$i,"kuzov");
    $o_strana = mysql_result($result,$i,"o_strana");
    $o_gorod = mysql_result($result,$i,"o_gorod");
    $k_strana = mysql_result($result,$i,"k_strana");
    $k_gorod = mysql_result($result,$i,"k_gorod");
    $stavka = mysql_result($result,$i,"stavka");
    $data = mysql_result($result,$i,"data");
    $m3 = mysql_result($result,$i,"m3");
    $ves = mysql_result($result,$i,"ves");
    $valuta = mysql_result($result,$i,"valuta");
    $firstname = mysql_result($result,$i,"firstname");
    $lastname = mysql_result($result,$i,"lastname");
    $middlename = mysql_result($result,$i,"middlename");
    $phone = mysql_result($result,$i,"phone");
    $cb_icq = mysql_result($result,$i,"cb_icq");
    $cb_skype = mysql_result($result,$i,"cb_skype");
    $cb_company = mysql_result($result,$i,"cb_company");
    $cb_org = mysql_result($result,$i,"cb_org");
    $cb_profession = mysql_result($result,$i,"cb_profession");

    пробуем сервер баз данных на выносливость...

    Sulik78, 25 Августа 2011

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

    +174

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ($_SESSION['free'] <= 0) {
         if ($_SESSION['free'] > 0) {
              $_SESSION['free'] --;
         }
    }

    Нашел в один из онлине казино.

    webenter, 25 Августа 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if($_SESSION['use_test_xml'] && false) {
    		if(!responseTestXml('chekin_'.$_GET['userid'].'_'.( ($_GET['placeid']) ? $_GET['placeid'] : $_GET['eventid'] ).'.xml')) {
    			responseTestXml('err.xml',array('message'=>'Unxpected situation. Please use these users: 12345,54321 and places|events: 1-9.'));
    		}
    	} else {
    ...

    плеать...

    realsugar, 24 Августа 2011

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

    +161

    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
    /**
     * @param array $config
     * @return App_Ldap
     */
    private final function __construct(array $config)
    {
    
        if (!empty($config['host'])) {
            $this->_host = $config['host'];
    
            $dnTemp = explode('.', $this->_host);
            $dnTemp = array_map(function($value)
                {
                    return 'dc=' . $value;
                }, $dnTemp);
    
            $this->_dn = implode(',', $dnTemp);
        } else {
            throw new Exception('I need LDAP host');
        }
    
        if (!empty($config['user'])) {
            $this->_user = $config['user'];
        } else {
            throw new Exception('I need LDAP login');
        }
    
        if (!empty($config['pass'])) {
            $this->_pass = $config['pass'];
        } else {
            throw new Exception('I need LDAP pass');
        }
    
        return $this;
    }

    ykhrustalev, 24 Августа 2011

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