Кресты / Говнокод #1584 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
//...
  string m_str_datum, m_str_zeit;
  m_str_datum.assign(m_str_data , 22 ,  6 ); 
  m_str_zeit.assign(m_str_data , 28 ,  6 );
  m_str_datum = remove_spaces(m_str_datum) ;
  m_str_zeit  = remove_spaces(m_str_zeit);  

  string _str_year;
  string _str_month;
  string _str_day;

  int _n_year;
  int _n_month;
  int _n_day;

  _n_year  = 0;
  _n_month = 0;
  _n_day   = 0;

  _str_day.assign(m_str_datum,0,2);
  _str_month.assign(m_str_datum,2,2);
  _str_year.assign(m_str_datum,4,2);

  sscanf( _str_day.c_str()  , "%d", &_n_day   );
  sscanf( _str_month.c_str(), "%d", &_n_month );
  sscanf( _str_year.c_str() , "%d", &_n_year  );
  if (_n_year > 0 && _n_year < 50)
	_n_year += 2000;
  else if (_n_year >= 50 && _n_year < 100)
	_n_year += 1900;

  //...
  string _str_hours;
  string _str_minutes;
  string _str_seconds;
 
  int _n_hours;
  int _n_minutes;
  int _n_seconds;

  _n_hours   = 0;
  _n_minutes = 0;
  _n_seconds = 0;

  _str_hours.assign(m_str_zeit,0,2);
  _str_minutes.assign(m_str_zeit,2,2);
  _str_seconds.assign(m_str_zeit,4,2);

  sscanf( _str_hours.c_str()   , "%d", &_n_hours    );
  sscanf( _str_minutes.c_str() , "%d", &_n_minutes  );
  sscanf( _str_seconds.c_str() , "%d", &_n_seconds  );

  DateTime _obj_start_time;

  try {
	_obj_start_time = DateTime(_n_year,  _n_month,   _n_day, _n_hours, _n_minutes, _n_seconds);
  }
//...

Парсим дату ddmmyyhhnnss не по-детски. Код функции которая обрабатывает несколько сотен тысяч строк.

lamer lamer, (Updated )

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

mysql_real_escape_string / Говнокод #1583 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
SELECT DISTINCT B.TYPE_SID, B.ID BANNER_ID, B.WEIGHT BANNER_WEIGHT,
B.SHOWS_FOR_VISITOR, B.FIX_CLICK, B.FIX_SHOW, B.KEYWORDS BANNER_KEYWORDS,
C.ID CONTRACT_ID, C.WEIGHT CONTRACT_WEIGHT, C.KEYWORDS CONTRACT_KEYWORDS
FROM b_adv_type T
INNER JOIN b_adv_banner B ON ( B.ACTIVE='Y' and B.TYPE_SID = T.SID
and B.STATUS_SID = 'PUBLISHED'
and (B.FOR_NEW_GUEST is null or B.FOR_NEW_GUEST='N')
and (ifnull(B.MAX_SHOW_COUNT,0)>ifnull(B.SHOW_COUNT,0)
or ifnull(B.MAX_SHOW_COUNT,0)=0) and (ifnull(B.MAX_CLICK_COUNT,0)>ifnull(B.CLICK_COUNT,0)
or ifnull(B.MAX_CLICK_COUNT,0)=0) and (ifnull(B.MAX_VISITOR_COUNT,0)>ifnull(B.VISITOR_COUNT,0)
or ifnull(B.MAX_VISITOR_COUNT,0)=0) and (B.DATE_SHOW_FROM<=now() or B.DATE_SHOW_
FROM is null or length(B.DATE_SHOW_FROM)<=0) and (B.DATE_SHOW_TO>=now()
or B.DATE_SHOW_TO is null or length(B.DATE_SHOW_TO)<=0))
INNER JOIN b_adv_banner_2_site BS ON ( BS.BANNER_ID = B.ID and BS.SITE_ID = 'ru')
INNER JOIN b_adv_contract C ON ( C.ID = B.CONTRACT_ID and C.ACTIVE='Y'
and (ifnull(C.MAX_SHOW_COUNT,0)>ifnull(C.SHOW_COUNT,0)
or ifnull(C.MAX_SHOW_COUNT,0)=0) and (ifnull(C.MAX_CLICK_COUNT,0)>ifnull(C.CLICK_COUNT,0)
or ifnull(C.MAX_CLICK_COUNT,0)=0)  and (ifnull(C.MAX_VISITOR_COUNT,0)>ifnull(C.VISITOR_COUNT,0)
or ifnull(C.MAX_VISITOR_COUNT,0)=0) and (C.DATE_SHOW_FROM<=now() or C.DATE_SHOW_
FROM is null or length(C.DATE_SHOW_FROM)<=0) and (C.DATE_SHOW_TO>=now() or C.DATE_SHOW_TO is null
or length(C.DATE_SHOW_TO)<=0))
INNER JOIN b_adv_contract_2_site CS ON ( CS.CONTRACT_ID = B.CONTRACT_ID and CS.SITE_ID = 'ru')
INNER JOIN b_adv_contract_2_type CT ON ( CT.CONTRACT_ID = C.ID
and (CT.TYPE_SID = 'ALL' or CT.TYPE_SID = T.SID))
INNER JOIN b_adv_banner_2_weekday BW ON ( BW.BANNER_ID = B.ID
and BW.C_WEEKDAY='SUNDAY' and BW.C_HOUR = '11')
INNER JOIN b_adv_contract_2_weekday CW ON ( CW.CONTRACT_ID = C.ID
and CW.C_WEEKDAY='SUNDAY' and CW.C_HOUR = '11')
LEFT JOIN b_adv_banner_2_group UG1 ON ( (UG1.BANNER_ID = B.ID and UG1.GROUP_ID in (2,1,21)) )
LEFT JOIN b_adv_banner_2_page BP1 ON ( BP1.BANNER_ID = B.ID and BP1.SHOW_ON_PAGE='Y')
LEFT JOIN b_adv_banner_2_page BP2 ON ( BP2.BANNER_ID = B.ID and BP2.SHOW_ON_PAGE='N'
and '/e-store/books/index.php?SECTION_ID=145' like concat(BP2.PAGE, '%'))
LEFT JOIN b_adv_contract_2_page CP1 ON ( CP1.CONTRACT_ID = C.ID and CP1.SHOW_ON_PAGE='Y')
LEFT JOIN b_adv_contract_2_page CP2 ON ( CP2.CONTRACT_ID = C.ID and CP2.SHOW_ON_PAGE='N'
and '/e-store/books/index.php?SECTION_ID=145' like concat(CP2.PAGE, '%'))
LEFT JOIN b_adv_banner_2_stat_adv BA ON BA.BANNER_ID = B.ID
LEFT JOIN b_adv_banner_2_country BC ON BC.BANNER_ID = B.ID WHERE T.ACTIVE = 'Y'
and BP2.ID is null and CP2.ID is null
and (BP1.ID is null or '/e-store/books/index.php?SECTION_ID=145' like concat(BP1.PAGE, '%'))
and (CP1.ID is null or '/e-store/books/index.php?SECTION_ID=145' like concat(CP1.PAGE, '%'))
and (BA.STAT_ADV_ID is null or BA.STAT_ADV_ID='0')
and (BC.COUNTRY_ID is null or BC.COUNTRY_ID='N0')
and ( (B.SHOW_USER_GROUP = 'Y' and UG1.GROUP_ID is not null)
or (B.SHOW_USER_GROUP <> 'Y' and UG1.GROUP_ID is null))
ORDER BY B.TYPE_SID desc, C.ID desc

SQL-запрос из Битрикса

http://ekimoff.ru/165/

endo endo, (Updated )

Комментарии (9, +9)

"PHP" / Говнокод #1581 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
<?
$i=$var = null;

function NullPointerShare(&$vv)
{

for (;;)
{
    $i=$vv;
$i++;


    if ($i==20)
    {
        $i=null;
            die (NullPointerShare($i));

    }else if ($i<20){
$ix=19;
 die (NullPointerShare($ix));
	}
}
return $vv;

}

die ("--> ".NullPointerShare($var));
?>

Без коментов:)

notrade notrade, (Updated )

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

"PHP" / Говнокод #1579 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
<?php
// AI для jabber-бота http://coolbot.vndv.com
// Автор AI: Black.ZerO
$db = mysql_connect($dbhost, $dbuser, $dbpasswd) or die("MySQL error");
	mysql_select_db($dbname, $db);
 
	$result = mysql_query("select * from mozg", $db);
	$myrow = mysql_fetch_array($result);
 
 
	$messages['body'] = "Hello";
	do 
	{
	if ($messages['body'] == $myrow[question])
	{
		echo "OK";
		break;
		}
			else {
				echo "false";
		}
 
	}
	while ($myrow = mysql_fetch_array($result));

AI для jabber-бота http://coolbot.vndv.com

sviver88 sviver88, (Updated )

Комментарии (5, +5)

"PHP" / Говнокод #1578 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
$cnt_ = count($array_objects['rate']);

for($i=0; $i<$cnt_; $i++) {
  //...
}

$DB->query('REPAIR TABLE `' . $rates_table . '` QUICK;');

Кусок скрипта для импорта данных из XML...

Eisenhorn Eisenhorn, (Updated )

Комментарии (11, +11)

"PHP" / Говнокод #1576 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
// phpBB 3.0.x auto-generated configuration file
// Do not change anything in this file!
include_once dirname(dirname (dirname (__FILE__)))."/conf/config.php";

Мегакод

meniam meniam, (Updated )

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

Школоло / Говнокод #1575 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
Module MyChrModule
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    '49 to 57 Chr , 32 space
    Public Function Mychr(ByVal ChrNumber As Long) As String
        If ChrNumber = 1 Then Mychr = "[LMB]"
        If ChrNumber = 2 Then Mychr = "[RMB]"
        If ChrNumber = 4 Then Mychr = "[MMB]" ' MouseMiddleButton ( Scroll button )
        If ChrNumber = 9 Then Mychr = "[Tab]"
        If ChrNumber = 20 Then Mychr = "[CapsLock]"
        If ChrNumber = 160 Then Mychr = "[LeftShift]"
        If ChrNumber = 162 Then Mychr = "[LeftCtrl]"
        If ChrNumber = 192 Then Mychr = "`"
        If ChrNumber = 112 Then Mychr = "[F1]" '112 to 123
        If ChrNumber = 113 Then Mychr = "[F2]"
        If ChrNumber = 114 Then Mychr = "[F3]"
        If ChrNumber = 115 Then Mychr = "[F4]"
        If ChrNumber = 116 Then Mychr = "[F5]"
        If ChrNumber = 117 Then Mychr = "[F6]"
        If ChrNumber = 118 Then Mychr = "[F7]"
        If ChrNumber = 119 Then Mychr = "[F8]"
        If ChrNumber = 120 Then Mychr = "[F9]"
        If ChrNumber = 121 Then Mychr = "[F10]"
        If ChrNumber = 122 Then Mychr = "[F11]"
        If ChrNumber = 123 Then Mychr = "[F12]"
        If ChrNumber = 189 Then Mychr = "-"
        If ChrNumber = 187 Then Mychr = "="
        If ChrNumber = 220 Then Mychr = "\"
        If ChrNumber = 219 Then Mychr = "["
        If ChrNumber = 221 Then Mychr = "]"
        If ChrNumber = 186 Then Mychr = ";"
        If ChrNumber = 220 Then Mychr = "\"
        If ChrNumber = 222 Then Mychr = "'"
        If ChrNumber = 188 Then Mychr = ","
        If ChrNumber = 190 Then Mychr = "."
        If ChrNumber = 191 Then Mychr = "/"
        If ChrNumber = 8 Then Mychr = "[BckSpc]"
        If ChrNumber = 123 Then Mychr = "[F12]"
        If ChrNumber = 13 Then Mychr = "[Enter]"
        If ChrNumber = 161 Then Mychr = "[RightShift]"
        If ChrNumber = 91 Then Mychr = "[LeftLogo]"
        If ChrNumber = 92 Then Mychr = "[RightLogo]"
        If ChrNumber = 93 Then Mychr = "[RMB Key]"
        If ChrNumber = 163 Then Mychr = "[RightCtrl]"
        If ChrNumber = 164 Then Mychr = "[LeftAlt]"
        If ChrNumber = 165 Then Mychr = "[RightAlt]"
        If ChrNumber = 44 Then Mychr = "[Print]"
        If ChrNumber = 19 Then Mychr = "[Pause]"
        If ChrNumber = 45 Then Mychr = "[Insert]"
        If ChrNumber = 36 Then Mychr = "[Home]"
        If ChrNumber = 33 Then Mychr = "[PageUp]"
        If ChrNumber = 46 Then Mychr = "[Delete]"
        If ChrNumber = 35 Then Mychr = "[End]"
        If ChrNumber = 34 Then Mychr = "[PageDown]"
        If ChrNumber = 37 Then Mychr = "[Left]"
        If ChrNumber = 38 Then Mychr = "[Up]"
        If ChrNumber = 39 Then Mychr = "[Right]"
        If ChrNumber = 40 Then Mychr = "[Down]"
        If ChrNumber = 144 Then Mychr = "[NumLock]"
'...

Один из модулей кейлогера...

psina-from-ua psina-from-ua, (Updated )

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