- 1
if ($_REQUEST['call']==''){ echo 'Расторжение'; } else echo 'Расторжение';
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162
if ($_REQUEST['call']==''){ echo 'Расторжение'; } else echo 'Расторжение';
+163
$sql = "INSERT INTO loginhistory(id_user)
VALUES('$id_user')"; // create query to db - add new login history
$result = mysql_query($sql) or die("MySQL error: ".mysql_error()); // execute it and save result to variable $result
$sql = "SELECT id
FROM loginhistory
WHERE id_user = '$id_user'
ORDER BY id DESC
LIMIT 1"; // get ID of the last record in loginhostory
$result = mysql_query($sql) or die("MySQL error: ".mysql_error()); // execute this query
Классика (:
+161
<?php
/**
* Cleaning Input Script
* Copyright 2009 - www.pgmr.co.uk - [email protected]
*/
function clean($str) {
if(!get_magic_quotes_gpc()) {
$str = addslashes($str);
}
$str = strip_tags(htmlspecialchars($str));
return $str;
}
?>
"Универсальная функция для защиты сайта от XSS, SQL и JS-инъекций."
http://2lx.ru/2011/04/funkciya-dlya-zashhity-sajta-ot-vzloma/
+161
function to_int_convert($num)
{
$arr_num = str_split($num);
$new_num = "";
foreach($arr_num as $key => $value)
if($value == intval($value))
$new_num = $new_num.$value;
return $new_num;
}
+158
foreach ($aa as $key => $value) {
$aa[$key][2] = str_replace(',', '.', $aa[$key][2]);
$aa[$key][3] = str_replace(',', '.', $aa[$key][3]);
$aa[$key][4] = str_replace(',', '.', $aa[$key][4]);
}
+155
function some_function ($aa, $bb) {
$col_names = _cfg::get('ccc');
foreach ($bb as $key => $value) {
$bb[$key][0] = array_search($bb[$key][0], $aa);
$bb[$key][1] = array_search($bb[$key][1], $aa);
foreach ($this->currency_names as $currency_key => $currency_value) {
if ($oil_array[$key][5] == $this->currency_names[$currency_key]['name']) $oil_array[$key][5] = $this->currency_names[$currency_key]['id'];
}
$bb[$key] = array_combine($col_names, $bb[$key]);
}
return $bb;
продолжение с Говнокод #8566
+162
$id = $this->db->fetchCol('SELECT id FROM data;');
$names = $this->db->fetchCol('SELECT name FROM points INNER JOIN data ON points.id = data.point_id_from;');
Zend Db usage
+160
function &GetObject($cls, $p=null, $flags=0)
{ //HIDE($objects,$i,$ext,$n,$v)
static $objects;
if (is_array($cls)) {
$i = null;
foreach($cls as $n=>$v) $i->$n = $v;
$result = &$i;
return $result;
}
if (!($flags&O_NEW) && isset($objects[$cls])) return $objects[$cls];
$ext = new WExtern($cls, 'c');
if (!($flags&O_NEW) && isset($objects[$i=$ext->Id()])) return $objects[$i];
if ($flags&O_INSTANCE) {$x = null; $result = &$x; return $result;}
if (!$ext->Exists()) $ext->Prepare();
if (($flags&O_NOERROR) && !class_exists($ext->c)) {
$co = $ext->c;
$cc = $co{0}.'B'.substr($co,1);
if (($flags&O_NOERROR) && !class_exists($cc)) {
$i = false;
return $i;
} else {
$ext->c = $cc;
}
}
if (!class_exists($ext->c)) {
$co = $ext->c;
$cc = $co{0}.'B'.substr($co,1);
if (!class_exists($cc)) {
$i = false;
return $i;
} else {
$ext->c = $cc;
}
}
$c = $ext->c;
$i = new $c;
if (isset($ext->I) && $ext->I) $i->_I = reset($ext->I); // Instance ID
if (isset($ext->A) && $ext->A) $i->_A = $ext->A; // Alias ID
if (!($flags&O_NEW)) {
$objects[$ext->Id()] = &$i;
if ($ext->Id()!=$cls) $objects[$cls] = &$i;
}
$options = &WConfig::Get('OPTIONS');
if (/*is_a($i, 'wobject')*/ $i instanceof wobject && $options) {
$o = $options;
$c = get_class($i);
do{
$c = strtolower($c);
if (isset($o[$c])) {
$i->o = array_merge($o[$c], isset($i->o) ?$i->o :array());
}
}while($c=get_parent_class($c));
if (isset($ext->A) && isset($o[$ext->A])) $i->o = array_merge(isset($i->o) ?$i->o :array(), $o[$ext->A]);
if ($ext->I && isset($o[$ext->Id()])) $i->o = array_merge(isset($i->o) ?$i->o :array(), $o[$o[$ext->Id()]]);
}
if (is_object($p)) {
if (isset($p->o)) $i->o = array_merge(isset($i->o) ?$i->o :array(), $p->o);
$p = isset($p->c) ? $p->c : null;
}
if (method_exists($i,'Create') && $p!==false) {
call_user_func_array(array(&$i,'Create'), is_array($p) ?$p : (isset($p) ? array($p) : array()));
}
return $i;
}
Одна из базовых функций фремворка.
+166
foreach ($_GET as $xxx => $rvar) { $$xxx = $rvar; }
может боян конешн
+163
if (isset($_GET['last_user']) && (int)$_GET['last_user']){
$last_user = 0;
}else{
$last_user = (int)$_GET['last_user'];
}
no comments.. )