- 1
- 2
- 3
if ( isset($this->q_param["submit_form_one"]) && is_numeric($this->q_param["submit_form_one"]) && $this->q_param["submit_form_one"] == 1 ){
//тут разный код
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+160
if ( isset($this->q_param["submit_form_one"]) && is_numeric($this->q_param["submit_form_one"]) && $this->q_param["submit_form_one"] == 1 ){
//тут разный код
}
ппц
+147
$delitem = "%[2345]{1,1}[ -]{1,1}[хк]{1,1}|
[2345]{1,1}к.?[ ]{0,1}кв|
[2345]кв.*|
двухкомнатн(ую|ая)|трехкомнатн(ую|ая)|четырехкомнатн(ую|ая)|пятикомнатн(ую|ая)|
ком.?ерческое|земельный|неблаг|ч/дом|частный|комнат[ау]|офис(ное|ы|ные)|склад(ск.е|ы|ов)|комплекс |помещени[ея]|выставочны|станцию технического обслуживания|СТО|дач[ау]|
почас(овая|овой)|ПОЧАС(ОВАЯ|ОВОЙ)|посут|ПОСУТ|суточ|сним(у|ет)|продается|девушк[еи]|жeнщин[ые]|таджику|
[Кк](орсаков|ОРСАКОВ)|[Аа]лександров[с]{0,1}к|[Лл](угово|УГОВО)|[Тт](роицк|РОИЦК)|[Хх](олмск|ОЛМСК)|[Тт](омари|ОМАРИ)|[Пп](оронайск|ОРОНАЙСК)|[Сс](инегорск|ИНЕГОРСК)|[Сс]анаторн(ый|ом)|[Нн](евельск|ЕВЕЛЬСК)|[Дд](олинск|ОЛИНСК)%";
строка:
...ый период в КОРСАКОВЕ 1 комнат...
+165
require_once(Config::Get('path.root.engine').'/lib/internal/ConfigSimple/Config.class.php');
LiveStreet 0.4 — Подключение класса с использованием статического метода этого же класса.
+160
$volum=1200;
$znakov=strlen($text);
$ciklov=$znakov/(4*$volum);
$i1=0;
$iii=0;
if (strlen($text)>0)
{
do
{
$iii++;
$title="Зинедин Зидан. Золотая плешина Зизу. Часть ".$iii;
$a1 = substr($text,$i1,$volum);
$i1=$i1+$volum;
$a2 = substr($text,$i1,$volum);
$i1=$i1+$volum;
$a3 = substr($text,$i1,$volum);
$i1=$i1+$volum;
$a4 = substr($text,$i1,$volum);
$i1=$i1+$volum;
$result_oborud_cat=mysql_query ("INSERT INTO state (title,prew1,prew2,prew3,prew4) VALUES ('$title','$a1','$a2','$a3','$a4')");
}
while ($ciklov>$iii);
}
Найти символ и вырезать из строки
http://www.php.ru/forum/viewtopic.php?t=30404
+137
#include <stdio.h>
#include <math.h>
int main()
{
double i = 9;
i = fabs( i/2 );
while ( --i > 0 );
printf("\n %f \n", i);
if ( i == 0 )
printf ("1\n");
else if ( i == -0.5 )
printf ("2\n");
else
printf ("3\n");
}
"Как определить четность числа типа real (т.е., нецелочисленный тип), без приведения к целому типу и использования остатка целочисленного деления?" Поржав над вопросом, выдавил из себя такое
+116
var sEmailRecipient = string.Empty;
string m_sPhysicalPath = "";
if (SaveType == "both" || SaveType == "email")
{
List<User> recipients = null;
if (RecipentSelectMode == "auto")
{
if (!string.IsNullOrEmpty(AutoRecipient))
recipients = Notification.ConvertToUsers(AutoRecipient, MethodologyId, CurrentObjectId, CurrentUserId, CurrentEntityName);
}
if(RecipentSelectMode == "manual"){
if (Recipient != null)
sEmailRecipient = EvaluateExpression(CurrentUserId, MethodologyId, MainEntityName, MainObjectId, Recipient);
}
m_sPhysicalPath = Document.AbsoluteApplicationPath + "/" + p_sReportPath.Substring(p_sReportPath.LastIndexOf("storage"));
if (RecipentSelectMode == "auto")
{
foreach (User user in recipients)
{
if (Regex.IsMatch(user.Email, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.None))
{
SendReportByEmail(m_sPhysicalPath, user);
}
}
}
if (RecipentSelectMode == "manual")
{
if (Regex.IsMatch(Recipient, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.None))
{
SendReportByEmail(m_sPhysicalPath, new User { Email = sEmailRecipient });
}
else
{
return CreateResult(GetClientData(), "Email message sending failed - incorrect email address - " + Recipient, (int)ReportRenderingFailType.Success);
}
}
}
if (SaveType == "email")
{
FileInfo file = new FileInfo(m_sPhysicalPath);
if (file.Exists)
file.Delete();
}
Отправляет отчет по email
+168
function filetypecheck( $filename )
{
$ext = substr(GetFileExt($filename), 1);
if($ext == 'rar'){ $dtype = 'Архив RAR'; }
if($ext == 'zip'){ $dtype = 'Архив ZIP'; }
if($ext == '7z') { $dtype = 'Архив 7zip'; }
if($ext == 'bz2'){ $dtype = 'BZ2'; }
if($ext == 'cab'){ $dtype = 'CAB'; }
if($ext == 'ace'){ $dtype = 'WinACE'; }
if($ext == 'arj'){ $dtype = '<a class=\"cont\" href=\"http://www.tsf.be/\" target=\"_blank\">ARJ</a>'; }
if($ext == 'jar'){ $dtype = '<a class=\"cont\" href=\"http://www.tsf.be/\" target=\"_blank\">JAR</a>'; }
if($ext == 'gzip'){ $dtype = 'GZIP'; }
if($ext == 'tar'){ $dtype = 'TAR'; }
if($ext == 'tgz'){ $dtype = 'TGZ'; }
if($ext == 'gz'){ $dtype = 'GZ'; }
if($ext == 'gif'){ $dtype = 'GIF'; }
if(preg_match('/jpeg|jpe|jpg/i', $ext)){ $dtype = 'JPEG/JPE/JPG'; }
if($ext == 'png'){ $dtype = 'PNG'; }
if($ext == 'bmp'){ $dtype = 'BMP'; }
if($ext == 'txt'){ $dtype = 'TXT'; }
if($ext == 'sql'){ $dtype = 'SQL'; }
if($ext == 'exe'){ $dtype = 'EXE'; }
if($ext == 'swf'){ $dtype = 'SWF'; }
if($ext == 'fla'){ $dtype = 'FLA'; }
if(preg_match('/flv|f4v|f4p|f4a|f4b/i', $ext)){ $dtype = 'Flash Video (FLV)'; }
if($ext == 'wav'){ $dtype = 'WAV'; }
if($ext == 'mp2'){ $dtype = 'MP2'; }
if($ext == 'mp3'){ $dtype = 'MP3'; }
if($ext == 'mp4'){ $dtype = 'MP4'; }
if(preg_match('/ogv|oga|ogx|ogg/i', $ext)){ $dtype = 'Ogg'; }
if($ext == 'mid'){ $dtype = 'MID'; }
if($ext == 'midi'){ $dtype = 'MIDI'; }
if($ext == 'mmf'){ $dtype = 'MMF'; }
if($ext == 'mpeg'){ $dtype = 'MPEG'; }
if($ext == 'mpe'){ $dtype = 'MPE'; }
if($ext == 'mpg'){ $dtype = 'MPG'; }
if($ext == 'mpa'){ $dtype = 'MPA'; }
if($ext == 'avi'){ $dtype = 'AVI'; }
if($ext == 'mpga'){ $dtype = 'MPGA'; }
if(preg_match('/pdf|pds/i', $ext)){ $dtype = 'Документ Adobe PDF'; }
if(preg_match('/xls|xl|xla|xlb|xlc|xld|xlk|xll|xlm|xlt|xlv|xlw/i', $ext)){ $dtype = 'Документ MS-Excel'; }
if(preg_match('/doc|dot|wiz|wzs|docx/i', $ext)){ $dtype = 'Документ MS-Word'; }
if($ext == 'odt'){ $dtype = 'Текстовый документ OpenDocument'; }
if($ext == 'odg'){ $dtype = 'Графический документ OpenDocument'; }
if($ext == 'odp'){ $dtype = 'Документ презентации OpenDocument'; }
if($ext == 'ods'){ $dtype = 'Электронная таблица OpenDocument'; }
if($ext == 'odc'){ $dtype = 'Документ диаграммы OpenDocument'; }
if($ext == 'odi'){ $dtype = 'Документ изображения OpenDocument'; }
if($ext == 'odf'){ $dtype = 'Документ формулы OpenDocument'; }
if($ext == 'odm'){ $dtype = 'Составной текстовый документ OpenDocument'; }
if(preg_match('/pot|ppa|pps|ppt|pwz/i', $ext)){ $dtype = 'Документ MS-Powerpoint'; }
if($ext == 'rtf'){ $dtype = 'RTF'; }
if(empty($dtype)) $dtype = '';
return $dtype;
}
Цикл "Из одной русской CMS". База описаний к расширениям файлов.
+145
Привет всем! Сегодня один шестиклашка спросил у меня ответ на вопрос для олимпиады... Я, как и мой знакомый зависли от этой задачки.
Была картинка, на которой перечеркнута дорога "B", вот условие:
Путь по дороге к городу отправилась машина.
На пути следования одна из двух дорог оказалась закрытой,а по другой дороге удолось проехать.
Выбири ответ,в котором значение логичиских аеличин верно отражаются текущее состояние проезда по дорогам.
Я подумал, что тут сложного? A = true, b = false - ищу ответ, а его нет. Подумал что задача с подвохом и состояния дороги отвечали на вопрос "Закрыта ли дорога?"
Тогда получается что A = false, b = true... ответили так..
1) А=True,(не В)=True
2) A=False, (Не B)=True
3) A=False, B=True
4) A=False,B=False
Делаем ставки господа! Завтра узнаем правильный ответ!
Делаем ставки господа! Завтра узнаем правильный ответ
+166
if ($redir < 0) {
} else {
echo $redir."\t";
echo "
";
Бывает даже и такое :(
+163
$result = mysql_query("SELECT name FROM joomlabd1.jos_favorit WHERE fav='$Uname' ORDER BY id")
or die("не выцепить" . mysql_error());
$ids = mysql_query("SELECT id FROM joomlabd1.jos_favorit WHERE fav='$Uname'")
or die("не выцепить" . mysql_error());
$key = mysql_query("SELECT `key` FROM joomlabd1.jos_favorit WHERE fav='$Uname'")
or die("не выцепить" . mysql_error());
$rows = mysql_num_rows($result);
$fields = mysql_num_fields($result);
//echo $rows;
//echo $fields;
for ($c=0; $c<$rows; $c++) {
for ($cc=0; $cc<$fields; $cc++) {
// дальше работа с извлеченными данными и много говнокода
А еще можно вот так пробегать по строкам и столбцам результата запроса в БД