1. JavaScript / Говнокод #6041

    +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
    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
    else
    		{
    		fronter = user;
    		LasTCID			= MDnextResponse_array[0];
    		document.vicidial_form.lead_id.value			= MDnextResponse_array[1];
    		LeaDPreVDispO	= MDnextResponse_array[2];
    		document.vicidial_form.vendor_lead_code.value	= MDnextResponse_array[4];
    		document.vicidial_form.list_id.value			= MDnextResponse_array[5];
    		document.vicidial_form.gmt_offset_now.value		= MDnextResponse_array[6];
    		document.vicidial_form.phone_code.value			= MDnextResponse_array[7];
    		if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') )
    			{
    			var tmp_pn = document.getElementById("phone_numberDISP");
    			if (disable_alter_custphone=='Y')
    {
    tmp_pn.innerHTML		= MDnextResponse_array[8];
    }
    			}
    		document.vicidial_form.phone_number.value		= MDnextResponse_array[8];
    		document.vicidial_form.title.value= MDnextResponse_array[9];
    		document.vicidial_form.first_name.value			= MDnextResponse_array[10];
    		document.vicidial_form.middle_initial.value		= MDnextResponse_array[11];
    		document.vicidial_form.last_name.value			= MDnextResponse_array[12];
    		document.vicidial_form.address1.value			= MDnextResponse_array[13];
    		document.vicidial_form.address2.value			= MDnextResponse_array[14];
    		document.vicidial_form.address3.value			= MDnextResponse_array[15];
    		document.vicidial_form.city.value= MDnextResponse_array[16];
    		document.vicidial_form.state.value= MDnextResponse_array[17];
    		document.vicidial_form.province.value			= MDnextResponse_array[18];
    		document.vicidial_form.postal_code.value		= MDnextResponse_array[19];
    		document.vicidial_form.country_code.value		= MDnextResponse_array[20];
    		document.vicidial_form.gender.value= MDnextResponse_array[21];
    		document.vicidial_form.date_of_birth.value		= MDnextResponse_array[22];
    		document.vicidial_form.alt_phone.value			= MDnextResponse_array[23];
    		document.vicidial_form.email.value= MDnextResponse_array[24];
    		document.vicidial_form.security_phrase.value	= MDnextResponse_array[25];
    		var REGcommentsNL = new RegExp("!N","g");
    		MDnextResponse_array[26] = MDnextResponse_array[26].replace(REGcommentsNL, "\n");
    		document.vicidial_form.comments.value			= MDnextResponse_array[26];
    		document.vicidial_form.called_count.value		= MDnextResponse_array[27];
    		previous_called_count			= MDnextResponse_array[27];
    		previous_dispo	= MDnextResponse_array[2];
    		CBentry_time	= MDnextResponse_array[28];
    		CBcallback_time	= MDnextResponse_array[29];
    		CBuser			= MDnextResponse_array[30];
    		CBcomments		= MDnextResponse_array[31];
    		dialed_number	= MDnextResponse_array[32];
    		dialed_label	= MDnextResponse_array[33];
    		source_id		= MDnextResponse_array[34];
    		document.vicidial_form.rank.value= MDnextResponse_array[35];
    		document.vicidial_form.owner.value= MDnextResponse_array[36];
    	//	CalL_ScripT_id	= MDnextResponse_array[37];
    		script_recording_delay			= MDnextResponse_array[38];
    		CalL_XC_a_NuMber= MDnextResponse_array[39];
    		CalL_XC_b_NuMber= MDnextResponse_array[40];
    		CalL_XC_c_NuMber= MDnextResponse_array[41];
    		CalL_XC_d_NuMber= MDnextResponse_array[42];
    		CalL_XC_e_NuMber= MDnextResponse_array[43];
    
    		timer_action = campaign_timer_action;
    		timer_action_message = campaign_timer_action_message;
    		timer_action_seconds = campaign_timer_action_seconds;
    			
    		lead_dial_number = document.vicidial_form.phone_number.value;
    		var dispnum = document.vicidial_form.phone_number.value;
    		var status_display_number = phone_number_format(dispnum);

    7ion, 20 Марта 2011

    Комментарии (2)
  2. JavaScript / Говнокод #6040

    +164

    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
    if (VDIC_web_form_address.match(regWFAcustom))
    	{
    	URLDecode(VDIC_web_form_address,'YES');
    	TEMP_VDIC_web_form_address = decoded;
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, '');
    	}
    else
    	{
    	web_form_vars = 
    	"&lead_id=" + document.vicidial_form.lead_id.value + 
    	"&vendor_id=" + document.vicidial_form.vendor_lead_code.value + 
    	"&list_id=" + document.vicidial_form.list_id.value + 
    	"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value + 
    	"&phone_code=" + document.vicidial_form.phone_code.value + 
    	"&phone_number=" + document.vicidial_form.phone_number.value + 
    	"&title=" + document.vicidial_form.title.value + 
    	"&first_name=" + document.vicidial_form.first_name.value + 
    	"&middle_initial=" + document.vicidial_form.middle_initial.value + 
    	"&last_name=" + document.vicidial_form.last_name.value + 
    	"&address1=" + document.vicidial_form.address1.value + 
    	"&address2=" + document.vicidial_form.address2.value + 
    	"&address3=" + document.vicidial_form.address3.value + 
    	"&city=" + document.vicidial_form.city.value + 
    	"&state=" + document.vicidial_form.state.value + 
    	"&province=" + document.vicidial_form.province.value + 
    	"&postal_code=" + document.vicidial_form.postal_code.value + 
    	"&country_code=" + document.vicidial_form.country_code.value + 
    	"&gender=" + document.vicidial_form.gender.value + 
    	"&date_of_birth=" + document.vicidial_form.date_of_birth.value + 
    	"&alt_phone=" + document.vicidial_form.alt_phone.value + 
    	"&email=" + document.vicidial_form.email.value + 
    	"&security_phrase=" + document.vicidial_form.security_phrase.value + 
    	"&comments=" + document.vicidial_form.comments.value + 
    	"&user=" + user + 
    	"&pass=" + pass + 
    	"&campaign=" + campaign +
    	"&phone_login=" + phone_login + 
    	"&original_phone_login=" + original_phone_login +
    	"&phone_pass=" + phone_pass + 
    	"&fronter=" + fronter + 
    	"&closer=" + user + 
    	"&group=" + group + 
    	"&channel_group=" + group + 
    	"&SQLdate=" + SQLdate + 
    	"&epoch=" + UnixTime + 
    	"&uniqueid=" + document.vicidial_form.uniqueid.value + 
    	"&customer_zap_channel=" + lastcustchannel + 
    	"&customer_server_ip=" + lastcustserverip +
    	"&server_ip=" + server_ip + 
    // ...еще строчек 30...
    	"&user_custom_five=" + VU_custom_five + '' +
    	"&preset_number_a=" + CalL_XC_a_NuMber + '' +
    	"&preset_number_b=" + CalL_XC_b_NuMber + '' +
    	"&preset_number_c=" + CalL_XC_c_NuMber + '' +
    	"&preset_number_d=" + CalL_XC_d_NuMber + '' +
    	"&preset_number_e=" + CalL_XC_e_NuMber + '' +
    	"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +
    	"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +
    	webform_session;
    	
    	var regWFspace = new RegExp(" ","ig");
    	web_form_vars = web_form_vars.replace(regWF, '');
    	var regWF = new RegExp("\\`|\\~|\\:|\\;|\\#|\\'|\\\"|\\{|\\}|\\(|\\)|\\*|\\^|\\%|\\$|\\!|\\%|\\r|\\t|\\n","ig");
    	web_form_vars = web_form_vars.replace(regWFspace, '+');
    	web_form_vars = web_form_vars.replace(regWF, '');
    
    	var regWFAvars = new RegExp("\\?","ig");
    	if (VDIC_web_form_address.match(regWFAvars))
    		{web_form_vars = '&' + web_form_vars}
    	else
    		{web_form_vars = '?' + web_form_vars}
    
    	TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars;
    
    	var regWFAqavars = new RegExp("\\?&","ig");
    	var regWFAaavars = new RegExp("&&","ig");
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAqavars, '?');
    	TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAaavars, '&');
    	}

    7ion, 20 Марта 2011

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

    +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
    if (prepopulate_transfer_preset_enabled > 0)
    									{
    if (prepopulate_transfer_preset == 'PRESET_1')
    										{document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber;}
    if (prepopulate_transfer_preset == 'PRESET_2')
    										{document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber;}
    if (prepopulate_transfer_preset == 'PRESET_3')
    										{document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber;}
    if (prepopulate_transfer_preset == 'PRESET_4')
    										{document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber;}
    if (prepopulate_transfer_preset == 'PRESET_5')
    										{document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber;}
    									}
    if ( (quick_transfer_button == 'PRESET_1') || (quick_transfer_button == 'PRESET_2') || (quick_transfer_button == 'PRESET_3') || (quick_transfer_button == 'PRESET_4') || (quick_transfer_button == 'PRESET_5') )
    									{
    									document.getElementById("QuickXfer").innerHTML = "<a href=\"#\" onclick=\"mainxfer_send_redirect('XfeRBLIND','" + lastcustchannel + "','" + lastcustserverip + "');return false;\"><IMG SRC=\"./images/vdc_LB_quickxfer.gif\" border=0 alt=\"QUICK TRANSFER\"></a>";
    
    									if (quick_transfer_button == 'PRESET_1')
    										{document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber;}
    									if (quick_transfer_button == 'PRESET_2')
    										{document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber;}
    									if (quick_transfer_button == 'PRESET_3')
    										{document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber;}
    									if (quick_transfer_button == 'PRESET_4')
    										{document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber;}
    									if (quick_transfer_button == 'PRESET_5')
    										{document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber;}
    									}

    7ion, 20 Марта 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    var DiaLControl_auto_HTML = "<IMG SRC=\"./images/vdc_LB_pause_OFF.gif\" border=0 alt=\" Pause \"><a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADready');\"><IMG SRC=\"./images/vdc_LB_resume.gif\" border=0 alt=\"Resume\"></a>";
    	var DiaLControl_auto_HTML_ready = "<a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADpause');\"><IMG SRC=\"./images/vdc_LB_pause.gif\" border=0 alt=\" Pause \"></a><IMG SRC=\"./images/vdc_LB_resume_OFF.gif\" border=0 alt=\"Resume\">";
    	var DiaLControl_auto_HTML_OFF = "<IMG SRC=\"./images/vdc_LB_pause_OFF.gif\" border=0 alt=\" Pause \"><IMG SRC=\"./images/vdc_LB_resume_OFF.gif\" border=0 alt=\"Resume\">";
    	var DiaLControl_manual_HTML = "<a href=\"#\" onclick=\"ManualDialNext('','','','','','0');\"><IMG SRC=\"./images/vdc_LB_dialnextnumber.gif\" border=0 alt=\"Dial Next Number\"></a>";

    Кое-что из тысячестрочного конфига в жс-вставке на странице.

    7ion, 20 Марта 2011

    Комментарии (0)
  5. JavaScript / Говнокод #6037

    +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
    var BrowseWidth = 0;
    	var BrowseHeight = 0;
    
    	function getInsideBrowse() 
    		{
    		var ns = navigator.appName == "Netscape";
    		if (ns) 
    			{
    			BrowseWidth = window.innerWidth;
    			BrowseHeight = window.innerHeight;
    			}
    		else 
    			{
    			BrowseWidth = document.body.clientWidth;
    			BrowseHeight = document.body.clientHeight;
    			}
    		}
    	function browser_dimensions() 
    		{
    		getInsideBrowse();
    
    		document.vicidial_form.JS_browser_width.value = BrowseWidth;
    		document.vicidial_form.JS_browser_height.value = BrowseHeight;
    		}

    7ion, 20 Марта 2011

    Комментарии (1)
  6. Куча / Говнокод #6036

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <tr>
            <td><img src=images/spacer.gif border=0 height=1 width=15></td>
            <td><img src=images/spacer.gif border=0 height=1 width=77></td>
            <td><img src=images/spacer.gif border=0 height=1 width=19></td>
            <td><img src=images/spacer.gif border=0 height=1 width=68></td>
            <td><img src=images/spacer.gif border=0 height=1 width=19></td>
            <td><img src=images/spacer.gif border=0 height=1 width=1></td>
    </tr>

    Ой ща я разгуляюсь!
    Работаю в колл-центре, это исходный код веб-морды панели звонков.
    Буду кидать куски потихоньку. Хотя там надо сразу все кидать.
    Вот так мы верстаем.

    7ion, 20 Марта 2011

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

    +91

    1. 1
    2. 2
    3. 3
    4. 4
    procedure TForm.ButtoClick(Sender: TObject);{не вздумай нажимать на эту конопку, уебок!! тогда проект не будет падать!!}
    begin
        {blah blah blah}
    end;

    нашел такой вот коммент в обработчике события 0_о

    TheHamstertamer, 20 Марта 2011

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

    +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
    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
    if (!isset($_SERVER['PHP_AUTH_USER']))
     
    {
            Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
            Header ("HTTP/1.0 401 Unauthorized");
            exit();
    }
     
    else {
            if (!get_magic_quotes_gpc()) {
                    $_SERVER['PHP_AUTH_USER'] = mysql_escape_string($_SERVER['PHP_AUTH_USER']);
                    $_SERVER['PHP_AUTH_PW'] = mysql_escape_string($_SERVER['PHP_AUTH_PW']);
            }
     
            $query = "SELECT pass FROM userlist WHERE user='".$_SERVER['PHP_AUTH_USER']."'";
            $lst = @mysql_query($query);
     
            if (!$lst)
            {
                Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
            Header ("HTTP/1.0 401 Unauthorized");
            exit();
            }
     
            if (mysql_num_rows($lst) == 0)
            {
               Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
               Header ("HTTP/1.0 401 Unauthorized");
               exit();
            }
     
            $pass =  @mysql_fetch_array($lst);
            if ($_SERVER['PHP_AUTH_PW']!= $pass['pass'])
            {
                Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
               Header ("HTTP/1.0 401 Unauthorized");
               exit();
            }
     
     
    }

    Авторизация

    nepster, 20 Марта 2011

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

    −101

    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
    вопрос:
    есть массив $friends[id1] и friends2[id2] можно ли их объединить?
    
    ответ:
    $friends[id1] .= $friends2[id2];//(точка перед равно)
    
    Помогло?
    
    если ключи есть совпадающие
    foreach($friends2[id2] as $key=>$item)
    {
        $friends[id1][$key.'_2']=$item;
    }
    
    
    ну или с проверкой
    foreach($friends2[id2] as $key=>$item)
    {
        if(isset($friends[id1][$key]))// проверка на существование ключа
        {
            $friends[id1][$key.'_2']=$item;
        }
        else
        {
            $friends[id1][$key]=$item;
        }
    }
    
    
    можно усложнить
    foreach($friends2[id2] as $key=>$item)
    {
        if(isset($friends[id1][$key]) && $friends[id1][$key]!==$item)// проверка на существование ключа и совпадение с существующим значением ключа первого массива
        {
                $friends[id1][$key.'_2']=$item;
        }
        else
        {
            $friends[id1][$key]=$item;
        }
    }
    вот

    мой говнокод))

    Snickers, 20 Марта 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    const QColor * c = & QColor.red;
    const QColor * c = & QColor.rgb(12,12,12);
    const QColor * c = & int QColor::red () const;
    const int * c = & int QColor::red () const;

    Взято отсюда: http://www.prog.org.ru/topic_16855_0.html
    Особенно радует фраза: "Пробовал так <....> И другими способами, на которые вылетало множество ошибок".

    TarTar, 19 Марта 2011

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