if ($year) {
$year=str_replace("'", "`", $year);
$year=intval(stripslashes(htmlspecialchars (substr($year, 0, 30))));
}
if ($month) {
$month=str_replace("'", "`", $month);
$month=intval(stripslashes(htmlspecialchars (substr($month, 0, 30))));
}
if ($limit_from) {
$limit_from=str_replace("'", "`", $limit_from);
$limit_from=intval(stripslashes(htmlspecialchars (substr($limit_from, 0, 30))));
}
?>
ПБК «Урал-Грейт» :: Гостевая книга
Добавить / Full / НОМЕ / RELOAD
// *********************************************************************
//
// Guestbook by Alex oleynichenko [aro@raid.ru] ICQ UIN 7131289 (c) 2001
//
// *********************************************************************
// установка констант гостевой книги
// $yearstart год с которого начинается архив
$yearstart=2001;
// устанавливаем количество выводимых записей на одну страницу
$steppp=20;
// получаем текущие величины
$yearcurrent=date(Y); settype ($yearcurrent, integer);
$monthcurrent=date(m); settype ($monthcurrent, integer);
if (!$day) {
if (isset($year) AND $year!=$yearcurrent) { $k=$day=31; }
else { $day=$k=$dday=date(d); settype ($dday, integer); }
}
else { $k=date("t", mktime(0, 0, 0, $month, 1, $year)); }
if (!month) {
$k=31;
}
if ( $k!=date(d) AND $month==$monthcurrent AND $year==$yearcurrent ) { $k=date(d); }
// *****************************************************************
if ($go!=1) { $year=$yearcurrent;
$month=$monthcurrent;
$limit_from=0;
$limit_skoka=$steppp;
} else { $qwe=1;
$limit_skoka=$steppp;
if (empty($limit_from)) { $limit_from=0; }
if ($year!=$yearcurrent) { $monthcurrent=12; if (empty($month)) { $month=12; } } else { if (empty($month)) { $month=$monthcurrent; }
}
}
$yearecho=$yearstart;
$yearTS = "Г: ";
while ($yearcurrent>
=$yearecho) { if ($yearcurrent==$year) { $yearTS .= "$yearcurrent"; } else { $yearTS .= "$yearcurrent"; } $yearTS .= " | "; $i=0; $yearcurrent--; } $yearecho--; // echo "$yearTS
"; // пытаемси эхнуть месяцы $yearecho=$year; $monTS = "M: "; $i=$monthcurrent; while ($i) { if ($month==$i) { $monTS .= "$i"; } else { if ($monthcurrent!=$month) { $dm=date(d); } else { // $dm=cal_days_in_month(CAL_GREGORIAN,$yearecho,$i); $dm = date("t", mktime(0, 0, 0, $i, 1, $yearecho)); } $monTS .= "$i"; } $monTS .= " | "; $i--; } // echo "$monTS
"; //////////////////////////// // пытаемси эхнуть ДНИ //////////////////////////// $dayTS = "Д: "; /* if (!month) { $k=31; } else { if ($k!=date(d) AND $month==$monthcurrent ) { $k=date(d); } } // if ($k!=date(d) AND $month==$monthcurrent AND !isset($month) ) { $k=date(d); } } */ while ($k) { if ($day==$k) { $dayTS .= "$k"; } else { /* echo "$k"; */ $dayTS .= "$k"; } $dayTS .= " | "; $k--; } $dayTS .= "
"; // echo "$dayTS"; // вывод дней закончен // сконнектились... // выбрали базу... require("../main/_connection.php"); $table_gb="ug_guestbook"; $table_ban="ug_banned"; $rescount = mysql_query ("SELECT count(id) FROM $table_gb WHERE year=$year and month=$month and day=$day ") or die (mysql_error()); $mycount=mysql_fetch_row($rescount); $total=$mycount[0]; // echo $total; // вывод страниц $t=0; $j=0; $pages=ceil($total/$steppp); $lalala=0; $pts = ""; while ($pages) { $pages--; // $j=$pages; if ($pages<10) { $ppp="0".$pages; } else { $ppp=$pages; } if (($limit_from)==($lalala*$steppp)) { $pts .= "$ppp"; } else { $pts .= "$ppp"; } $pts .= " | "; // $j++; $t=$t+$steppp; $lalala++; } $pts .= " [все]
"; echo "Сегодня: ".$pts; // вывод страниц финиш echo "
"; if ($a=='all') { $res = mysql_query ("SELECT * FROM $table_gb WHERE year=$year AND month=$month AND day=$day AND ( newsID IS NULL OR newsID=0 ) ORDER BY id DESC ") or die (mysql_error()); } else { if (empty($day)) { $res = mysql_query ("SELECT * FROM $table_gb WHERE year=$year AND month=$month AND day=$dday AND ( newsID IS NULL OR newsID=0 ) ORDER BY id DESC LIMIT $limit_from, $limit_skoka") or die ("can't query"); // year desc, month DESC, day DESC, time desc } else { $res = mysql_query ("SELECT * FROM $table_gb WHERE year=$year and month=$month and day=$day AND ( newsID IS NULL OR newsID=0 ) ORDER BY id DESC LIMIT $limit_from, $limit_skoka") or die ("can't query"); // year desc, month DESC, day DESC, time desc } } while ($myrow = mysql_fetch_row($res)) { switch ($myrow[2]) { case 1: $month1="Янв"; break; case 2: $month1="Фев"; break; case 3: $month1="Мар"; break; case 4: $month1="Апр"; break; case 5: $month1="Май"; break; case 6: $month1="Июн"; break; case 7: $month1="Июл"; break; case 8: $month1="Авг"; break; case 9: $month1="Сен"; break; case 10: $month1="Окт"; break; case 11: $month1="Ноя"; break; case 12: $month1="Дек"; break; } $str=str_replace("\n", "
", $myrow[9]); // ================= // подсвечиваем мыла $i=0; $tomon=" ".$str." "; $array=explode (" ", $str); $size=sizeof($array); for ($i=0; $i<=$size; $i++) { if ( strpos($array[$i], "@")>=1 and strchr($array[$i], ".") and ((strpos($array[$i], ".")-strpos($array[$i], "@"))>2) and ((strlen($array[$i])-strpos($array[$i], "."))>2) ) { $email[]=$array[$i]; } } $size=sizeof($email); for ($i=0; $i<=$size; $i++) { $needle=$email[$i]; $tomon=str_replace(" $needle ", " ", "$tomon"); } // подсветили мыла // подсвечиваем урлы $i=0; $urlarray=explode (" ", $tomon); $size=sizeof($urlarray); for ($i=0; $i<=$size; $i++) { if ( strstr(strtolower($urlarray[$i]), "http://") and (strlen($urlarray[$i])>7) ) { $url[]=$urlarray[$i]; } else { if (strstr(strtolower($urlarray[$i]), "www.") and (strlen($urlarray[$i])>7)) { $url[]=$urlarray[$i]; } } } $size=sizeof($url); for ($i=0; $i<=$size; $i++) { $needle=$url[$i]; if (strstr(strtolower($needle), "http://")) { $urllink="$url[$i]"; } else { $urllink="http://"."$url[$i]"; } $tomon=str_replace(" $needle ", " $url[$i] ", "$tomon"); } // подсветили урлы // =============== echo "$myrow[5]"; if (!empty($myrow[6])) { echo " ($myrow[6])"; } echo "
"; if (!empty($myrow[7])) { echo "E-mail: []"; } if ((!empty($myrow[8])) and ($myrow[8]!="http://") ) { echo " Home-page: [$myrow[8]]"; } echo "
"; /* $tomon = str_ireplace("регби","баскетбол",$tomon); $tomon = str_ireplace("Регби","Баскетбол",$tomon); $tomon = str_ireplace("рэгби","баскетбол",$tomon); $tomon = str_ireplace("Рэгби","Баскетбол",$tomon); $tomon = str_ireplace("рeгби","баскетбол",$tomon); $tomon = str_ireplace("peгби","баскетбол",$tomon); $tomon = str_ireplace("pегби","баскетбол",$tomon); $tomon = str_ireplace("regbi","basketbol",$tomon); $tomon = str_ireplace("rugby","basketball",$tomon); $tomon = str_ireplace("РЕГБИ","БАСКЕТБОЛ",$tomon); */ // $tomon = str_ireplace("Бля","Извините ",$tomon); // $tomon = str_ireplace("бля","извините ",$tomon); // $tomon = str_ireplace("Мля","Извините ",$tomon); // $tomon = str_ireplace("мля","извините ",$tomon); // $tomon = str_ireplace("Mля","Извините ",$tomon); // $tomon = str_ireplace("mля","извините ",$tomon); echo $tomon; echo "
"; } echo "Страницы: ".$pts.""; echo $yearTS; echo "
"; echo $monTS; echo "
"; echo $dayTS; ?>