1. Лучший говнокод

    В номинации:
    За время:
  2. JavaScript / Говнокод #19755

    +7

    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
    function random(min, max){  return Math.floor(Math.random() * (max - min + 1)) + min; }
    function go_to(url) {	window.open(url); }
    function rand_link() {
    	var a;
    	a = random(1, 116);
    	if (a==1) {alert("Найди где в числе Пи находится твой день рождения"); go_to("http://mypiday.com");}
    	if (a==2) {alert("Кубик рубика онлайн"); go_to("http://iamthecu.be");}
    	if (a==3) {alert("Симулятор гравитации"); go_to("http://codepen.io/akm2/full/rHIsa");}
    	if (a==4) {alert("и˜нформационно-развлекательное сообщество, весь контент которого создают пользователи. "); go_to("http://pikabu.ru");}
    	if (a==5) {alert("Управляй червяком"); go_to("http://www.staggeringbeauty.com");}
    	if (a==7) {alert("Насколько распространена твоя фамилия?"); go_to("http://forebears.io/surnames");}
    	if (a==8) {alert("и˜нтерактивное послание Дай пять! и не только"); go_to("http://sendamessage.to");}
    	if (a==8) {alert("Уничтожайте будильники различными способами"); go_to("http://www.nomoresnooze.com");}
    	if (a==10) {alert("Карты google + Lego"); go_to("https://www.buildwithchrome.com");}
    	if (a==11) {alert("Фотографии разных мест на земле. Надо угадать где это было снято."); go_to("http://www.where-is-this.com");}
    	if (a==12) {alert("Лайфхаки на все случаи жизни"); go_to("http://www.instructables.com");}
    	if (a==13) {alert("Cтарые иностранные и советские игры"); go_to("http://pica-pic.com/");}
    	if (a==14) {alert("наведи курсор на портрет и человек закричит"); go_to("http://loudportraits.com");}
    	if (a==15) {alert("онлайн-часы"); go_to("http://www.humanclock.com");}
    	if (a==16) {alert("онлайн календарь"); go_to("http://www.humancalendar.com");}
    	if (a==17) {alert("сделайте всё хорошо"); go_to("http://button.dekel.ru");}
    	if (a==18) {alert("2 минуты расслабления"); go_to("http://www.donothingfor2minutes.com/");}
    	if (a==19) {alert("вы *ни˜ХУЯ не делаете!"); go_to("http://manyahin.ru");}
    	if (a==20) {alert("гугл наоборот"); go_to("http://elgoog.im");}
    	if (a==21) {alert("захлопни дверь"); go_to("http://www.biglongnow.com");}
    	if (a==22) {alert("дайте денег"); go_to("http://www.daitedeneg.ru/");}
    	if (a==23) {alert("Два.ч - это система форумов, где можно общаться быстро и свободно"); go_to("https://2ch.hk");}
    	if (a==24) {alert("Зря Яндекс"); go_to("http://zryandex.ru");}
    	if (a==25) {alert("расщепляй круги до бесконечности"); go_to("http://www.cesmes.fi/pallo.swf");}
    	if (a==26) {alert("преврати свое имя в лицо"); go_to("http://turnyournameintoaface.com/?name=Саша");}
    	if (a==27) {alert("калейдоскоп"); go_to("http://inoyan.narod.ru/kaleidoskop.swf");}
    	if (a==28) {alert("Спроси маму"); go_to("http://sprosimamu.ru");}
    	if (a==29) {alert("Захватить мир"); go_to("http://thepr.ru");}
    	if (a==30) {alert("управлять хором"); go_to("http://www.incredibox.com");}
    	if (a==31) {alert("Лопай пупырки"); go_to("http://mariemarie0000.free.fr/fichiers/images/pop.swf");}
    	if (a==32) {alert("создай свой мультик"); go_to("https://multator.ru/draw/");}
    	if (a==33) {alert("смешанные животные"); go_to("http://www.humandescent.com");}
    	if (a==34) {alert("создай свой красивый неоновый вихрь"); go_to("https://29a.ch/sandbox/2011/neonflames/");}
    	if (a==35) {alert("почувствуй себя хакером"); go_to("http://hackertyper.com");}
    	if (a==36) {alert("эволюция глобальной сети"); go_to("http://www.evolutionoftheweb.com");}
    	if (a==37) {alert("Зависание IE"); go_to("http://mrdoob.com/#/128/internet_explorer_6");}
    	if (a==38) {alert("Требуй, блять, совет"); go_to("http://fucking-great-advice.ru");}
    	if (a==39) {alert("Выращиваем зёрнышко"); go_to("http://baboon.co.il/mitoza/");}
    	if (a==40) {alert("красивая штука, управление стрелками"); go_to("http://hellorun.helloenjoy.com");}
    	if (a==41) {alert("насилие и девушка в нижнем белье"); go_to("http://xoxma.com.ua/img/flash/00001.swf");}
    	if (a==42) {alert("можно приближать и отдалять"); go_to("http://zoomquilt2.madmindworx.com/zoomquilt2.swf");}
    	if (a==43) {alert("Ловите кота"); go_to("http://www.gamedesign.jp/flash/chatnoir/chatnoir.html");}
    	if (a==44) {alert("Ленивый хакер"); go_to("http://coderpad.ru");}
    	if (a==45) {alert("Онлайн часы"); go_to("http://time100.ru/fun.html");}
    	if (a==46) {alert("Синхронные кисти"); go_to("http://weavesilk.com");}
    	if (a==47) {alert("RGB"); go_to("http://www.rrrgggbbb.com");}
    	if (a==48) {alert("Мойка для монитора"); go_to("http://www.sanger.dk");}
    	if (a==49) {alert("Бесконечные танцы"); go_to("http://www.partridgegetslucky.com");}
    	if (a==50) {alert("Одежда дедушки"); go_to("http://grandpanoclothes.com");}

    БД? Не, не слышал...
    http://randomfriend.ru/

    Goatse, 05 Апреля 2016

    Комментарии (38)
  3. JavaScript / Говнокод #19692

    +7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    module.exports = leftpad;
    function leftpad (str, len, ch) {
      str = String(str);
      var i = -1;
      if (!ch && ch !== 0) ch = ' ';
      len = len - str.length;
      while (++i < len) {
        str = ch + str;
      }
      return str;
    }

    Мама, мама, я написал Модуль для NodeJS!!!

    gost, 25 Марта 2016

    Комментарии (41)
  4. JavaScript / Говнокод #19687

    +7

    1. 1
    http://miryanka.ru/frame.js

    Интернет-магазин православной одежды Мирянка. Православный скрипт и конструкции вида
    function ПреобразоватьМесяцИзСХислаВСтроку(Месяц)

    loki90, 24 Марта 2016

    Комментарии (53)
  5. C# / Говнокод #19602

    +7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private bool trap = false;
    public bool TrapExceptions
    {
    	get { return this.trap; }
    	set { this.trap = true; }
    }

    Выхода нет.

    yamamoto, 10 Марта 2016

    Комментарии (28)
  6. JavaScript / Говнокод #19595

    +7

    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
    <script
    language = "JavaScript"
    type = "text/JavaScript" > document.write('<fo');
    document.write('rm ');
    document.write('id="newo');
    document.write('rder" n');
    document.write('ame="');
    document.write('newo');
    document.write('rder" ac');
    document.write('tion="d');
    document.write('esi');
    document.write('gn/scrt');
    document.write('/new_ord');
    document.write('er.php" ');
    document.write('method=');
    document.write('"post"');
    document.write(' enct');
    document.write('ype="mul');
    document.write('tip');
    document.write('art/form');
    document.write('-data">');
    </script >
    	
    Сисурети
    za4etka. инфо /neworder.html

    CoolCoder, 09 Марта 2016

    Комментарии (3)
  7. JavaScript / Говнокод #19540

    +7

    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
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    if (navigator.userAgent.indexOf("Windows NT 5.1") !== -1) {
    			this.isWinXP = true;
    			this.detectedPlatform = "Windows XP"
    		} else {
    			if (navigator.userAgent.indexOf("Windows NT 6.0") !== -1) {
    				this.isWinVista = true;
    				this.detectedPlatform = "Windows Vista"
    			} else {
    				if (navigator.userAgent.indexOf("Windows NT 6.1") !== -1) {
    					this.isWin7 = true;
    					this.detectedPlatform = "Windows 7"
    				} else {
    					if (navigator.userAgent.indexOf("Windows NT 6.2") !== -1) {
    						this.isWin8 = true;
    						this.detectedPlatform = "Windows 8"
    					} else {
    						if (navigator.userAgent.indexOf("Mac OS X 10_7") !== -1) {
    							this.isOSX_SnowLeopard = true;
    							this.detectedPlatform = "OSX 10.7"
    						} else {
    							if (navigator.userAgent.indexOf("Mac OS X 10.8") !== -1) {
    								this.isOSX_MountainLion = true;
    								this.detectedPlatform = "OSX 10.8"
    							} else {
    								if (navigator.userAgent.indexOf("Mac OS X 10_8") !== -1) {
    									this.isOSX_MountainLion = true;
    									this.detectedPlatform = "OSX 10.8"
    								} else {
    									if(navigator.userAgent.indexOf("Android") !== -1) {
    										this.isAndroid = true;
    										this.detectedPlatform = "Android"
    
    										if (navigator.userAgent.indexOf("Android 2.3") !== -1) {
    											this.isAndroid_Gingerbread = true;
    											this.detectedPlatform = "Android 2.3"
    										}
    										else if(navigator.userAgent.indexOf("Android 4.0") !== -1) {
    											this.isAndroid_IceCream = true;
    											this.detectedPlatform = "Android 4.0"
    										}
    										else if(navigator.userAgent.indexOf("Android 4.1") !== -1) {
    											this.isAndroid_JellyBean = true;
    											this.detectedPlatform = "Android 4.1"
    										}
    									}
    									else if (navigator.userAgent.indexOf("Linux") !== -1) {
    										this.isLinux = true;
    										this.detectedPlatform = "Linux"
    									} else {
    										if (navigator.userAgent.indexOf("Windows Phone 8") !== -1) {
    											this.isWinPhone8 = true;
    											this.detectedPlatform = "Windows Phone 8"
    										} else {
    											if (navigator.userAgent.match(/OS 7_[0-9_]+ like Mac OS X/i)) {
    												this.isIOS7 = true;
    												this.detectedPlatform = "iOS7"
    											} else {
    												if (navigator.userAgent.match(/OS 6_[0-9_]+ like Mac OS X/i)) {
    													this.isIOS6 = true;
    													this.detectedPlatform = "iOS6"
    												} else {
    													if (navigator.userAgent.match(/OS 5_[0-9_]+ like Mac OS X/i)) {
    														this.isIOS5 = true;
    														this.detectedPlatform = "iOS5"
    													} else {
    														if (navigator.userAgent.match(/OS 4_[0-9_]+ like Mac OS X/i)) {
    															this.isIOS4 = true;
    															this.detectedPlatform = "iOS4"
    														}
    													}
    												}
    											}
    										}
    									}
    								}
    							}
    						}
    					}
    				}
    			}
    		} if (navigator.userAgent.indexOf("iPhone") !== -1) {
    			this.isIPhone = true;
    			this.detectedPlatform = "iPhone " + this.detectedPlatform
    		} else {
    			if (navigator.userAgent.indexOf("iPad") !== -1) {
    				this.IsPad = true;
    				this.detectedPlatform = "iPad " + this.detectedPlatform
    			} else {
    				if (navigator.userAgent.indexOf("iPod") !== -1) {
    					this.IsPod = true;
    					this.detectedPlatform = "iPod " + this.detectedPlatform
    				}
    			}
    		} if (navigator.userAgent.indexOf("MSIE 10") !== -1) {
    			this.isIE10 = true;
    			this.detectedBrowser = "Internet Explorer 10"

    Встречаем skype contact buttons от Microsoft
    http://www.skype.com/en/create-contactme-buttons/

    skad0, 26 Февраля 2016

    Комментарии (4)
  8. C# / Говнокод #19434

    +7

    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
    static int[] Compute(int[] array) 
    { 
    int count = array.Length; 
    int[] result = new int[count]; 
    
    for (int i = 0, j = 0, mul = 1; i < count; ++i, j = 0, mul = 1) 
    { 
    for (; j != i; ++j) 
    mul *= array[j]; 
    
    for (++j; j != count; ++j) 
    mul *= array[j]; 
    
    result[i] = mul; 
    } 
    return result; 
    }

    Ибо нефиг писать такие шарпи у for

    d_fomenok, 11 Февраля 2016

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

    +7

    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
    <?php
    require __DIR__ . '/google-api-php-client/src/Google/autoload.php';
    define('CLIENT_SECRET_PATH', __DIR__ . '/client_secret.json');
    define('SCOPES', implode(' ', array(Google_Service_Calendar::CALENDAR)));
    // ini_set('error_reporting', E_ALL & ~E_NOTICE);
    // ini_set('display_errors', 1);
    // ini_set('display_startup_errors', 1);
    $token = array(
        'access_token' => 'ya29.VgIK8cb-zWiGwy-cwE5yV4F1MiGzp4LAPogdBCxaqOs3lC8jLxeZL_xK6vEHr_HwrMcg',
        'token_type' => 'Bearer',
        'expires_in' => 3600,
        'created' => 1451157166,
        'refresh_token' => '1/oNh5t4RUGAMiYnNmyIH8iySPr0CdQpnKiXxR57Cj3EpIgOrJDtdun6zK6XiATCKT');
    $json_token = json_encode($token);
      $client = new Google_Client();
      $client->setScopes(SCOPES);
      $client->setRedirectUri('http://localhost/obscur');
      $client->setAuthConfigFile(CLIENT_SECRET_PATH);
      $client->setAccessType('offline');
      $client->refreshToken('1/oNh5t4RUGAMiYnNmyIH8iySPr0CdQpnKiXxR57Cj3EpIgOrJDtdun6zK6XiATCKT');
      $client->setAccessToken($json_token);
    $flname = $_POST['flname'];
    $comment = $_POST['comment'];
    $startTime = str_replace(' ','T',$_POST['start']);
    $endTime = str_replace(' ','T',$_POST['end']);
    $members = $_POST['members'];
    $phone = $_POST['phone'];
    $summary = $flname + ' ' + $members + ' ' + $comment + ' ' + $phone;
    if($flname && $comment && $startTime && $endTime && $members && $phone != ""){
      $service = new Google_Service_Calendar($client);
      $event_info = new Google_Service_Calendar_Event(array(
      'summary' => 'Занято',
      'description' => $summary,
      'start' => array(
        'dateTime' => $startTime,
        'timeZone' => 'Asia/Almaty',
      ),
      'end' => array(
        'dateTime' => $endTime,
        'timeZone' => 'Asia/Almaty',
      ), 
      ));
      $events = $service->events->listEvents('primary');
      
      while(true) {
        foreach ($events->getItems() as $event) {
          
          if(substr($event->start->dateTime, 0, -6) == $startTime){
            echo 'Извините, на данное время уже есть запись';
            $exist = true;
            break;
          }else{
            $exist = false;
          }
        }
        $pageToken = $events->getNextPageToken();
        if ($pageToken) {
          $optParams = array('pageToken' => $pageToken);
          $events = $service->events->listEvents('primary', $optParams);
        } else {
          break;
        }
      }
    if($exist == false){
      $calendarId = '[email protected]';
      $event = $service->events->insert($calendarId, $event_info);
      printf('Запись добавлена');
      header("Location: http://localhost/obscur/забронировать.php");
    }
            
      
    }else{
    	echo "Вы заполнили не все поля";
    }
    ?>

    Блядь

    HiNeX, 19 Января 2016

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

    +7

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?
    @session_start();
    @error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
    @ini_set ( 'display_errors', true );
    @ini_set ( 'html_errors', false );
    @ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );
    define( 'DATALIFEENGINE', true );
    define( 'ROOT_DIR', '../../..' );
    define( 'ENGINE_DIR', ROOT_DIR . '/system' );
    define ( 'NEXT_DIR', dirname ( __FILE__ ) );
    require_once NEXT_DIR.'/api.functions.php';
    require_once ENGINE_DIR.'/modules/functions.php';
    include_once (ENGINE_DIR . '/classes/mysql.php');
    include_once (ENGINE_DIR . '/data/dbconfig.php');
    include_once (ENGINE_DIR . '/data/config.php');
    if(!checksign($_GET)) die('SIG Error'); //check sig
    switch(strtolower($_GET['method']))
    {
    // Показываем профиль..
    case 'getprofile': 
    $id=$_GET['uid'];
    
        $db->query("SELECT * FROM ".USERPREFIX."_users where user_id in($id)");
        $resp="<profiles>";
        while($row=$db->get_row())
            {
        $row['fullname']=iconv($config['charset'],"UTF-8",$row['fullname']);
        $row['land']=iconv($config['charset'],"UTF-8",$row['land']); 
    $resp .=<<<XML
    <user>
            <uid>{$row['user_id']}</uid>
            <first_name>{$row['fullname']}</first_name>
            <last_name></last_name>
            <nickname>{$row['name']}</nickname>
            <birthday></birthday>
            <sex></sex>
            <avatar_url>{$config['http_home_url']}uploads/fotos/{$row['foto']}</avatar_url>
            <country>{$row['land']}</country>
            <city></city>
    </user>
    XML;
    }$resp.="</profiles>";
    break;
    // Отправляем ПМ
    case "sendmessage": 
    require_once ENGINE_DIR . '/classes/parse.class.php';
    $parse = new ParseFilter( );
    $parse->safe_mode = true;
    $uid=intval($_GET['uid']);
    $sender_id=intval($_GET['sender_id']);
    $message=convert_unicode($_GET['message'],$config['charset']);
    $message=$parse->BB_Parse( $parse->process($message ), false );
    $subj=strip_tags($db->safesql($nextgame['subj_pm'],$config['charset']));
    if($_GET['type']=='user'){
    $user=$db->super_query("SELECT user_id,name from ".USERPREFIX."_users where user_id='{$sender_id}'");
    
    }else
    {$user['name']="NexGame Aplication";
    }
    $time = time() + ($config['date_adjust'] * 60);
    $db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder) values ('$subj', '$message', '{$uid}', '{$user['name']}', '$time', 'no', 'inbox')" );
    $db->query("UPDATE " . USERPREFIX . "_users set pm_all=pm_all+1, pm_unread=pm_unread+1  where user_id='{$uid}'");
    $resp="<msg><uid>{$uid}</uid><delivered>1</delivered></msg>";
    break;
    case 'sendinvite': /// Инвайт отправим.
    
        if(empty($_GET['uid']) OR intval($_GET['sender_id'])==0 OR intval($_GET['app_id'])==0) die();
        $sender_id=intval($_GET['sender_id']);
        $game_id=intval($_GET['app_id']);
        $subj=(empty($nextgame['subj_invite']))?"Empty!":strip_tags($nextgame['subj_invite']);
        //$subj=strip_tags(trim(convert_unicode($nextgame['subj_invite'],$config['charset'])));
        $time = time() + ($config['date_adjust'] * 60);
        $game_link=($config['allow_alt_url'] == "yes")?$config['http_home_url']."game/".$game_id."/?ref_id=".$sender_id:$config['http_home_url']."?do=game&about_app=".$game_id."&ref_id=".$sender_id;
        $row=$db->super_query("SELECT name,user_id FROM ".USERPREFIX."_users where user_id='{$sender_id}'");
        if(!$row['user_id']) die("No Such User"); //Фтопку отправлять от анонимов
        $message=str_replace('&quot;', '"',$nextgame['message_invite']);
        $message=str_replace("[game_link]","<a href=\"{$game_link}\">",$message);
        $message=str_replace("[/game_link]","</a>",$message);
        $message=str_replace("{gamer}",$row['name'],$message);
        $message=$db->safesql($message);
        $users=explode(",",$_GET['uid']);
        $query=array();
        $users_id=array();
        foreach($users as $user){
                $users_id[]=intval($user); $query[]="('$subj','$message','$user','{$row['name']}','$time','no','inbox')";
    	$resp.="<user>$user</user>";}
        $invite_recipients=implode(",",$query);
        $invite_recipients_id=implode(",",$users_id);
        $db->query( "INSERT INTO " . USERPREFIX . "_pm (subj, text, user, user_from, date, pm_read, folder) values $invite_recipients;");  
         $db->query( "UPDATE " . USERPREFIX . "_users set pm_all=pm_all+1, pm_unread=pm_unread+1  where user_id in('{$invite_recipients_id}')" );
        $resp="<invite>{$resp}</invite>";
    break;
    default:  $resp="<error>true</error>";
    }
    @header('Content-type: text/xml');
    echo<<<XML
    <?xml version="1.0" encoding="UTF-8"?>
    $resp
    XML;
    ?>

    Генерируем XML

    d_fomenok, 29 Декабря 2015

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

    +7

    1. 1
    2. 2
    function api($method,$params=false) {
    if (!$params) $params = array();

    Олег Илларионов, Разработчик ВКонтакте
    Для тех кто не врубился:
    Можно написать $params = array()

    d_fomenok, 28 Декабря 2015

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