- 1
- 2
- 3
- 4
// поменяем местами get и post
$_REQUEST=$_GET;
$_POST=$_GET;
$_GET=$_REQUEST;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+146
// поменяем местами get и post
$_REQUEST=$_GET;
$_POST=$_GET;
$_GET=$_REQUEST;
хорошее начало. Уже после комментария я стал бояться.
Нет, ну блять,
1. нахуя пытаться менять местами _GET и _POST
2. через _REQUEST (что, переменных что ли мало?)
3. Попутно перетирая нахуй его и чем-то провинившийся _POST со всеми остановками по дороге.
PS каким-то образом кары избежал _GET. Порадуемся хоть за его.
+165
if ($flag == false) {
# на всякий случай
if (false == true) exit;
include «execute.php»;
}
На просторах инета... Какой ещё ВСЯКИЙ СЛУЧАЙ?
+154
$andZip = mysql_real_escape_string(nl2br($filterObj->process(trim(intval($_GET['zip'])))));
+167
$select = $db->select()
->from('advertisement AS a', $columns)
->joinLeft('resid_apt_secondary AS ras', 'ras.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_apt_newly_unready AS ranu', 'ranu.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_apt_newly_ready AS ranr', 'ranr.resid_apartment_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_house AS rh', 'rh.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_cottage AS rc', 'rc.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_house_dacha AS rd', 'rd.resid_house_residental_advertisement_id=a.id', array())
->joinLeft('resid_garage AS rg', 'rg.residental_advertisement_id=a.id', array())
->joinLeft('sec_residental AS sr', 'sr.section_advertisement_id=a.id', array())
->joinLeft('bld_prod_common AS bpc', 'bpc.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_food AS bpf', 'bpf.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_restaurant AS bpr', 'bpr.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_warehouse AS bpw', 'bpw.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_garage AS bpg', 'bpg.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_service_station AS bpss', 'bpss.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_prod_other AS bpo', 'bpo.bld_production_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_any AS boa', 'boa.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_admin AS boad', 'boad.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_sales AS bos', 'bos.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_office_kiosk AS bok', 'bok.bld_office_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_cowshed AS bfc', 'bfc.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_workshop AS bfw', 'bfw.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_chicken_house AS bfch', 'bfch.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('bld_farm_other AS bfo', 'bfo.bld_farm_commercial_advertisement_id=a.id', array())
->joinLeft('gas_station AS gs', 'gs.commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_common AS rpc', 'rpc.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_food AS rpf', 'rpf.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_restaurant AS rpr', 'rpr.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_warehouse AS rpw', 'rpw.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_garage AS rpg', 'rpg.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_service_station AS rpss', 'rpss.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_prod_other AS rpo', 'rpo.room_production_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_any AS roa', 'roa.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_sales AS ros', 'ros.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_off AS roo', 'roo.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_admin AS road', 'road.rm_office_commercial_advertisement_id=a.id', array())
->joinLeft('rm_office_hall_rental AS roh', 'roh.rm_office_commercial_advertisement_id=a.id', array())
->where('is_recycled = ?', 'no')
->where('is_published = ?', 'yes')
->group(array('a.type', 'a.in_archive'));
Переделываем проект. В старой версии нашел следующие строчки.
+164
if(isset( $out[1][2]) && trim($out[1][2]) !='') $arr['ns'].=', '. $out[1][2];
if(isset( $out[1][3]) && trim($out[1][3]) !='') $arr['ns'].=', '. $out[1][3];
if(isset( $out[1][4]) && trim($out[1][4]) !='') $arr['ns'].=', '. $out[1][4];
if(isset( $out[1][5]) && trim($out[1][5]) !='') $arr['ns'].=', '. $out[1][5];
if(isset( $out[1][6]) && trim($out[1][6]) !='') $arr['ns'].=', '. $out[1][6];
if(isset( $out[1][7]) && trim($out[1][7]) !='') $arr['ns'].=', '. $out[1][7];
Нашел на фри-ланс.ру
+164
<a href="?page=news" <?php if (isset($_GET['page'])) if ($_GET['page']=='news') echo 'class="active"' ?> >Новости</a>
<a href="?page=photo" <?php if (isset($_GET['page'])) if ($_GET['page']=='photo') echo 'class="active"' ?> >Фото</a>
<a href="/" <?php if (isset($_GET['page'])); else echo ' class="active"'?> >Главная</a>
Подсветка той ссылки, на которой сейчас находишься (присвоение класса active).
Проверка if (isset($_GET['page'])) сделана для того, чтобы PHP не ругался на то, что page не передан (такое происходит при переходе на главную).
+154
$sections = array_chunk($items, $this->item_limit, true);
$k = 0;
foreach($sections as $key => $items) {
/*.........*/
$name = 'sitemap' . $k . '.xml';
$index['sitemap%'.$k] = array(
'loc' => BASE_URL . $name,
'lastmod' => date('c')
);
/*.........*/
$k++;
}
Видимо я чем-то здорово накидался кода писал это T_T
+166
for($i=0,$n=count($vars);$i<$n;$i++){
eval(' $'.$vars[$i].'=isset($_POST["'.$vars[$i].'"])? addslashes(trim($_POST["'.$vars[$i].'"])) : ""; ');
}
В недрах самописной crm)
+147
sticky: <?php if(isset($gritter->sticky)) echo ($gritter->sticky?'true':'false'); else echo ('false');?>,
часть json'а
+35
$urlpic = strtr("!filebase!filename",
array(
'!filebase' => base_path() . '/' .$filebasepath,
'!filename' => '/'. $valor,
)
) ;
один из модулей для CMS Drupal.
это вам на перевод буля в строку бля