- 1
- 2
- 3
- 4
$_POST['img_src'] = explode("/", "", $_POST['img_src']);
$_POST['img_src'] = $_POST['img_src'][count($_POST['img_src'])-1];
$_POST['img_src'] = str_replace("_1", "", $_POST['img_src']);
$user_file->tmp_insert($_POST['img_src']);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+164
$_POST['img_src'] = explode("/", "", $_POST['img_src']);
$_POST['img_src'] = $_POST['img_src'][count($_POST['img_src'])-1];
$_POST['img_src'] = str_replace("_1", "", $_POST['img_src']);
$user_file->tmp_insert($_POST['img_src']);
Магия...
+157
$query = "SELECT * FROM records WHERE id_film='$id_film'";
$results = mysql_query($query);
$var1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$var1 = $var1. "<playlist>\n";
while($line = mysql_fetch_assoc($results))
{
$tmp_us = $tmp_us.$line['id_user'];
$var1 = $var1."<vid src=\"http://homelinux.com:8080/sample1/content/audiorecord/"
. $line['id_user']
."/"
. $line["file_name"]
."_d.flv"
. "\" label=\""
. $line["file_name"]
."\""
." id_film=\""
. $line["id_film"]
."\""
." time_begin=\""
. $line["time_begin"]
."\""
." time_end=\""
. $line["time_end"]
."\""
." id_user=\""
. $line["id_user"]
."\""
." sh_val=\""
. $line["sh_val"]
."\""
." id_record=\""
. $line["id_record"]
."\""
."/>\n";
}
$var1 = $var1."</playlist>\n";
echo "var1=$var1";
Вот так некоторые Flash-еры формируют xml пакеты
+160
function Add($WEB_FORM_ID, $arrVALUES=false, $CHECK_RIGHTS="Y", $USER_ID=false)
{
global ... $_REQUEST, ...;
...
}
Битрикс
+162
$str = strip_tags(htmlentities($str));
простовато, но...
Тэги не пройдут!!!
+158
$where = "(`user_id` = ".$id." and `user_fr` = ".$user->Get('u_id').") or (`user_id` = ".$user->Get('u_id')." and `user_fr` = ".$id.")";
$inc = array_merge($db->Select('friends', $where), $db->Select('friends_incoming', $where));
Проверка на существования дружбы или предложений дружбы между двумя пользователями (каунтом $inc).
+162
<?
if ($_GET['view'] == 'login') {
$_POST[email2] = htmlspecialchars(stripslashes($_POST[email]));
$_POST[pass2] = htmlspecialchars(stripslashes($_POST[pass]));
if($_POST['email'] == $_POST['email2'] && $_POST['pass'] == $_POST['pass2']) {
if($_POST['email2'] && $_POST['pass2']) {
$result_310 = mysql_query("SELECT * FROM `gameuser` WHERE `emailx` = '$_POST[email2]'");
$zapros_310 = mysql_fetch_array($result_310);
if($zapros_310['emailx']) {
if($zapros_310['passwordx'] != '' && $zapros_310['passwordx'] == md5($_POST['pass2'])) {
$ipd1 = $_SERVER["REMOTE_ADDR"];
$result_105 = mysql_query("SELECT * FROM `ipblock` WHERE `ip` = '$ipd1'");
$zapros_105 = mysql_fetch_array($result_105);
if($zapros_105['id'] == '' && $zapros_105['ip'] != $ipd1) {
setcookie("iduser", $zapros_310['id']);
setcookie("emailuser", $zapros_310['emailx']);
setcookie ("passuser", $zapros_310['passwordx']);
if($_COOKIE['code'])
if($_COOKIE['code'] != $zapros_310['id'])
mysql_query("INSERT INTO `statistic2` (info, date) VALUES ('".$_COOKIE['code']." change on ".$zapros_310['id']."', now());");
setcookie("code", $zapros_310['id'], time() + 2419200);
$http_host5 = $_SERVER['HTTP_HOST'];
if ($http_host5 == 'dreamdivision.ru') {$http_host5 = "www.dreamdvision.ru";}
if ($http_host5 == 'dreamdivision.ru') {$http_host5 = "www.dreamdivision.ru";}
if($zapros_310['id'] != '1') {$result_311 = mysql_query("UPDATE `gameuser` SET `ip` = '".$_SERVER["REMOTE_ADDR"]."', `host` = '$http_host5' WHERE `id` = '$zapros_310[id]' LIMIT 1");}
$result_312 = mysql_query("SELECT * FROM `iploguser` WHERE `id` = '$zapros_310[id]'");
$zapros_312 = mysql_fetch_array($result_312);
if($zapros_312['ip'] != $ipd1) {
$result_313 = mysql_query("INSERT INTO `iploguser` ( `ip` , `id` ) VALUES ( '$ipd1', '$zapros_310[id]' );");
}
if ($zapros_310['tpcht'] == '0') {
$href1 = "updates.php";
} else if($zapros_310['tpcht'] == '1'){
$href1 = "main.php";
}
header("Location: $href1");
} else {
$smarty->assign('case', '2');
$smarty->assign('message', 'Пароль не верный.');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
}
} else {
$smarty->assign('case', '2');
$smarty->assign('message', 'Пароль не верный.');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
}
} else {
$smarty->assign('case', '2');
$smarty->assign('message', 'E-mail не верный.');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
}
} else {
$smarty->assign('case', '2');
$smarty->assign('message', 'Заполните все поля.');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
}
} else {
$smarty->assign('case', '2');
$smarty->assign('message', 'E-mail и/или Пароль содержат недопустимые символы.');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
}
}
$smarty->assign('case', '3');
$smarty->display("index.tpl",$user_theme_name,$user_theme_name);
+158
while ($iii<$_POST["nnn"])
{
$Klass = takeYearKlass($Klass,$_POST["vipl_".$iii."ygod"]);
print ("<br>За ".$iii."-й год было ".$_POST["vipl_".$iii."ygod"]." выплат и класс стал ".$Klass);
$iii++;
}
print ("<br><b>Итоговый класс:</b> $Klass");
В добавок к чудному явасрипту (http://govnokod.ru/4929) мне достался и сам код на php....
В прочем там такого добра хватает))) можно и html, и css выложить)))
Как говориться, буду писать еще))
+156
/**
* custom_field_sort used to sort the custom fields array
*/
function custom_field_sort(&$array) {
if(!$array) return $keys;
$keys=func_get_args();
array_shift($keys);
custom_field_sort_func($keys);
usort($array, "custom_field_sort_func");
}
Файл тот же что и http://govnokod.ru/4920, просто следующая функция.
+163
class C
{
...
static function ModulesList()
{
global $config;
return $config;
}
...
}
ООП в действии
+36
//
<?php if (arg(0) == 'taxonomy' && arg(1) == 'term') {
$term = taxonomy_get_term(arg(2));
if ($term->vid == 2) { ?>
LCD TV Listings
<?php } elseif ($term->vid == 1) { ?>
Size LCD TV Listings
<?php } elseif ($term->vid == 8) { ?>
Questions
<?php } elseif ($term->vid == 10) { ?>
LCD TV News
<?php } elseif ($term->vid == 11) { ?>
Related LCD TV News
<?php } ?>
<?php } ?>
Вот такое прямо в шаблоне.... no comments