Night Of Shooting | Crime Scene | Possible Motives | Possible Suspects |Witness Intimidation |Read Messages | Write Message

"; ######################################################################################## if (!isset($_SESSION['lastvisittime'])) { $q_get_last_visit_time = mysql_query("SELECT LastVisit FROM comments_access_log WHERE MemberID = '$memberid'", $conn); if (mysql_num_rows($q_get_last_visit_time) < 1) { $lastvisit = "20000101000000"; $q_insert = mysql_query("INSERT INTO comments_access_log (MemberID, LastVisit) VALUES ('$memberid', CURRENT_DATE())", $conn); } else { $lastvisit = mysql_result($q_get_last_visit_time, 0); } $q_update = mysql_query("UPDATE comments_access_log SET LastVisit = CURRENT_TIMESTAMP() WHERE MemberID = '$memberid'", $conn) || die(mysql_error()); $_SESSION['lastvisittime'] = $lastvisit; } #-------------------------------- GET CASE ID -------------------------------------------- $q_get_case_id = mysql_query("SELECT CaseID FROM cases WHERE (CURRENT_DATE() BETWEEN StartDate AND EndDate)", $conn); if(mysql_num_rows($q_get_case_id) > 0) { while($row = mysql_fetch_array($q_get_case_id)) { $caseid = $row['CaseID']; } } else { echo "

No Cases are currently running

"; exit; } #--------------COMMENTS STATUS---------------------------------------------------------- #--------------COMMENTS STATUS---------------------------------------------------------- #----------------------- GET DATE RANGE FOR DROP DOWN BOXES --------------------------------- $q_get_date = mysql_query("SELECT DATE_FORMAT(StartDate, '%c')AS Month, DATE_FORMAT(StartDate, '%Y') AS Year FROM cases WHERE CaseID = '$caseid'", $conn); if (mysql_num_rows($q_get_date) > 0) { $month = mysql_result($q_get_date, 0, 'Month'); $year = mysql_result($q_get_date, 0, 'Year'); } $current_month = date('m'); $month_text = array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $monthnumber = ""; for ($m=$month;$m<=$current_month;$m++) { $forarray = $m; if ($m < 10) {$m = "0".$m;} $monthnumber .= ""; } $current_year = date('Y'); $yearnumber = ""; for ($y=$year;$y<=$current_year;$y++) { $yearnumber .= "\n"; } #----------------------- GET DATE RANGE FOR DROP DOWN BOXES --------------------------------- #--------------------- SELECT DATE -------------------------------------------------- $month_from = isset($_POST['month_from'])?$_POST['month_from']:""; $day_from = isset($_POST['day_from'])?$_POST['day_from']:""; $year_from = isset($_POST['year_from'])?$_POST['year_from']:""; $month_to = isset($_POST['month_to'])?$_POST['month_to']:""; $day_to = isset($_POST['day_to'])?$_POST['day_to']:""; $year_to = isset($_POST['year_to'])?$_POST['year_to']:""; $daynumber = ""; for ($i=1; $i <= 31; $i++) { if ($i < 10) {$i = "0$i";} $daynumber .= "\n"; } echo "
"; echo " Show posts between:
From Date:
      To Date:
"; if (isset($_POST['submit'])) { $isempty = ""; $startdate = "$year_from-$month_from-$day_from"; $enddate = "$year_to-$month_to-$day_to"; if(!eregi("^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$", $startdate)) { echo "

Invalid 'From Date'. Please select all the fields

"; $isempty = "1"; } if(!eregi("^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$", $enddate)) { echo "

Invalid 'To Date'. Please select all the fields

"; $isempty = "1"; } if(!empty($isempty)) { exit; } $addtoquery = "&& CURRENT_DATE( ) BETWEEN '$startdate' AND '$enddate'"; } else { $addtoquery = ""; $startdate = ""; $enddate = ""; } //--------------- SELECT DATE -------------------------------------------------- $order = isset($_GET['order'])?$_GET['order']:"DESC"; if ($order == "ASC") { $orderlink = "
View Posts In Descending Order"; } else { $orderlink = "
View Posts In Ascending Order"; } echo $orderlink; $limit = isset($_GET['limit'])?$_GET['limit']:20; $page = isset($_GET['page'])?$_GET['page']:0; $q_get_num = mysql_query("SELECT * FROM comments WHERE CaseID = '$caseid' $addtoquery", $conn); $numrows = mysql_num_rows($q_get_num); if ($numrows < 1) { if (!isset($_POST['submit'])) { echo "

Sorry, there are no posts posted yet for this case

"; exit; } else { echo "

Sorry, No posts found between these dates

"; exit; } } if ($limit != 0) { $pages = intval($numrows/$limit); if ($numrows % $limit) {$pages++;} $current = ($page/$limit) + 1; if (($pages < 1)) {$total = 1;} else {$total = $pages;} $first = $page + 1; // The first result. if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {$last = $page + $limit;}else{$last = $numrows;} echo ""; echo " "; echo "
Previous posts are available here.
Displaying $first - $last of $numrows posts for this case -- (Page $current of $total)

Posts per-page: 5 | 10 | 20 | 50 | ALL

"; $limit_for_query = "LIMIT $page, $limit"; } else { $limit_for_query = ""; echo ""; echo " "; echo "
Previous posts are available here.
Displaying All of $numrows Comments for this case Comments per-page: 5 | 10 | 20 | 50 | ALL
"; } $q = mysql_query(" SELECT *, comments.CommentID AS CommentID, comments_replies.DateTime AS RepliesDateForToDays, DATE_FORMAT( comments.DateTime, '%W, %M %d, %Y' ) AS CommentDate, DATE_FORMAT( comments_replies.DateTime, '%W, %M %d, %Y' ) AS ReplyDate, DATE_FORMAT( comments.DateTime, '%r' ) AS CommentTime, DATE_FORMAT( comments_replies.DateTime, '%r' ) AS ReplyTime FROM cases LEFT JOIN comments ON cases.CaseID = comments.CaseID LEFT JOIN comments_replies ON comments.CommentID = comments_replies.CommentID WHERE cases.CaseID = '$caseid' $addtoquery ORDER BY comments.DateTime $order $limit_for_query ", $conn); mysql_close(); // ORDER BY comments_replies.DateTime $order, comments.DateTime $order $list = ""; $last_comment_id = ""; $lastvisit = mysql_query("SELECT TO_DAYS('$_SESSION[lastvisittime]')", $conn); $lastvisit = mysql_result($lastvisit,0); $today = mysql_query("SELECT TO_DAYS(CURRENT_TIMESTAMP())",$conn); $today = mysql_result($today,0); $visitdiff = $today - $lastvisit; while ($row = mysql_fetch_array($q)) { connect_amember(); $q_get_login = mysql_query("SELECT login FROM amembermembers WHERE member_id = '$row[MemberID]'", $conn2); $comments = nl2br($row['Comments']); $reply = nl2br($row['Reply']); if($last_comment_id != $row['CommentID']) { $last_comment_id = $row['CommentID']; if ($visitdiff > 0) { $postdate = mysql_query("SELECT TO_DAYS('$row[RepliesDateForToDays]')", $conn); $postdate = mysql_result($postdate,0); if ($lastvisit < $postdate) { $newgraphic = ""; } else { $newgraphic = ""; } } else { $newgraphic = ""; } $list .= "
 
"; } if (!empty($adminlogin)) { $list .= " "; } ?>
$row[Title]
 
"; $list .= "
Question: $comments

Asked on $row[CommentDate] at $row[CommentTime]
"; } if (!empty($row['Reply'])) { $list .= "
Reply: $reply

Answered by: $row[RepliedBy]
"; if (!empty($row['Reply'])) { $list .= " Delete Comment & Reply   Edit Reply   "; } else { $list .= "Reply To This Comment  "; $list .= "Delete Comment  "; } $list .= "Edit Comment"; } $list .= "
"; if ($page != 0) { $back_page = $page - $limit; echo "back\n"; } for ($i=1; $i <= $pages; $i++) { $ppage = $limit*($i - 1); if ($ppage == $page){ echo("$i\n"); } else { echo "$i \n"; } } if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { $next_page = $page + $limit; echo "next"; } } ?>