- 1
$weekday = date("l", strtotime(date("Y-m-d", time() - 3600 * 24 * (date("w") - $day))));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+168
$weekday = date("l", strtotime(date("Y-m-d", time() - 3600 * 24 * (date("w") - $day))));
Определение дня недели но порядковому номеру.
+161
if
(
!(
(
strlen($chld_phone) == 10 &&
(
substr($chld_phone,0,3) == '087' ||
substr($chld_phone,0,3) == '088' ||
substr($chld_phone,0,3) == '089'
)
) ||
(
strlen($chld_phone) == 12 &&
(
substr($chld_phone,0,5) == '35987' ||
substr($chld_phone,0,5) == '35988' ||
substr($chld_phone,0,5) == '35989'
)
)
)
)
{
//Грешка
}
Телефон проверки :)
+158
<?
//include('../root/start.php');
include('start.php');
$hotels_menu_id = GetSettingsParam('hotels_menu_id');
if ($image_id = $_GET['image_id']) {
$row = mysql_fetch_assoc(mysql_query(
'select co.id co_id, co.title co_title, ' .
'ci.id ci_id, ci.title ci_title, ' .
'h.id h_id, h.title h_title ' .
'from ' . _mysql_tbl_prefix . 'countries co ' .
'left join ' . _mysql_tbl_prefix . 'cities ci on co.id = ci.country_id ' .
'left join ' . _mysql_tbl_prefix . 'hotels h on ci.id = h.city_id ' .
'left join ' . _mysql_tbl_prefix . 'hotel_images hi on hi.hotel_id = h.id ' .
'where hi.image_id = ' . $image_id));
echo mysql_error();
# $src = '../../hotel_images/'.(int)($image_id/2000).'/'.$image_id.'.jpg';
$src = './hotel_images/' . (int) ($image_id / 2000) . '/' . $image_id . '.jpg';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Фото отеля "<?= $row['h_title'] ?>" (<?= $row['ci_title'] . ', ' . $row['co_title'] ?>) - Туроператор</title>
</head>
<link rel="stylesheet" href="../hotel_image.css">
<body>
<table height="100%" width="100%">
<tr>
<td valign="middle" align="center">
<h1 class="hotel-image-title"><?=
'Фото отеля "<a href="../index.php?menu_id=' . $hotels_menu_id . '&hotel_id=' . $row['h_id'] . '">' . $row['h_title'] . '</a>" ' .
'(<a href="../index.php?menu_id=' . $hotels_menu_id . '&city_id=' . $row['ci_id'] . '">' . $row['ci_title'] . '</a>, ' .
'<a href="../index.php?menu_id=' . $hotels_menu_id . '&country_id=' . $row['co_id'] . '">' . $row['co_title'] . '</a>)'
?></h1>
<a href="#" onClick="window.close()"><img src="<?= $src ?>" class="hotel-image" alt="Фото отеля "<?= $row['h_title'] ?>" (<?= $row['ci_title'] . ', ' . $row['co_title'] ?>)"></a>
</td>
</tr>
</table>
</body>
</html>
Попросили так сазать исправить))
я был ошеломлен "магическим числом" 2000
+157
<?php
echo '
<form method="POST" action="">
<input type="submit" name="sub" value="Отправить">
</form>
';
$sub=$_POST['sub'];
if ($sub==true){
function rand_foto($patch = "images")
{
if(!$dir = opendir($patch)) return "images";
while(($t = readdir($dir)) !== false)
{
$ext = substr(strrchr($t,'.'), 1);
if(is_file($t) && ($ext == "gif") || ($ext == "jpg") || ($ext == "png"))
{
$filename[] = $patch."/".$t;
}
}
closedir($dir);
$index = rand(0, count($filename) - 1);
$foto = "<img src=".$filename[$index].">";
return $foto;
}
echo rand_foto(); }
+178
if($active_days > 4)
{
$active_days = 1;
}
else
{
if($active_days > 5)
{
$active_days = 1;
}
}
В цикле
+164
foreach($code_array as $code)
{
$code*=1; //это не тупизм, это самый легкий способ получить из строки число без возможных пробелов
if($code==$_POST["code"])
{
$flag=true;
break;
}
}
intval отменили похоже
+159
class forms {
//put your code here
function __construct($name,$id,$method,$action) {
echo "<form id='$id' name='id' method='$method' action='$action'>";
}
static private function attr($param) {
if ($param) {
foreach ($param as $nam_attr => $val_attr) {
$attribs.=$nam_attr."='".$val_attr."'";
}
return $attribs;
}
}
static private function label($id,$text,$attr) {
$key = array_search('regue', $attr, true);
if ($key = 1) $text.="<font color='red'>*</font>";
return "<label for='$id'>$text</label>";
}
static public function inputs($text,$type,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<input type='$type' name='$name' id='$id' value='$value' class='$class' ".self::attr($attr)."/>";
}
static public function inputs_chek($text,$type,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<input type='$type' name='$name' id='$id' class='$class' ".self::attr($attr)."/>$value";
}
static public function area($text,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<TEXTAREA NAME='$name' id='$id' WRAP='virtual' COLS='40' ROWS='3' ".self::attr($attr).">$value</TEXTAREA>";
}
static public function select($text,$name,$id,$value=false,$class=false, $attr=false) {
$select="<select name='$name' id='$id' ".self::attr($attr).">";
foreach($value as $value => $val_text) {
$select.="<option value='$value'>$val_text</option>";
}
$select.="</select>";
return self::label($id,$text,$attr).$select;
}
function __destruct() {
echo "<input type='submit'/><input type='reset' value='Очистить'></form>";
}
}
+163
// what version of MySQL
$mysql = $db->query_first("SELECT VERSION() AS version");
$mysql = $mysql['version'];
// Post count
$posts = $db->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "post");
$posts = $posts['total'];
// User Count
$users = $db->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "user");
$users = $users['total'];
// Forum Count
$forums = $db->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "forum");
$forums = $forums['total'];
// Usergroup Count
$usergroups = $db->query_first("SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "usergroup");
$usergroups = $usergroups['total'];
// First Forum Post
$firstpost = $db->query_first("SELECT MIN(dateline) AS firstpost FROM " . TABLE_PREFIX . "post");
$firstpost = $firstpost['firstpost'];
// Last upgrade performed
$lastupgrade = $db->query_first("SELECT MAX(dateline) AS lastdate FROM " . TABLE_PREFIX . "upgradelog");
$lastupgrade = $lastupgrade['lastdate'];
от туда же
плять... сюда надо весь форум постить
нахер архив сношу к еб**ям
+162
if ($_POST['do'] == 'kill')
{
// update users who are in this usergroup to be in the registered usergroup
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET displaygroupid = 0 WHERE displaygroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "useractivation SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "subscription SET nusergroupid = -1 WHERE nusergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "subscriptionlog SET pusergroupid = 2 WHERE pusergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "userban SET usergroupid = 2 WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("UPDATE " . TABLE_PREFIX . "userban SET displaygroupid = 0 WHERE displaygroupid = " . $vbulletin->GPC['usergroupid']);
// now get on with deleting stuff...
$db->query_write("DELETE FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "forumpermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "ranks WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "usergrouprequest WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "userpromotion WHERE usergroupid = " . $vbulletin->GPC['usergroupid'] . " OR joinusergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "imagecategorypermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "attachmentpermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "prefixpermission WHERE usergroupid = " . $vbulletin->GPC['usergroupid']);
vBulletin 4.0.4
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
+160
<?php
//дата и время.
$date1 = date('d.m.Y');
$date2 = date('H:i:s');
//$i - счётчик пользователей, $cnt - то, что будем выводить (в завершении)
//$uall - Ссылки на пользователей онлайн
$i = 0;
$cnt = NULL;
$uall = NULL;
$db->query = "SELECT id, nick, timeof, online FROM ".$GLOBALS['pref']."users";
$qonl = $db->query();
$cnt .= "Всего участников ";
while ($usronl = $db->farray($qonl)) {
if ($usronl['online'] == TRUE) {
$ar = explode("|:|", $usronl['timeof']);
//Если сегодняшняя дата
if ($ar[0] === $date1) {
$est = explode(":", $ar[1]);
$tm = explode(":", $date2);
$m4 = $est[0] - $tm[0];
$m5 = $tm[1] - $est[1];
$m6 = "$m5";
if (($est[0] === $tm[0]) && (($m5 <= 15))) {
if ($i > 0) { $p = ","; } else { $p = NULL; }
if ($i == 1) { $s = ","; } else { $s = NULL; }
$i++;
$uall .= $s."<a href=\"http://".$GLOBALS['url']."/users/
profile/".$usronl['id']."/\" title=\"Посмотреть профиль\">".$usronl['nick']."<
/a>".$p." ";
} elseif (($m4 == -1) && ($m6{0} === "-" && $m5 <= -45)) {
if ($i > 0) { $p = ","; } else { $p = NULL; }
if ($i == 1) { $s = ","; } else { $s = NULL; }
$i++;
$uall .= $s."<a href=\"http://".$GLOBALS['url']."/users/
profile/".$usronl['id']."/\" title=\"Посмотреть профиль\">".$usronl['nick']."<
/a>".$p." ";
}
}
}
} //end while
if ($i == 0) {
$uall .= "никого";
} else {
$co = strlen($uall);
$uall = substr($uall, 0, $co - 7);
$uall .= ".";
}
$cnt .= "(".$i."):<BR>".$uall;
?>
Писал вывод онлайн посетителей на сайте в 2009 году.