- 1
- 2
- 3
- 4
- 5
- 6
function check_age($date) {
$thatTime=mktime(0,0,0,$date['month'],$date['day'],$date['year']);
$thisTime=time();
$difference=$thisTime-$thatTime;
return($difference/60/60/24/365 > 13);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+138.7
function check_age($date) {
$thatTime=mktime(0,0,0,$date['month'],$date['day'],$date['year']);
$thisTime=time();
$difference=$thisTime-$thatTime;
return($difference/60/60/24/365 > 13);
}
Нужно проверить является ли пользователь с введенной датой рождения старше 13-ти лет
+137.7
$q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
$num_rows = mysql_num_rows($q);
for ($m=0; $m<$num_rows; $m++)
{
$q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
for ($c=0; $c<($num_rows-$m); $c++)
{
$f = mysql_fetch_array($q);
}
echo $f["content"];
}
сортировка
+139.6
class db
{
public function __call($m,$args)
{
$export = array_map(function($v) { return var_export($v,1);},$args);
$str = $m."(".implode(',',$export).");";
$str = escapeshellarg($str);
$str = "/home/robot/db.class.php {$str};";
$answer = `$str`;
eval('$res = '.$answer.';');
@array_walk_recursive($res,function(&$v) { $v = iconv('cp1251','utf-8',$v); });
return $res;
}
}
//сам db.class.php
$db = new db($host,$db,$user,$pass);
eval('$res = $db->'.$argv[1]);
var_export($res);
интерпрайз
+141.6
$nomer_kateg = substr($_POST[kategorii], 0,1);
if($nomer_kateg == '1'){
$shljahv = 'img/nash_kom/zona2/vel/';
$shljahm = 'img/nash_kom/zona2/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='53';
$shur_mal ='80';
}
if($nomer_kateg == '2'){
$shljahv = 'img/nashshar/vel/';
$shljahm = 'img/nashshar/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='53';
$shur_mal ='80';
}
if($nomer_kateg == '3'){
$shljahv = 'img/poloty/perejaslav_2009/big/';
$shljahm = 'img/poloty/perejaslav_2009/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='150';
$shur_mal ='200';
}
if($nomer_kateg == '4'){
$shljahv = 'img/poloty/Podillya_2008/big/';
$shljahm = 'img/poloty/Podillya_2008/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='150';
$shur_mal ='200';
}
Разбираю сайт, который надо полностью переделать. Просто поражаюсь...
+139
<?php
ololo();
exit; die(); break; continue;
function ololo() {
echo 'Оказываеца работает';
}
?>
Мистика
+151
private function GetUnitType($unitType)
{
if($unitType)
if(!UnitType::Exist($unitType))
{
Debug::error("WebPartCommentsList:: UnitType не найден");
exit;
}
else
$this->UnitType = UnitType::GetUnitTypeId($this->UnitType);
}
проверка на существование сущности внутри класса, причём реально $unitType == $this->UnitType
писал ...
+148
if ($_POST['name']!='') {
$name=post_check($_POST['name'],10);
}else {
unset($_POST);
$_SESSION['error']='Не введено имя';
header("location: index.php?mode=registration");
exit;
}
Проверка данных
+149.7
function iz_cifr($a)
{
return ((strlen(addcslashes($a, '0123456789')) == 2 * strlen($a)) && ($a != ''));
}
Индусская проверка на то, состоит ли строка только из цифр
+146
<?php $this->html('headscripts') ?>
<?php if($this->data['jsvarurl' ]) { ?>
<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>
<?php } ?>
<?php if($this->data['pagecss' ]) { ?>
<style type="text/css"><?php $this->html('pagecss' ) ?></style>
<?php }
if($this->data['usercss' ]) { ?>
<style type="text/css"><?php $this->html('usercss' ) ?></style>
<?php }
if($this->data['userjs' ]) { ?>
<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
<?php }
if($this->data['userjsprev']) { ?>
<script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
<?php }
if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
</head>
<body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>
Разработчики википедии обожают php-теги
+151
foreach ($polzavateli as $polzavatel){
$i++;
echo $polzavatel[$i];
}
профессиональный обход массива :)