<?php

require "includes/initialize.php";
$tbl = "pages";
$col = "id";
$id = $page_id;
$get_page = getsingle($tbl, $col, $id);
$row = mysqli_fetch_array($get_page);
$page_title = $row['title'];
$page_description = $row['description'];
$page_keywords = $row['keywords'];
$page_rating = $row['rating'];
$page_level = $row['page_level'];
// Hero Information
$hero_title = $row['hero_title'];
$hero_content = $row['hero_content'];
}
?>

            <?php 
if (!empty($_SESSION['user'])) {
    if ($_SESSION['user']['apply_num'] == 0 and $_SESSION['user']['msg_num'] == 0 and $_SESSION['user']['blog_comment_num'] == 0 and $_SESSION['user']['small_reply_num'] == 0) {
        ?>
<li>
                <a href="<?php 
        echo U('Personal/index');
        ?>
"><font color="">Welcome,<?php 
        echo $_SESSION['user']['name'];
        ?>
&nbsp;&nbsp;( <?php 
        echo getsingle($_SESSION['user']['is_single']);
        ?>
 )</font></a>
                <ul>
                    <li> <a href="<?php 
        echo U('Login/logOut');
        ?>
"> LogOut</a> </li>
                </ul>
            </li>
            <?php 
    } else {
        ?>
            <li>
            <a href="<?php 
        echo U('Personal/index');
		
		while($row = mysql_fetch_assoc($res)) {
			// update the last comment we've seen
			$lastc = $row["id"];
			
			// skip comments with no comment (votes)
			if(trim($row["comment"]) == '') continue;
			
			$comments++;
			index_comment($database, $indexer, $row);
			file_put_contents($lastcfile, $lastc);
		}
		
		// escape when we're all caught up and our query returns 0 results
		$sql = "SELECT MIN(id) FROM offensive_comments WHERE id > $lastc";
		$next = getsingle($sql);
		if($next == $lastc) {
			trigger_error("F*****G WINDOWS 98, GET BILL GATES IN HERE", E_USER_ERROR);
		}
//		echo "$lastc $comments $next\n";
		if($next == null) break;
		// save some time if there are many unused comment ids
		$lastc = $next - 1;
	}

	// force the Xapian database to be garbage collected now to fire its desctructor.
	$database = null;
} catch (Exception $e) {
    print $e->getMessage() . "\n";
    exit(1);
}