- 1
- 2
- 3
switch ($item) {
case $item: getitem($item);break;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+189
switch ($item) {
case $item: getitem($item);break;
}
+153
switch(num_q)
{
case 0: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 1: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true ; break;
case 2: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 3: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 4: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 5: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 6: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 7: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 8: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 9: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 10: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 11: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 12: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 13: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
case 14: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q]= true; break;
case 15: if(Terminated)MForm->term[num_q] = true;
else MForm->pausa[num_q] = true; break;
}
ночью надо спать...
−142
#!/bin/bash
#
# program file name: urlmin.sh
# program version: 0.4
_help()
{
prg=$(basename $0)
cat << EOF
options:
-h See this page
-l Viewed all names of minifer sites
-s
lb.vg
minify.me
is.gd
-r Random mode of minifiers
-u url link
examples:
random mode - minifiers: ${prg} -r -u 'http://wikimapia.org/#lat=36.7923994&lon=53.1100881&z=18&l=1&m=b'
only 1 minifier - is.gd minifier: ${prg} -s is.gd -u 'http://wikimapia.org/#lat=36.7923994&lon=53.1100881&z=18&l=1&m=b'
or lb.vg minifier: ${prg} -s lb.vg -u 'http://wikimapia.org/#lat=36.7923994&lon=53.1100881&z=18&l=1&m=b'
and other
EOF
exit 0
}
[ ! -f "$(which curl)" ] && { echo "Установите утилиту curl" ; exit 1 ;}
_user_agent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100503 Firefox/3.6.4"
_sets_minifiers=( "lb.vg" "is.gd" "minify.me" )
_e() { echo -e "${*}" ;}
_get_page() { curl -s -A "$USER_AGENT" ${1} | tr -d '\n' || { clear ; echo -e "${B_T}${RC}Error${CRS}! curl in function _get_page has exited abnormaly: ${1}" ; exit 1 ;} ;}
_post_page() { curl -s -A "$USER_AGENT" -d "${2}" "${1}" | tr -d "\n" || { clear ; echo -e "${B_T}${RC}Error!${CRS} curl in function _post_page has exited abnormaly: ${1} -> ${2}" ; exit 1 ;} ;}
_urlencode() { LANG=C awk 'BEGIN { EOL = "%0A" ; split ("1 2 3 4 5 6 7 8 9 A B C D E F", hextab, " ") ; hextab [0] = 0 ; for ( i=1; i<=255; ++i ) ord [ sprintf ("%c", i) "" ] = i + 0 } ; { encoded = "" ; for ( i=1; i<=length ($0); ++i ) { c = substr ($0, i, 1) ; if ( c ~ /[a-zA-Z0-9.-]/ ) { encoded = encoded c } else if ( c == " " ) { encoded = encoded "+" } else { lo = ord [c] % 16 ; hi = int (ord [c] / 16); encoded = encoded "%" hextab [hi] hextab [lo] } } ; printf ("%s", encoded EOL) } END { }' "$@" | sed 's|%0A||g' ;}
_random() { [ -n "${1}" ] && { while :; do zz=$(y=0;for ((x=${1};x>=y;y++)) ; do [ "$y" == "${RANDOM[@]:2:1}" ] && [ -n "$y" ] && { echo $y ; break ;} ; done ) ; [ -n "$zz" ] && { echo "$zz" ; break ;} ; done ;} ;}
# sets
while getopts "hu:s:rl" option ; do case $option in
h) _help ;;
u) url_path="$OPTARG" ;;
s) _set_min="$OPTARG" ; set_min_num=$(j=0 ; for x in ${_sets_minifiers[*]} ; do [ "${x}" == "${_set_min}" ] && _e "${j}" ; ((j++)) ; done) ;;
r) mode_random="yes" ; set_min_num="$(_random $((${#_sets_minifiers[*]}-1)) )" ;;
l) list_mins="yes" ;;
v) set_verbose="-v" ;;
esac ; done
case $set_min_num in
0)
_url_enc=$(_e "${url_path}" | _urlencode)
_url_host="${_sets_minifiers[$set_min_num]}"
_obtained=$(_post_page "http://${_url_host}/default.asp" "Orig_URL=${_url_enc}&show_ve=1&Categ=Humor" | egrep -o "http://${_url_host}/[a-Z0-9]+'" | sort -u | sed "s|'||g;s|http://||g") ;;
1)
_url_enc=$(_e "${url_path}" | _urlencode)
_url_host="${_sets_minifiers[$set_min_num]}"
_obtained=$(_post_page "http://${_url_host}/create.php" "URL=${_url_enc}" | egrep -o "http://${_url_host}/[a-Z0-9]+\" target" | sed 's|\" target||g;s|http://||g') ;;
2)
_url_enc=$(_e "${url_path}" | _urlencode)
_url_host="${_sets_minifiers[$set_min_num]}"
_obtained=$(_post_page "http://${_url_host}/create.php" "url=${_url_enc}" | egrep -o "http://${_url_host}/\?[a-Z0-9]+" | sed 's|http://||g') ;;
esac
[ -z "$1" ] && _help
[ -n "$set_min_num" ] && _e "Link: ${_obtained}"
[ -n "$list_mins" ] && _e "Minifiers:\n\n$(for i in ${_sets_minifiers[*]} ; do _e " ${i}" ; done)\n"
# eof urlmin.sh
url minifier
# typical define:
-=>> ./urlmin.sh -s is.gd -u 'http://wikimapia.org/#lat=36.7923994&lon=53.1100881&z=18&l=1& m=b'
Link: is.gd/ckjsg
# random minifier:
-=>> ./urlmin.sh -r -u 'http://wikimapia.org/#lat=36.7923994&lon=53.1100881&z=18&l=1& m=b'
Link: minify.me/?qkvbp2
+160
//browser detect for NN 4.xx and IE 4.xx and below, if so redirect to upgrade page.
var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);
// If Mac platform, also use the Macintosh style sheet.
if (navigator.platform.indexOf('Mac') != -1) {
document.write('<link rel="stylesheet" href="/Shared/css/screen_mac.css?v=5.0">');
document.write('<link rel="stylesheet" href="/Local/'+locale+'/css/local_mac.css?v=5.0">');
}
function isIEUnsupported()
{
var iePos = appVer.indexOf('msie');
if (iePos !=-1) {
is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
is_major = parseInt(is_minor);
}
if ((iePos!=-1) && is_major<6) {
if (isRetail.toLowerCase() == "true") {return false}
else {return true}
}
else {return false}
}
function isSafariUnsupported()
{
if((agt.indexOf('safari') > 0) && agt.indexOf('mac') > 0 )
{
is_minor = parseFloat(agt.substring(agt.indexOf('safari')+7,agt.indexOf('safari')+12));
is_major = parseInt(is_minor);
if (is_major < 412) {return true}
else {return false}
}
}
function isSafari3Plus()
{
if(agt.indexOf('safari') > 0)
{
is_minor = parseFloat(agt.substring(agt.indexOf('safari')+7,agt.indexOf('safari')+12));
is_major = parseInt(is_minor);
if (is_major >= 500) {return true}
else {return false}
}
return false;
}
var browserName=navigator.appName;
var browserVer=parseInt(navigator.appVersion);
var isMac = (navigator.appVersion.indexOf("Mac") != -1);
//Do Object detection
if (document.getElementById) {
if ((browserName=="Netscape" && browserVer<5) || isIEUnsupported() || isSafariUnsupported() || (browserName=="Microsoft Internet Explorer" && isMac))
{
document.location.href = "/Common/errors/upgrade.aspx";
}
}
else {document.location.href = "/Common/errors/upgrade.aspx";}
function shouldPriceBeVisible()
{
if ((locale.toLowerCase() == "intl" && isRetail.toLowerCase() == "false") || (locale.toLowerCase() == "zh-cn"))
{
return false;
}
return true;
}
function Redirect(url)
{
window.location = url;
}
// ND: Added so that tIFR could access user agent through ExternalInterface
function getUserAgent()
{
return navigator.userAgent.toLowerCase();
}
// ND: Added so that tIFR could access browser detection through ExternalInterface
function isBrowserIE()
{
var iePos = appVer.indexOf('msie');
if (iePos !=-1)
{
is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
is_major = parseInt(is_minor);
}
if ((iePos!=-1) && is_major >= 4)
{
return true;
}
else
{
return false;
}
}
Прошу прощения за многабукаф. Найдено на просторах www.tiffany.com. Помимо этого, там ещё много отжигов - например, hidden-поля в формах, содержащие несколько десятков килобайт Base64-кодированных данных. Что-то похожее как-то раз уже проскальзывало; как и в том случае, сайт сделан на ASP.NET.
+165
$image = $_FILES['image']['tmp_name'];
if( !empty($image) )
{
@$src = imagecreatefromjpeg($image);
if($src==false){exit ('Это не картинка'); }
Этот кусочек кода был спором 7 человек;)
Это говнокод?
+162
function get_cookie_352(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
return true;
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) {
break;
}
}
return null;
}
Типа поиск подстроки в строке. Причем про indexOf точно знают.
+155
char Sort(char Type, int l, int r)
{
int i = l, j = r;
char x[31];
void *y = 0;
setmem(x, 31, 0);
strcpy(x, ((TData*)(DataLists[CurrentList][(l+r)/2]))->Data[CurrentCol-1]);
do
{
if (Type==UP)
{
switch(CurrentCol)
{
case 1: case 2:
while (strcmp(((TData*)(DataLists[CurrentList][i]))->Data[CurrentCol-1], x) < 0)
++i;
while (strcmp(((TData*)(DataLists[CurrentList][j]))->Data[CurrentCol-1], x) > 0)
--j;
break;
default:
while (atoi(((TData*)(DataLists[CurrentList][i]))->Data[CurrentCol-1])<atoi(x))
++i;
while (atoi(((TData*)(DataLists[CurrentList][j]))->Data[CurrentCol-1])>atoi(x))
--j;
}
}
else
{
switch(CurrentCol)
{
case 1: case 2:
while (strcmp(((TData*)(DataLists[CurrentList][i]))->Data[CurrentCol-1], x) > 0)
++i;
while (strcmp(((TData*)(DataLists[CurrentList][j]))->Data[CurrentCol-1], x) < 0)
--j;
break;
default:
while (atoi(((TData*)(DataLists[CurrentList][i]))->Data[CurrentCol-1])>atoi(x))
++i;
while (atoi(((TData*)(DataLists[CurrentList][j]))->Data[CurrentCol-1])<atoi(x))
--j;
}//switch
}//if
if (i<=j)
{
y = DataLists[CurrentList][i];
*(DataLists[CurrentList].GetPointerToData(i)) = DataLists[CurrentList][j];
*(DataLists[CurrentList].GetPointerToData(j)) = y;
++i, --j;
}
}
while (i<=j);
if (l<j)
{
if (Type==UP)
Sort(UP, l, j);
else
Sort(DOWN, l, j);
}
if (i<r)
{
if (Type==UP)
Sort(UP, i, r);
else
Sort(DOWN, i, r);
}
return 1;
}
По-моему, это должна была быть сортировка Хоара, а получилось говно. Самое странное - это то, что оно работает...
+144
void main(void)
{
int s, e, x, y, n, i, g, e, r, s;
// действия с вышеобъявленными переменными
return;
}
+173
# текст сообщений об ошибке
$errDescr[1] = NETCAT_MODERATION_MSG_ONE;
$errDescr[2] = NETCAT_MODERATION_MSG_TWO;
$errDescr[6] = NETCAT_MODERATION_MSG_SIX;
$errDescr[7] = NETCAT_MODERATION_MSG_SEVEN;
$errDescr[8] = NETCAT_MODERATION_MSG_EIGHT;
$errDescr[21] = NETCAT_MODERATION_MSG_TWENTYONE;
Чьорт, я обожаю этих ребят. Они мои герои.
+135
int param_check(char *func, ...) {
int fail;
va_list al;
if (!func) {
return(1);
}
va_start(al, func);
fail=0;
if (!strcmp(func, "vnetGenerateDHCP") || !strcmp(func, "vnetKickDHCP")) {
vnetConfig *a = va_arg(al, vnetConfig *);
if (!a) {
fail=1;
}
} else if (!strcmp(func, "vnetAddPublicIP") || !strcmp(func, "vnetAddDev")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
if (!a || !b) {
fail=1;
}
} else if (!strcmp(func, "vnetAddHost")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
int d = va_arg(al, int);
if (!a || !b || (d < 0) || (d > NUMBER_OF_VLANS-1)) {
fail=1;
}
} else if (!strcmp(func, "vnetGetNextHost")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
int d = va_arg(al, int);
if (!a || !b || !c || d < 0 || d > NUMBER_OF_VLANS-1) {
fail=1;
}
} else if (!strcmp(func, "vnetDelHost") || !strcmp(func, "vnetEnableHost") || !strcmp(func, "vnetDisableHost")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
int d = va_arg(al, int);
if (!a || (!b && !c) || d < 0 || d > NUMBER_OF_VLANS-1) {
fail=1;
}
} else if (!strcmp(func, "vnetDeleteChain") || !strcmp(func, "vnetCreateChain")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
if (!a || !b || !c) {
fail=1;
}
} else if (!strcmp(func, "vnetTableRule")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
char *d = va_arg(al, char *);
char *e = va_arg(al, char *);
char *f = va_arg(al, char *);
char *g = va_arg(al, char *);
if (!a || !b || !c || !d || (!e && !f && !g)) {
fail=1;
}
} else if (!strcmp(func, "vnetSetVlan")) {
vnetConfig *a = va_arg(al, vnetConfig *);
int b = va_arg(al, int);
char *c = va_arg(al, char *);
char *d = va_arg(al, char *);
if (!a || b < 0 || b >= NUMBER_OF_VLANS || !c || !d) {
fail=1;
}
} else if (!strcmp(func, "vnetDelVlan")) {
vnetConfig *a = va_arg(al, vnetConfig *);
int b = va_arg(al, int);
if (!a || b < 0 || b >= NUMBER_OF_VLANS) {
fail=1;
}
} else if (!strcmp(func, "vnetInit")) {
vnetConfig *a = va_arg(al, vnetConfig *);
char *b = va_arg(al, char *);
char *c = va_arg(al, char *);
char *d = va_arg(al, char *);
int e = va_arg(al, int);
if (!a || !b || !c || d<0) {
fail=1;
}
}
va_end(al);
if (fail) {
logprintfl (EUCAERROR, "INTERNAL ERROR: incorrect input parameters to function %s\n", func);
return(1);
}
return(0);
}