// include this file or paste the function into your page
//
// version 1.5a, 2002-11-05
// http://www.alexking.org/software/b2/
function ak_since_last_visit($date_format = "F j, Y @ g:i a", $show_date = 1, $show_posts = 1, $show_comments = 1, $always_show = 0) {
global $tableposts;
global $tablecomments;
$lv_string = '';
// check for cookie
global $HTTP_COOKIE_VARS;
// don't build the string if there was no cookie already set or it was called with parameters to not show posts and not show comments
if (isset($HTTP_COOKIE_VARS["b2lastvisit"]) && !($show_posts != 1 && $show_comments != 1)) {
// convert timestamp to same date format as used in mysql
$last_visit = date("Y-m-d H:i:s", $HTTP_COOKIE_VARS["b2lastvisit"]);
// get counts & set variables
if ($show_posts == 1) {
$count = mysql_query("SELECT COUNT(*) FROM $tableposts WHERE post_date > '$last_visit'");
$posts = mysql_result($count,0);
$lv_string = $lv_string.$posts.' new posts';
}
// show posts count
if ($show_posts == 1 && $show_comments == 1) {
$lv_string = $lv_string.' and ';
}
// show comments count
if ($show_comments == 1) {
$count = mysql_query("SELECT COUNT(*) FROM $tablecomments WHERE comment_date > '$last_visit'");
$comments = mysql_result($count,0);
$lv_string = $lv_string.$comments.' comments';
}
$lv_string = $lv_string.' since your last visit';
// show date
if ($show_date == 1) {
$lv_string = $lv_string.' on '.date($date_format, $HTTP_COOKIE_VARS["b2lastvisit"]);
}
$lv_string = $lv_string.'.';
// display if no new posts or comments?
if ($always_show != 1 && ($posts == 0 && $comments == 0)) {
$lv_string = "";
}
}
// write out the string
echo $lv_string;
}
function ak_new_post($post_id = -1, $html = '
') {
if ($post_id == -1) {
global $id;
$post_id = $id;
}
global $tableposts;
// check for cookie
global $HTTP_COOKIE_VARS;
// don't check if there was no cookie already set
if (isset($HTTP_COOKIE_VARS["b2lastvisit"])) {
$last_visit = date("Y-m-d H:i:s", $HTTP_COOKIE_VARS["b2lastvisit"]);
$post_date = mysql_query("SELECT post_date from $tableposts WHERE ID = '$post_id'");
$post_date = mysql_result($post_date,0);
if ($post_date > $last_visit) {
echo $html;
}
}
}
function ak_new_comments($post_id = -1, $html = '
') {
if ($post_id == -1) {
global $id;
$post_id = $id;
}
global $tablecomments;
// check for cookie
global $HTTP_COOKIE_VARS;
// don't check if there was no cookie already set
if (isset($HTTP_COOKIE_VARS["b2lastvisit"])) {
$last_visit = date("Y-m-d H:i:s", $HTTP_COOKIE_VARS["b2lastvisit"]);
$comment_date = mysql_query("SELECT MAX(comment_date) from $tablecomments WHERE comment_post_ID = '$post_id'");
$comment_date = mysql_result($comment_date,0);
if ($comment_date > $last_visit) {
echo $html;
}
}
}
?>
KS_Josey_Wales Age Of Mythology The Titans Strategy Centre and Recorded Game Archive
|
|
January 2012
| S |
M |
T |
W |
T |
F |
S |
| « Nov |
|
|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
|
|