- 1
- 2
- 3
- 4
- 5
- 6
- 7
if (preg_replace("/[\D]+/" , '', $word)) {
$word = str_replace('.','',$word);
$word = str_replace(',','',$word);
$word = str_replace(' ','',$word);
$word = str_replace('$','',$word);
$word = str_replace('*','',$word);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+177
if (preg_replace("/[\D]+/" , '', $word)) {
$word = str_replace('.','',$word);
$word = str_replace(',','',$word);
$word = str_replace(' ','',$word);
$word = str_replace('$','',$word);
$word = str_replace('*','',$word);
}
Увидев первую строчку я уж обрадовался, оказалось рано.
+165
try {
$newUserId = $users->insert($data);
} catch (Exception $e) {
if ($e->getCode() == '23000') {
$this->customRedirect(
array(
'notice',
'User already exists',
)
);
return;
} else {
throw new Exception(null, null, $e);
}
}
Быстрая проверка на уникальность.
+167
if (is_file($GLOBALS['fldr']."modules/sell/images/items/small_".str_replace("<img src=http://www.site.ru/modules/sell/images/items/small_", "", str_replace(" border=0>","",$M['icon'])))) {
echo "<a href='".$GLOBALS['fldr']."marki/models/object/current/index.php?id=".$M['id']."'>".replace_icon($M['icon'])."</a>";
}
function replace_icon($var) {
return str_replace("<img src=http://www.site.ru/modules/sell/images/items/", "<img src=".$GLOBALS['fldr']."modules/sell/images/items/?img_name=", $var);
}
Мы легких путей не ищем...
+146
if ($url=='/news/index.html')
{
$data = $this->dbf->execute('select * from news where status=1 order by date_add desc,id desc limit 10');
$object->smarty->assign('news_body',$data);
$object->smarty->assign('title','Новости');
} elseif(preg_match('@/news/([0-9]+?)/@i',$url,$out)){
$data = $this->dbf->execute('select * from news where status=1 and id='.intval($out[1]).' order by date_add desc limit 1');
$object->smarty->assign('news_body',$data);
$object->smarty->assign('title','Новости');
} elseif($url=='/search/') {
$data = array();
if ($_POST['search']!='' && strlen($_POST['search'])>6)
{
$data = $this->dbf->execute('select * from pages where content like "%'.mysql_real_escape_string($_POST['search'],$this->dbh->conn).'%" limit 10');
}
$object->smarty->assign('search',$data);
$object->smarty->assign('title','Поиск');
$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
} else {
$data = $this->dbf->execute('select * from pages where link="'.mysql_real_escape_string($url,$this->dbh->conn).'"');
$this->data = $data[0];
$object->smarty->assign('title',$this->data['title']);
$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
}
−122
var mapDress:BitmapData = MathUtils.getTransformationMapTShort(bottomMovie.width, bottomMovie.height, pointFilterTopLeft, pointFilterBezierLeft, point1, pointFilterLimitLeft, pointFilterTopRight, pointFilterBezierRight, point2, pointFilterLimitRight, this.clothes[bottomIndex.layer][bottomIndex.child].colored_set[this.clothes[bottomIndex.layer][bottomIndex.child].currentColorVariant].variants[this.clothes[bottomIndex.layer][bottomIndex.child].currentWearVariant][this.currentView].arm_points_right, this.clothes[bottomIndex.layer][bottomIndex.child].colored_set[this.clothes[bottomIndex.layer][bottomIndex.child].currentColorVariant].variants[this.clothes[bottomIndex.layer][bottomIndex.child].currentWearVariant][this.currentView].arm_points_left);
"752 см позитива!"
−122
this.cutUnderLineAndG((this.getChildAt(bottomIndex.layer) as MovieClip).getChildAt(bottomIndex.child) as MovieClip, point1, point2, pointG, this.clothes[bottomIndex.layer][bottomIndex.child].colored_set[this.clothes[bottomIndex.layer][bottomIndex.child].currentColorVariant].variants[this.clothes[bottomIndex.layer][bottomIndex.child].currentWearVariant][this.currentView].arm_points_right, this.clothes[bottomIndex.layer][bottomIndex.child].colored_set[this.clothes[bottomIndex.layer][bottomIndex.child].currentColorVariant].variants[this.clothes[bottomIndex.layer][bottomIndex.child].currentWearVariant][this.currentView].arm_points_left);
Нет слов...
+147
function rating() {
@session_start();
session_register ("set_ms");
if (isset($_SESSION['set_ms'])) {
return false; // старый посетитель
} else {
@session_start();
session_register ("set_ms");
$_SESSION['set_ms'] = rand(10000, 99999);
return true; // новый посетитель
};
}
+165
$menu_string = "Список устройств=sp_ustr.php~Список пользователей=sp_cl.php~Список параметров=sp_p_param.php~Список компаний=sp_comp.php~Список ролей=sp_rol.php~Список параметров отчетов=sp_repparam.php~Список наименований датчиков=sp_sensors.php~Список групп=sp_groups.php~Список пользовательских настроек=spn_cl.php~Просмотр активаций=sp_activ.php~Выбрать организацию=vb_org.php~Экспресс-отчеты=sp_report.php".$st;
$menu = explode("~",$menu_string);
//~Оповещение=soobsh.php~Добавить лицензию=D_lic.php~Выгрузка данных=dat_out.php~Отчеты=otch.php~Експресотчеты=sp_report.php~Параметры датчиков=sp_param.php~Удаленное управление=connect.php~Активация программы=d_activ.php~Параметры отчетов=sp_repparam.php
for ($i=0; $i < count($menu); $i++) {
$menu_1 = explode("=",$menu[$i]);
if (2 == count($menu_1)) {
echo "<a href=",$menu_1[1],">",$menu_1[0],"</a><br>";
} else {
echo "<a href=index-",$i+1,".php>",$menu_1[0],"</a><br>";
};
};
нужно сделать на сайте простое статическое меню.
вот как, элегантно было решено сделать =)))
+171
// ИЗМЕНЕНИЕ ПАРОЛЯ
if (isset($_POST['password'])) {
$password = $_POST['password'];
if ($password == '') exit("Вы не ввели пароль");
if (strlen($password) < 3)
exit ("Пароль должен состоять не менее чем из 3 символов.");
$password = md5($password);
$password = $password."b3p6f";
$result2 = mysql_query("UPDATE users SET password='$password' WHERE email='$old_email'");
if ($result2 == 'TRUE')
echo "<html>
<head>
<meta http-equiv='Refresh' content='5; URL=page.php?id=".$_SESSION['id']."'>
</head>
<body>
Ваш пароль изменен! Вы будете перемещены через 5 сек. Если не хотите ждать, то
<a href='page.php?id=".$_SESSION['id']."'>
нажмите сюда.
</a>
</body>
</html>";
}
Код из серии "Шоколадные шедевры"
+176
$query = "
SELECT `ord`.*,`cus`.`existing_phone_number`,`cus`.`nova_jednotka`,
`cus`.`order_phone`,`cus`.`custom_delivery_date`, `cus`.`delivery_address`,
`cus`.`invoice_address`, `cus`.`invoice_street`, `cus`.`invoice_street_number`,
`cus`.`invoice_city`, `cus`.`invoice_zip`
FROM ".(!empty($_GET["copy_view"]) && $_GET["copy_view"] == 1 ? "`orders`" : "`".$this->table."`")." AS `ord`,
`products`, `navigace`, `customers` AS `cus`
WHERE `ord`.`order_id` = ".$order_id."
AND `ord`.`id_produktu_db` = `products`.`id`
AND `products`.`navigace_polozka_id` = `navigace`.`id`
AND `cus`.`id` = `ord`.`customers_id`
union all
select
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null,
'', tp.description, tp.product_id, tp.activation_price, tp.activation_price_EUR,
0, tor.pocet_kusu, tp.name, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null
from tarifs_prop tp
inner join tarifs_orders tor on tp.id = tor.tarif_prop_id
where tor.order_id = ".$order_id."
union all
select
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, '', b.description, b.product_id, b.activation_price, b.activation_price_EUR,
0, tor.pocet_kusu, b.name, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null, null, null, null, null
from balicky b
inner join tarifs_orders tor on b.id = tor.tarif_balicek_id
where tor.order_id = ".$order_id."
ORDER BY `user_id` desc";
а филе нам кабанам, надо продукты из разных таблиц объединить в одну, ну и фто што таблицы разного размера. Зато когда добавляешь новый столбец в таблицу, нужно вручную считать сколько раз нужно добавить null :D