- 1
- 2
- 3
- 4
- 5
<?$APPLICATION->IncludeFile(
$APPLICATION->GetTemplatePath("include_areas/contacts.php"),
Array(),
Array("MODE"=>"html")
);?> </div>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+160
<?$APPLICATION->IncludeFile(
$APPLICATION->GetTemplatePath("include_areas/contacts.php"),
Array(),
Array("MODE"=>"html")
);?> </div>
Вот так индусские проггеры из Bitrix показывают контакты сайта.
+170
function formatbytes($file, $type)
{
switch($type){
case "KB":
$filesize = filesize($file) * .0009765625; // bytes to KB
break;
case "MB":
$filesize = (filesize($file) * .0009765625) * .0009765625; // bytes to MB
break;
case "GB":
$filesize = ((filesize($file) * .0009765625) * .0009765625) * .0009765625; // bytes to GB
break;
}
if($filesize <= 0){
return $filesize = 'unknown file size';}
else{return round($filesize, 2).' '.$type;}
}
Вот так мы выводим размер файлика.
+103
var
resStream: TResourceStream;
memStream: TMemoryStream;
DLL: THandle;
tempFile: string;
excel: variant;
wbook: OLEVariant;
begin
if not IsOLEObjectInstalled('Excel.Application') then
begin
MessageBox(Handle, PChar('Для открытия фаблонов форм необходимо установить'+#13+
'Microsoft Excel'), 'Ошибка загрузки формы.', MB_ICONINFORMATION);
exit
end;
tempFile := extractFilePath(paramStr(0))+'DATA\PLUGINS\$temp$.xxx';
if ListView1.Selected = nil then exit;
if not FileExists(ListView1.Selected.SubItems.Strings[2]) then exit;
DLL := loadLibrary(PChar(ListView1.Selected.SubItems.Strings[2]));
if DLL = INVALID_HANDLE_VALUE then begin
freeLibrary(DLL);
exit
end;
resStream := TResourceStream.Create(DLL, 'FORMA', MakeIntResource(10));
memStream := TMemoryStream.Create;
memStream.LoadFromStream(resStream);
if fileExists(tempFile) then deleteFile(tempFile);
memStream.SaveToFile(tempFile);
setFileAttributes(PChar(tempFile), FILE_ATTRIBUTE_HIDDEN or
FILE_ATTRIBUTE_TEMPORARY);
memStream.Free;
resStream.Free;
freeLibrary(DLL);
excel := createOLEObject('Excel.Application');
excel.Visible := TRUE;
wbook := excel.Workbooks.Open(tempFile)
end;
когда-то кому-то в дипломнике вот такое написал. с понтом - подключаем плагины и они в эксель выводят программно новые виды форм. хотя экселевский файл тупо вкомпилен в ресурс библиотеки
+161
switch ($action)
{
case 'error_php':
showError('php'); #
break;
case 'error_short_tag':
showError('tag'); #
break;
case 'index':
showIndex(); #
break;
case 'license':
showLicense(); #
break;
case 'choose':
showChoose(); #
break;
case 'postchoose':
showPostChoose(); #die($action."");
break;
case 'system':
showSystem(); # после выбора цвета макета переходим сюда
break;
case 'build':
showBuild(); # потом сюда
break;
case 'configure':
showConfigure(); # если без структуры идём сюда
break;
case 'uninstall':
showUninstall();
break;
case 'install':
showInstall();
break;
case 'postinstall':
showPostInstall();
break;
case 'vars':
downloadConfigFile();
break;
}
Структурное программирование от авторов инсталлятора NetCat.
+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 точно знают.