- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$duration_date = date(
'Y-m-d H:i:s',
strtotime(
date(
'Y-m-d H:i:s',
strtotime($_REQUEST['task_start_date'])) . ' + ' . $_REQUEST['task_frequency'] . ' ' . $freq_type . ''
)
);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+150
$duration_date = date(
'Y-m-d H:i:s',
strtotime(
date(
'Y-m-d H:i:s',
strtotime($_REQUEST['task_start_date'])) . ' + ' . $_REQUEST['task_frequency'] . ' ' . $freq_type . ''
)
);
Кто-то может это упростить ? Я уже устал
+149
<?php
if ($update_flag == '1') {
$updat_finished_task = $db->update(
'tbl_user_task',
array(
'is_finished' => '0',
'user_task_update_datetime' => date('Y-m-d H:i:s')
),
'1=1'
);
}
?>
UPDATE
tbl_user
SET
is_finished = [is_finished],
user_task_update_datetime = [data_time]
WHERE 1 = 1
MySQL 5
+151
for($j = 0; $j < count($_REQUEST['option_question']); $j++)
{
$max_id = $db->max_field("tbl_task_option","option_question_id","1=1");
$max_id = $max_id+1;
$tbl_option_insert=array(
'task_id' => $_REQUEST['task_id'],
'subtask_id' => $subtask_id,
'option_question_id' => $max_id,
'option_question' => $_REQUEST['option_question'][$j],
'option_answer' => $_REQUEST['option_ans'][$j][0],
'option_insert_datetime' => date('Y-m-d H:i:s')
);
$task_option_id = $db->insert($tbl_option_insert,"tbl_task_option");
$i = $i + 1;
}
option_question_id INT NOT NULL AUTO_INCREMENT
+149
public function fetchEmployees()
{
global $result, $check_u_id, $second_check_u_id, $query123;
....
+160
$this->request_url = 'h' . 't' . 't' . 'p' . ':' . '/' . '/' . 's' . 'i' . 't' . 'e' . 'p' . 'r' . 'o' . 'f' . '.' . 'n' . 'e' . 't' . '/' . 'c' . 'h' . 'e' . 'c' . 'k' . '_' . 'l' . 'i' . 'c' . 'e' . 'n' . 's' . 'e' . '.' . 'p' . 'h' . 'p';
$this->moduleName = 'w' . 'e' . 'b' . 'A' . 's' . 'y' . 's' . 't' . 'Q' . 'u' . 'i' . 'c' . 'k' . 'S' . 'e' . 'a' . 'r' . 'c' . 'h';
$this->domain_hash = md5('kolu4iy' . $_SERVER['H' . 'T' . 'T' . 'P' . '_' . 'H' . 'O' . 'S' . 'T'] . 'kolu4iy' . $this->moduleName . 'kolu4iy');
Защита на высоте ))))
+162
$count = count($array);
// Говорю коллеге: "У тебя там деление на ноль, исправь".
// После этого появилось следующее...
if ( $count == 0 ) $count = 1;
$result = (int) ((1/$count) * SOME_VALUE1 + SOME_VALUE2);
Код, блять, Хемминга
+150
private function checkCookie(){
if(!isset($_COOKIE['sessid'])) {
$this->userInfo['id'] = 0;
$this->userInfo['isAdmin'] = false;
return false;
}
$id_lenght = strlen($_COOKIE['sessid']) - 32;
$cookie_id = substr($_COOKIE['sessid'],0,$id_lenght);
$cookie_hash = substr($_COOKIE['sessid'],$id_lenght);
$this->registry['db']->heal($cookie_id); // антиинжект
$dbres = $this->registry['db']->query("SELECT password FROM users WHERE user_id = '$cookie_id';")->fetch();
if(md5($dbres['password']) == $cookie_hash){
$this->userInfo['id'] = $cookie_id;
return true;
}
return false;
}
в чем-то гениально
+149
/**
* Проверка блока данных о прайсе
* @param array $d
* @return boolean
* @access private
* @todo добавить проверку существования ppid */
private function _isValidDataPrice($d){
return (array_key_exists("ppid", $d) && is_int($d["ppid"])
&& array_key_exists("enable", $d) && is_bool($d["enable"])
&& array_key_exists("rate", $d) && is_numeric($d["rate"]) && $d["rate"] >= 0.00
&& array_key_exists("sum", $d) && is_array($d["sum"])
&& array_key_exists("value", $d["sum"])
&& is_numeric($d["sum"]["value"])
&& $d["sum"]["value"] >= 0.00
&& array_key_exists("currency", $d["sum"])
&& is_string($d["sum"]["currency"])
&& strlen($d["sum"]["currency"]) == 3
&& array_key_exists("out", $d) && is_array($d["out"])
&& array_key_exists("value", $d["out"])
&& is_numeric($d["out"]["value"])
&& $d["out"]["value"] >= 0.00
&& array_key_exists("currency", $d["out"])
&& is_string($d["out"]["currency"])
&& strlen($d["out"]["currency"]) == 3
&& array_key_exists("percent", $d["out"])
&& is_numeric($d["out"]["percent"])
&& $d["out"]["percent"] >= 0.00);
}
+169
?><tr><?
?><script><?
?>$(function(){<?
?>$('tr[_hash]').find('#smalllinks').click(function(){<?
?>$(this).parent(0).html($(this).parent(0).find('#fulllinks').html());<?
?>});<?
?>$('tr[_hash] #rm').click(function(){<?
?>var _hash=$(this).parent(0).parent(0).attr('_hash');<?
?>$.ajax({<?
?>url:'?a&st&rm='+_hash,<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>});<?
?>$('tr[_hash]').find('#stat_domain').click(function(){<?
?>P_domain=$(this).html();<?
?>get('st');<?
?>});<?
?>});<?
?>function rm_all()<?
?>{<?
?>if(confirm('Удалить всю статистику?'))<?
?>{<?
?>$.ajax({<?
?>url:'?a&st&rmall',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?>}<?
?>function refresh_dom()<?
?>{<?
?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
?>$.ajax({<?
?>url:'?a&st&rdom',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?>function update_pr_tic()<?
?>{<?
?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
?>$.ajax({<?
?>url:'?a&st&upd_pr_tic',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?></script><?
?><td class=n colspan=5><?
?><input type=button value=' Обновить домены ' onclick='refresh_dom()'/> <?
?><input type=button value=' Удалить все ' onclick='rm_all()'/> <?
?><input type=button value=' Обновить PR, тИЦ ' onclick='update_pr_tic()'/> <?
?>(доменов: <b><?=$result_domains_count?></b>) <?
?>Количество: <b><?=$result_count?></b><?
if (!empty($domain))
{
?>, домен <b><?=$domain?></b><?
}
?></td><?
?><td class=n><?
if ($pages_count > 1)
{
?><select id="selpage"><?
for($i=1; $i<=$pages_count; $i++)
{
?><option <?=$i==($page_num+1)?'selected':''?>><?=$i?></option><?
}
?></select><?
}
?></td><?
?></tr><?
Такой вот необычный код мне попался в одном скрипте.
+162
<?php
require_once ("db.php");
$region = $_POST["region"];
$array = mysql_query ("SELECT * FROM city WHERE region = '$region'");
echo "<option value=\"\">Выберете город</option>";
while ($m = mysql_fetch_array($array)){
echo "<option value=\"".$m["alias"]."\" id=\"".$m["id"]."\">".$m["title"]."</option>";
}
Вот такое чудо обрабатывает ajax-запросы в одном из магазинов, что мне приходится допиливать. Святая наивность.