query($query_pending); $num_pending = $db->num_rows($result_pending); $row_pending = mysql_fetch_assoc($result_pending); if($num_pending>0){ $error_message = "Your message has been sent and is waiting approval."; $color = "green"; }else{ if(!$isLogged){ $error_message = "Please login to sign our guestbook!"; }else{ $error_message = "Please sign our guestbook!"; } $color = "#99CCFF"; } if(isset($_GET['page'])){ $page = $_GET['page']; }else{ $page = 1; } //check if IP is banned $query_ban = "SELECT ip_address from banned_IPs where ip_address='$ip'"; $result_ban = $db->query($query_ban); $num_ban = $db->num_rows($result_ban); if($num_ban>0){ $padding = "14px"; $error_message = "You have been banned from posting on the Guestbook!"; $color = "orange"; $msg_display = "block"; $form_display = "none"; $banned = true; } $current_page = $page; $page_count = ($page-1)*10; $query_posts = " SELECT * from guestbook where status='approved' order by date desc LIMIT $page_count, 10"; $result = $db->query($query_posts); $num_posts = $db->num_rows($result); $query_total = "SELECT * from guestbook where status='approved'"; $result_total = $db->query($query_total); $num_posts_total = $db->num_rows($result_total); $total_pages = ceil($num_posts_total/10); if(isset($_POST['submit']) && $banned == false){ $validation_code = $_POST['validation_code']; $valid_key = $_POST['valid_key']; $error_message=''; if(md5($validation_code) == $valid_key){ if($isLogged){ $username = $_SESSION['username']; $query_email = " SELECT email,name FROM users where username='$username'"; $result_email = $db->query($query_email); $row = mysql_fetch_assoc($result_email); $user_name = $row['name']; $user_email = $row['email']; }else{ $user_name = $_POST['name']; $user_email = $_POST['email']; if(empty($user_name)){ $color = "red"; $error_message.= "Username field is required.
"; } if(empty($user_email)){ $color = "red"; $error_message.= "Email field is required.
"; } } $message = htmlentities(trim($_POST['message'], ENT_QUOTES)); if(empty($message)){ $color = "red"; $error_message.= "Please enter your message.
"; } if(empty($error_message)){ $query_post = " INSERT INTO guestbook VALUES ('', '$user_name', '$user_email', NOW() , '$message', 'pending','$ip');"; $result = $db->query($query_post); if($result){ $error_message = "Your message has been sent and is waiting approval."; $color = "green"; $msg_display = "block"; $form_display = "none"; header("location: interact_guestbook.php?p=waiting_app"); } } }else{ $error_message .= "You have entered an invalid code."; $color = "#FFCC00"; $msg_display = "none"; $form_display = "block"; } } //} ?> interact
edit profile

Welcome to the Greg Lake Guestbook

0)){ ?>




validation code - no spaces helps us prevent spam



0){ ?> Date:
Message:

0){ while($row = $db->row($result)){?> Name:
Date:
Message:

No posts available
1){?> << Previous | Next >> (Showing - of )
 Guestbook    Sign GuestbookSign In    Register