- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
if(isset($_POST["a"]))
{
$x=print_r($_POST["a"],true);
$x=str_replace(" [","",$x);
$x=str_replace("] => ","",$x);
$x=str_replace("Array","",$x);
$body="\n\n";
$body.=$x;
...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+146.3
if(isset($_POST["a"]))
{
$x=print_r($_POST["a"],true);
$x=str_replace(" [","",$x);
$x=str_replace("] => ","",$x);
$x=str_replace("Array","",$x);
$body="\n\n";
$body.=$x;
...
Отправка письма с содержимым формы.
$_POST["a"] - массив передаваемый из формы
+145
/// <summary>
/// Child border.
/// </summary>
private Border childBorder;
Я бы никогда без комментария не догадался, зачем же это поле
+139.2
Calendar calen = new GregorianCalendar();
calen.setTime(beginDate);
while (!calen.equals(endDate)) {
calen.add(Calendar.DATE,1);
}
+958.8
idString.Length == Guid.NewGuid().ToString.Length()
Самый имхо индусский (см. лукмор) код проверить что строка это Guid
−361.9
mx_internal function columnWordWrap(c: DataGridColumn): Boolean {
if (c.wordWrap == true)
return true;
if (c.wordWrap == false)
return false;
return wordWrap;
}
American Flex project
+183
$gameid = intval($_GET['gameid']);
if (!is_int($gameid)) die ('SQL Injection protection');
+148.3
if($path != goodPath($path))
{
$notfound = true;
}
сферический индус в вакууме
+136.7
if(!connect("call.beeline.ru", "9051234567", "$sound")) { die "Ошибка!";}
else {
echo "Succefully connected!\nTrying to call..";
if(!CallNumber("9051234567")) {die "Cant call number 9051234567!";}
else {
echo "Call to number 9051234567 succefully!";
play("1.mp3"); play("4.mp3"); play("2.mp3");
}
};
шутка юмора
+139.5
if(strncmp(I_CUR->E98,"",sizeof("")-1) != 0)
{
/** Fehler **/
ret=create_error(1,1,"",NULL,NULL);
set_error_msgseg(-1,-1,"CUR",NULL," E98",-1);
if (ret==FEHLER)
return ret;
}
Генератор сорса для одного проекта в очень крупной конторе дает такой код, который должен сообщать об ошибке.
Долго я удивлялся, что ошибок не появляется
if(0 != 0)
+112.5
public void Log(string pSource, string pMessage, EventLogEntryType pEntryType) {
try {
if (!EventLog.SourceExists(pSource)) {
EventLog.CreateEventSource(pSource, "Application");
}
EventLog.WriteEntry(pSource, pMessage, pEntryType);
}
catch (Exception _ex) {
Log("", _ex.ToString(), EventLogEntryType.Error);
}
}
Пишем в лог - постоянно...
Автор находки: http://ayende.com/Blog/archive/2009/03/19/how-not-to-write-a-logger.aspx