-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+152
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
public static function fetchData($query)
{
$data = array();
for($i = 0; $i < mysql_num_rows($query);$i++)
{
$data[] = mysql_fetch_assoc($query);
}
return $data;
// while($temp = mysql_fetch_assoc($query)){
// $data[] = $temp;
// }
// return $data;
}
Elenberg,
15 Ноября 2011
-
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
$er = array();
$file1=$config['tpl_dir'].$config['general']['site_template'].'/style/catalog.css';
$file2=$config['tpl_dir'].$config['general']['site_template'].'/module/catalog.html';
$file3=$config['tpl_dir'].$config['general']['site_template'].'/module/catalog_read.html';
$file4='modules/catalog/setup_catalog/table_catalog.MYD';
$file5='modules/catalog/setup_catalog/table_catalog_cats.MYD';
$file6='modules/catalog/setup_catalog/table_catalog_comments.MYD';
$file7='modules/catalog/setup_catalog/table_catalog_rating.MYD';
if(file_exists($file1)==True) {}else{$er[]="нет файла стилей <b>\"catalog.css\"</b> <br> он должен находиться в<b> $file1</b>"; }
if(file_exists($file2)==True) {}else{$er[]="нет файла дизайна <b>\"catalog.html\"</b> <br> он должен находиться в<b> $file2</b>"; }
if(file_exists($file3)==True) {}else{$er[]="нет файла дизайна <b>\"catalog_read.html\"</b> <br> он должен находиться в<b> $file3</b>"; }
if(file_exists($file4)==True) {}else{$er[]="нет файла таблицы <b>\"table_catalog.MYD\"</b> <br> он должен находиться в<b> $file4</b>"; }
if(file_exists($file5)==True) {}else{$er[]="нет файла таблицы <b>\"table_catalog_cats.MYD\"</b> <br> он должен находиться в<b> $file5</b>"; }
if(file_exists($file6)==True) {}else{$er[]="нет файла таблицы <b>\"table_catalog_comments.MYD\"</b> <br> он должен находиться в<b> $file6</b>"; }
if(file_exists($file7)==True) {}else{$er[]="нет файла таблицы <b>\"table_catalog_rating.MYD\"</b> <br> он должен находиться в<b> $file7</b>"; }
Установщик модуля. Условия проверки доставляют: бул сравнимаем с булом (и получаем бул), вместо отрицания держим еще одну ветку условия.
Мартин,
12 Ноября 2011
-
+159
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
function get_selection()
{
selection = "";
if (document.getSelection)
{
selection = document.getSelection();
selection = selection.replace(/\r\n\r\n/gi, "_doublecaret_");
selection = selection.replace(/\r\n/gi, " ");
while(selection.indexOf(" ") != -1)
selection = selection.replace(/ /gi, "");
selection = selection.replace(/_doublecaret_/gi, "\r\n\r\n");
}
else
if (document.selection) { selection = document.selection.createRange().text; }
return selection;
}
bugmenot,
11 Ноября 2011
-
+122
- 1
- 2
if (!0.Equals(callResult.ValueOf("@retValue"))) // оба инт'ы
...
Мы не ищем легких путей сравнения.
fr0mrus,
11 Ноября 2011
-
+156
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
//Redirect Using JAVASCRIPT
function redirect_to($url){
echo '<script type="text/javascript">
window.location = "'.$url.'"
</script>';
exit("Javascript is turned off, <a href='$url'>click here to go to requested page</a>");
}
Может в кучу надо было?http://forum.antichat.ru/threadnav19997-48-10.html
bot-minurast,
02 Ноября 2011
-
+130
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
public void ExportOrderDetails()
{
char comma = ',';
StringBuilder sb = new StringBuilder();
string line = "";
line += "Order No" + comma;
line += "Customer" + comma;
line += "Order Date" + comma;
line += "Order Status" + comma;
line += "Subtotal" + comma;
line += "Tax Total" + comma;
line += "Shipping Cost" + comma;
line += "Shipping Method" + comma;
line += "Order Total" + comma;
line += "Payment Method" + comma;
line += "Total Quantity" + comma;
line += "Date Shipped" + comma;
line += "Tracking No" + comma;
line += "Order Currency Code" + comma;
line += "Exchange Rate" + comma;
line += "Billing First Name" + comma;
line += "Billing Last Name" + comma;
line += "Billing Company" + comma;
line += "Billing Address" + comma;
line += "Billing Address 2" + comma;
line += "Billing City" + comma;
line += "Billing Zip" + comma;
line += "Billing State Code" + comma;
line += "Billing Country ISO2" + comma;
line += "Billing Phone" + comma;
line += "Billing Phone 2" + comma;
line += "Billing Email" + comma;
line += "Shipping First Name" + comma;
line += "Shipping Last Name" + comma;
line += "Shipping Company" + comma;
line += "Shipping Address" + comma;
line += "Shipping Address 2" + comma;
line += "Shipping City" + comma;
line += "Shipping Zip" + comma;
line += "Shipping State Code" + comma;
line += "Shipping Country ISO2" + comma;
line += "Shipping Phone" + comma;
line += "Shipping Phone 2" + comma;
line += "Shipping Email" + comma;
line += "Combined Product Weight" + comma;
line += "Product Qty" + comma;
line += "Product SKU" + comma;
line += "Product Name" + comma;
line += "Product Variation Details" + comma;
line += "Product Unit Price" + comma;
line += "Product Unit Cost" + comma;
line += "Product Weight" + comma;
line += "Product Total Price" + comma;
line += "Product Total Cost" + comma;
sb.AppendLine(line.Remove(line.Length - 1));
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=orders-details-" + DateTime.Now.ToString("yyyy-MM-dd") + ".csv");
Response.ContentEncoding = Encoding.Default;
Response.Write(sb.ToString());
Response.End();
}
Норм так)
sergfreest,
01 Ноября 2011
-
−119
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
switch(budget.statusKey)
{
case BudgetMetadata.STATUS_COMPLETE:
enableAccept = true;
enablePublish = false;
enableExport = true;
break;
case BudgetMetadata.STATUS_ACCEPTED:
enableAccept = false;
enablePublish = true;
enableExport = true;
break;
case BudgetMetadata.STATUS_PROGRESS || BudgetMetadata.STATUS_REVIEW ||
BudgetMetadata.STATUS_REJECTED || BudgetMetadata.STATUS_PUBLISHED:
enableAccept = false;
enablePublish = false;
enableExport = true;
break;
default:
enableAccept = false;
enablePublish = false;
enableExport = false;
break;
}
Привет ис Сан Диего :) Не знаю, как у них работало, я как ни соберу - VerifyError, но один рабочий экземпляр сохранил.
wvxvw,
31 Октября 2011
-
+163
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
function normal_date($date, $separator) {
$now_time=time();
$game_time=getdate($date);
$ret = $game_time['year']."$separator".$game_time['mon']."$separator".$game_time['mday']." ".$game_time['hours'].":";
$str_min=(string) $game_time['minutes'];
if (strlen($str_min)==1) {$ret.= "0".$game_time['minutes'];} else {$ret.= $game_time['minutes'];}
return $ret;
}
function normal_date_br($date, $separator) {
$now_time=time();
$game_time=getdate($date);
$ret = $game_time['year']."$separator".$game_time['mon']."$separator".$game_time['mday']."\n".$game_time['hours'].":";
$str_min=(string) $game_time['minutes'];
if (strlen($str_min)==1) {$ret.= "0".$game_time['minutes'];} else {$ret.= $game_time['minutes'];}
return $ret;
}
От везет. Следующий же файл в очередной фиксации проекта открыл и сразу наткнулся. Играем в веселую игру - найти 10 отличий!
zloiia,
30 Октября 2011
-
+173
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
foreach ($shops as $shop) {
if($merch["id"] == $shop["id_user"]){
switch ($shop["weekday"]){
case 0: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 1: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 2: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 3: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 4: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 5: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 6: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
}
}
}
Коммерческий продукт.
FUUU~~~
darth_ixis,
29 Октября 2011
-
+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
if (copy($file, $jBase_url . "/img/albums/".$new_name))
echo "Файл загружен! <br>";
else echo "Файл НЕ был загружен.";
$result = mysql_query ("INSERT INTO photos(name,img,albums)
VALUES ('$name','".$jBase_url."/img/albums/$new_name','$albums_id')");
if($result == 'true')
{
echo "<b>Данные успешно добавлены</b><br />";
echo "<a href='index.php'>Перейти на главную</a>";
exit;
}
else
{
echo "Ошибка при добавлении в БД";
}
Внимание вчитайтесь... Главное заметьте, что если файл не загружен, то запись перестаёт иметь всякий смысл... Что мы видим на практике? Про сам код я в обще промолчу, тут не гавнокод, а «дерьме», «дрыстня» настоящая.
nethak,
28 Октября 2011