- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
$module=(!empty($_GET['mod']))?$_GET['mod']:"static";
if(is_file("modules/".$module.".class.php"))
{
include_once("modules/".$module.".class.php");
}
else
{
include_once("modules/error.class.php");
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+146
$module=(!empty($_GET['mod']))?$_GET['mod']:"static";
if(is_file("modules/".$module.".class.php"))
{
include_once("modules/".$module.".class.php");
}
else
{
include_once("modules/error.class.php");
}
от такая хитрожопая система, позволяющая подгружать "модули"
−85
switch (arr_brick[Y][X].bonus) {
case "1" :
bonus_mc.showBonus.gotoAndStop(1);
break;
case "2" :
bonus_mc.showBonus.gotoAndStop(2);
break;
case "3" :
bonus_mc.showBonus.gotoAndStop(3);
break;
case "4" :
bonus_mc.showBonus.gotoAndStop(4);
break;
case "5" :
bonus_mc.showBonus.gotoAndStop(5);
break;
case "6" :
bonus_mc.showBonus.gotoAndStop(6);
break;
case "7" :
bonus_mc.showBonus.gotoAndStop(7);
break;
case "8" :
bonus_mc.showBonus.gotoAndStop(8);
break;
case "9" :
bonus_mc.showBonus.gotoAndStop(9);
break;
case "10" :
bonus_mc.showBonus.gotoAndStop(10);
break;
case "11" :
bonus_mc.showBonus.gotoAndStop(11);
break;
case "12" :
bonus_mc.showBonus.gotoAndStop(12);
break;
case "13" :
bonus_mc.showBonus.gotoAndStop(13);
break;
case "14" :
bonus_mc.showBonus.gotoAndStop(14);
break;
case "15" :
bonus_mc.showBonus.gotoAndStop(15);
break;
case "16" :
bonus_mc.showBonus.gotoAndStop(16);
break;
}
bonAnim(bonus_mc, arr_brick[Y][X].bonus);
}
+113
if (((productOrder.DataSet).ProductOrder[0].RowState != DataRowState.Deleted) &&
(productOrder.DataSet).ProductOrder[0].IsOrderReferenceNull() &&
WebOrderType.IsIngestion() &&
(ingestOrder != null) && (ingestOrder.IngestOrder.Count > 0) &&
!(ingestOrder).IngestOrder[0].IsOrderReferenceNull()){
(productOrder.DataSet).ProductOrder[0].OrderReference =
(ingestOrder).IngestOrder[0].OrderReference;
}
+168
var count = response.data.length;
var all_count = count;
if(all_count > count) {
count = all_count - count;
}
Уличная магия. О_о (Мапед не мой)
+74
public static int count(String s) {
int res = 0;
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i) == '1') res++;
}
return res;
}
public List<VDictLiability> get(String currency_id, String usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id) {
for(int i = 0;i<5;i++){
int j = 0;
while(j < 32) {
if(count(Integer.toBinaryString(j)) == i) {
String s = Integer.toBinaryString(j);
while (s.length() != 5) {
s = "0" + s;
}
List<VDictLiability> result = get(currency_id, usedTrailer, actualDate, contract_class_id, product_id, risk_object_type_id, s);
if(result.size() > 0) return result;
}
j++;
}
}
return Collections.EMPTY_LIST;
}
public List<VDictLiability> get(String currency_id, String usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id, String mask) {
String territoryCode = App.config.getCurrentBrunchCode().substring(1, 3);
...
HashMap<Double, VDictLiability> map = new HashMap<Double, VDictLiability>();
for (VDictLiability liabilityRow : get()) {
if(!territoryType.equals(liabilityRow.getterritory_type_id()) && !(mask.charAt(4) == '1' && liabilityRow.getterritory_type_id() == null)){
continue;
}
if(actualDate != null && !CompareUtil.isInside(liabilityRow.getstart_date(), liabilityRow.getend_date(), actualDate)){
continue;
}
if(((risk_object_type_id != null && !CompareUtil.isEquals(liabilityRow.getrisk_object_type_id(), risk_object_type_id)) && !(mask.charAt(0) == '1' && liabilityRow.getrisk_object_type_id() == null))){
continue;
}
if(((product_id != null && !CompareUtil.isEquals(liabilityRow.getproduct_id(), product_id)) && !(mask.charAt(1) == '1' && liabilityRow.getproduct_id() == null))){
continue;
}
if(((contract_class_id != null && !CompareUtil.isEquals(liabilityRow.getcontract_class_id(), contract_class_id)) && !(mask.charAt(2) == '1' && liabilityRow.getcontract_class_id() == null))){
continue;
}
if((liabilityRow.getcurrency_id() != null & !CompareUtil.isEquals(liabilityRow.getcurrency_id(), currency_id)) && !(mask.charAt(3) == '1' && liabilityRow.getcurrency_id() == null)){
continue;
}
if(liabilityRow.getis_used_trailer() != SQLUtils.NULL_INTEGER_VALUE & !CompareUtil.isEquals(""+liabilityRow.getis_used_trailer(), usedTrailer)){
continue;
}
map.put(liabilityRow.getvalue(), liabilityRow);
}
ArrayList<VDictLiability> result = new ArrayList<VDictLiability>();
result.addAll(map.values());
...
return result;
}
public List<VDictLiability> get(String currency_id, boolean usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id) {
return get(currency_id, usedTrailer?"1":"0", actualDate, contract_class_id, product_id, risk_object_type_id);
}
Это ад
+158
$s = "insert content (name,description,type,ltype,contract_id) values ('".addslashes($title[$key])."','".addslashes($description)."','".addslashes($type[$key])."','".addslashes($ltype[$key])."','".addslashes($contracts[$key])."')";
$result = mysql_query($s);
$s2 = "select id from content where ((name='".addslashes($title[$key])."')and(description='".addslashes($description)."')) order by id desc limit 1";
//echo $s2;
$result2 = mysql_query($s2);
$id = mysql_result($result2, 0, "id"); // вот id вставленного контента
(facepalm) получение last_insert_id =)
особо порадовало "order by id desc limit 1", учитывая что в таблице `content` поле `name` UNIQUE
+98
procedure TfmAllParams.NInsertParamSelebrationClick(Sender: TObject);
var
str: string;
begin
str := //Новый год
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '01.01.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(1,1,null,null,null) ' +
//День св. Валентина
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '14.02.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(14,2,null,null,null) ' +
//8 марта
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '08.03.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(8,3,' + #39 + 'жін.' + #39 + ',null,null) ' +
//1 мая
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '01.05.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(1,5,null,null,null) ' +
//Пасха
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '04.04.2010' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(4,4,' + #39 + 'Pasha' + #39 + ',2010) ' +
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '24.04.2011' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(24,4,' + #39 + 'Pasha' + #39 + ',2011) ' +
// И 10 таких же запросов на каждый год!
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '24.04.2022' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(24,4,' + #39 + 'Pasha' + #39 + ',2022) ' +
+144
if ($_FILES['file1']['tmp_name'])
{
if($_FILES['file1']['type'] == 'image/gif' or $_FILES['file1']['type'] == 'image/jpeg' or $_FILES['file1']['type'] == 'image/pjpeg' or $_FILES['file1']['type'] == 'image/png')
{
if(move_uploaded_file($_FILES['file1']['tmp_name'], $upload_foto_new))
{
print 1;//good
}
else
{
print 2;//bad
}
}
else
print 3;//wrong format
}
загрузка картинки
+144
<?
//тут был говнокод)
?>
+144
$('.margin20').append(' ').append($('<button>Save</button>');
jquery нам подарил много выдающихся личностей.
вот так мы создаем кнопку. что за класс .margin20 можно догадаться из названия )