query("SET NAMES 'utf8'"); /* Specifies whatever or not there should be a right menu on this page! */ $show_right_menu = false; /* Create the class object in order to manage the site cookie */ $coo = new Cookies_Manager_Class("UserCookie"); /* Start session management! Make at the following global variables available: SESSION_VERIFIED_USER[] (profile_id, username, password, user_level, first_name, middel_name, last_name) SESSION_VERIFIED_ADMIN[] (admin_id, username, password, admin_level, first_name, middel_name, last_name) */ start_page_session(); /* Call this method in order to check for auto login and so if auto_login is set! NOTICE that this method must have a pointer to the cookie as an argument!*/ check_for_autologin($coo); /* Call the method get_language in order to find out what language the page scould be in! NOTICE! that the method take one argument (the pointer og the cookie object)*/ $page_language = get_language($coo); /* Get left/right sitemenu picture url*/ $left_sitemenu_picture_id = get_left_sitemenu_picture_id(); if ($show_right_menu) { $right_sitemenu_picture_id = get_right_sitemenu_picture_id($left_sitemenu_picture_id); } /* Get standard "GET" variables */ $page_id=(isset($_GET['id'])) ? mysql_real_escape_string($_GET['id']) : "index"; $page_mode=(isset($_GET['mode'])) ? mysql_real_escape_string($_GET['mode']) : ""; $page_option=(isset($_GET['op'])) ? mysql_real_escape_string($_GET['op']) : ""; $referer_url=(isset($_GET['rurl'])) ? mysql_real_escape_string($_GET['rurl']) : ""; /**********************************************************************************/ /****************************** Special Initialising ******************************/ /**********************************************************************************/ $forum_open = true; if (!$forum_id = (INT) @$_GET['forum_id']) { if (!$forum_id = (INT) @$_POST['forum_id']) { $forum_id = '';} } if (!$thread_id = (INT) @$_GET['thread_id']) { if (!$thread_id = (INT) @$_POST['thread_id']) { $thread_id = '';} } if(strpos($thread_id, '#')) { $thread_id = substr($thread_id, 0, strpos($thread_id, '#')); } if (!$post_parent_id = (INT) @$_GET['post_parent_id']) { if (!$post_parent_id = (INT) @$_POST['post_parent_id']) { $post_parent_id = '';} } $_sql_post_text=(isset($_POST['post_text'])) ? mysql_real_escape_string($_POST['post_text']) : ""; $_sql_post_subject=(isset($_POST['post_subject'])) ? mysql_real_escape_string($_POST['post_subject']) : ""; $post_text=(isset($_POST['post_text'])) ? $_POST['post_text'] : ""; $post_subject=(isset($_POST['post_subject'])) ? $_POST['post_subject'] : ""; if (!$post_email_notification = (INT) @$_GET['post_email_notification']) { if (!$post_email_notification = (INT) @$_POST['post_email_notification']) { $post_email_notification = '0';} } /**********************************************************************************/ /*if ($page_id == 'search_threads_result') { header("Location: forum.php?id=search_threads_result"); exit; } */ if ($page_id == 'forum_confirm_post') { if($post_text != '' AND $forum_id != '' AND $thread_id != '') { } else { header("Location: forum.php?id=thread&forum_id=" . $forum_id . "&post_email_notification=" . $post_email_notification . "&thread_id=" . $thread_id . "#forum_post"); exit; } } if ($page_id == 'forum_confirmed_post') { $error_occured = false; if (isset($_SESSION['SESSION_VERIFIED_USER'])) { $profile_id = $_SESSION["profile_id"]; $sql_profile_info = "Select email_address, first_name, middel_name, last_name From tbl_profiles Where profile_id = '" . $profile_id . "'"; $db->query($sql_profile_info, "profile"); $profile_info_array = $db->row("profile"); $user_name = $profile_info_array["first_name"]; $user_name .= ($profile_info_array["middel_name"]) ? " " . $profile_info_array["middel_name"] : ""; $user_name .= ($profile_info_array["last_name"]) ? " " . $profile_info_array["last_name"] : ""; $user_email = $profile_info_array["email_address"]; /* if($profile_id == '490') { $error_occured = true; }*/ if($profile_id == '1205') { $error_occured = true; /************************** SEND E-MAIL TO NEW USER **************************/ $mail_to = "Jens S Hansen "; $mail_from = "Netfugl.dk "; $mail_reply_to = "Netfugl.dk "; $mail_subject = "IP Adresse!"; $mail_message_text = "IP: " . $_SERVER['REMOTE_ADDR']; $mail_headers = "From: " . $mail_from . "\r\n" . "Reply-To: " . $mail_reply_to . "\r\n" . "X-Mailer: PHP/" . phpversion(); mail($mail_to, $mail_subject, $mail_message_text, $mail_headers); } } else { $error_occured = true; } $sql_post_info = "Select post.post_id From tbl_forum_posts As post Where post.forum_id='" . $forum_id . "' AND post.post_thread_id='" . $thread_id . "' AND post.post_id='" . $post_parent_id . "'"; $db->query($sql_post_info, "post_info"); $sql_post_test = "Select post.post_id From tbl_forum_posts As post Where post.forum_id='" . $forum_id . "' AND post.post_thread_id='" . $thread_id . "' AND post.post_text='" . $_sql_post_text . "'"; $db->query($sql_post_test, "post_test"); /************************* unactive and limited profile test ****************************************/ $sql_allowed_to_post = "Select profile_id From tbl_profiles Where profile_id='" . $profile_id . "' AND active_profile=1 AND limited_profile=0"; $db->query($sql_allowed_to_post, "allowed_to_post"); if($db->db_num_rows("allowed_to_post") == 1) { $allowed_to_post = true; } else { $allowed_to_post = false; } /***************************************************************************************************/ if($allowed_to_post AND $post_text != '' AND $forum_id != '' AND $thread_id != '' AND $post_parent_id != '' AND $db->db_num_rows("post_info") == 1 AND !$error_occured AND $db->db_num_rows("post_test") == 0) { $sql_post_subject = "Select post.post_subject From tbl_forum_posts As post Where post.forum_id='" . $forum_id . "' AND post.post_thread_id='" . $thread_id . "' AND post.post_parent_id=0"; $db->query($sql_post_subject, "post_subject"); $post_subject_array = $db->row("post_subject"); $post_subject = str_replace("'", "''", "Re: " . $post_subject_array['post_subject']); $post_email_notification = ($post_email_notification) ? "1" : "0"; $post_date = date('Y-m-d H:i:s',time()); $sql_add_post = "Insert into tbl_forum_posts (post_date, forum_id, post_thread_id, post_parent_id, post_author_id, post_author_name, post_author_email, post_subject, post_text, post_email_reply) values('$post_date', $forum_id, $thread_id, $post_parent_id, $profile_id, '$user_name', '$user_email', '$post_subject', '".$_sql_post_text."', '$post_email_notification')"; $db->query($sql_add_post); /********************************* E-mail ***************************************/ $sql_email_notification = "Select post.post_author_name, post.post_author_email From tbl_forum_posts As post Where post.post_author_email != '' AND post.post_author_email IS NOT NULL AND post.forum_id='" . $forum_id . "' AND post.post_thread_id='" . $thread_id . "' AND post.post_email_reply=1 AND post.post_author_email != '" . $user_email . "' Group by post.post_author_email"; $db->query($sql_email_notification, "email_notification"); while($email_notification_info_array = $db->row('email_notification')) { $mail_to = $email_notification_info_array['post_author_name'] . " <" . $email_notification_info_array['post_author_email'] . ">"; $mail_from = "Netfugl.dk "; $mail_reply_to = "Netfugl.dk "; $mail_subject = "Netfugl.dk Forum - Nyt indlæg til tråd"; $mail_message_text = "Netfugl.dk gør Dem opmærksom på, at der netop er postet et nyt indlæg i tråden [" . $post_subject_array['post_subject'] . "].\r\n\r\nTryk på følgende link for at se de postede indlæg i tråden: http://www.netfugl.dk/forum.php?id=thread&forum_id=" . $forum_id . "&thread_id=" . $thread_id . "\r\n\r\n"; $mail_message_text .= "Med venlig hilsen, Netfugl.dk"; $mail_headers = "From: " . $mail_from . "\r\n" . "Reply-To: " . $mail_reply_to . "\r\n" . "X-Mailer: PHP/" . phpversion(); mail($mail_to, $mail_subject, $mail_message_text, $mail_headers); } /********************************************************************************/ $post_subject = ''; $post_text = ''; $post_email_notification = ''; $post_parent_id = ''; $page_id = "thread"; $update_post_viewed = "no"; } else { header("Location: forum.php?id=index"); exit; } } if ($page_id == 'forum_confirm_new_thread') { if($post_subject == '' OR $post_text == '' OR $forum_id == '') { $page_id = "new_thread"; } } if ($page_id == 'forum_confirmed_new_thread') { $error_occured = false; if (isset($_SESSION['SESSION_VERIFIED_USER'])) { $profile_id = $_SESSION["profile_id"]; $sql_profile_info = "Select email_address, first_name, middel_name, last_name From tbl_profiles Where profile_id = '" . $profile_id . "'"; $db->query($sql_profile_info, "profile"); $profile_info_array = $db->row("profile"); $user_name = $profile_info_array["first_name"]; $user_name .= ($profile_info_array["middel_name"]) ? " " . $profile_info_array["middel_name"] : ""; $user_name .= ($profile_info_array["last_name"]) ? " " . $profile_info_array["last_name"] : ""; $user_email = $profile_info_array["email_address"]; } else { $error_occured = true; } $sql_post_test = "Select post.post_id From tbl_forum_posts As post Where post.forum_id='" . $forum_id . "' AND post.post_parent_id=0 AND post.post_text='" . $_sql_post_text . "' AND post.post_subject='" . $_sql_post_subject . "'"; $db->query($sql_post_test, "post_test"); /************************* unactive and limited profile test ****************************************/ $sql_allowed_to_post = "Select profile_id From tbl_profiles Where profile_id='" . $profile_id . "' AND active_profile=1 AND limited_profile=0"; $db->query($sql_allowed_to_post, "allowed_to_post"); if($db->db_num_rows("allowed_to_post") == 1) { $allowed_to_post = true; } else { $allowed_to_post = false; } /***************************************************************************************************/ if($allowed_to_post AND $post_subject != '' AND $post_text != '' AND $forum_id != '' AND !$error_occured AND $db->db_num_rows("post_test") == 0) { $post_email_notification = ($post_email_notification) ? "1" : "0"; $post_date = date('Y-m-d H:i:s',time()); $sql_add_new_thread = "Insert into tbl_forum_posts (post_date, forum_id, post_parent_id, post_author_id, post_author_name, post_author_email, post_subject, post_text, post_email_reply) values('$post_date', $forum_id, '0', $profile_id, '$user_name', '$user_email', '".$_sql_post_subject."', '".$_sql_post_text."', '$post_email_notification')"; $db->tbl_lock("tbl_forum_posts", "write"); $db->query($sql_add_new_thread); $sql_last_auto_id = "SELECT LAST_INSERT_ID() As last_auto_id"; $db->query($sql_last_auto_id, 'last_auto_id'); $db->tbl_unlock(); $row_last_auto_id = $db->row('last_auto_id'); $last_auto_id = $row_last_auto_id['last_auto_id']; $sql_update_post_thread_id = "Update tbl_forum_posts Set post_thread_id='" . $last_auto_id . "' Where post_id='" . $last_auto_id . "'"; $db->query($sql_update_post_thread_id); $post_subject = ''; $post_text = ''; $post_email_notification = ''; $post_parent_id = ''; header("Location: forum.php?id=forum&forum_id=" . $forum_id); exit; } else { header("Location: forum.php?id=index"); exit; } } /**********************************************************************************/ /************************************ Functions ***********************************/ /**********************************************************************************/ /**********************************************************************************/ /*********************************** Page Start ***********************************/ /**********************************************************************************/ ?> <?php echo SITE_NAME . " Forum - " . SITE_NAME; ?>

"; include("./include/menu_items_tracker.php"); echo "
"; ?>

Netfugl.dk Forum
"; echo "Netfugl.dk Forum"; echo "  |  "; echo ""; echo ($page_language == 'dk') ? "Start ny tråd" : "Start new thread"; echo ""; echo "  |  "; echo ""; echo ($page_language == 'dk') ? "Søg i tråde" : "Search in threads"; echo ""; echo "  |  "; echo ($page_language == 'dk') ? "Retningslinjer" : "Guidelines"; echo "  |  "; echo "FAQ"; echo "  |  "; echo ($page_language == 'dk') ? "50 seneste tråde" : "50 latest threads"; echo "  |  "; echo ($page_language == 'dk') ? "50 seneste svar" : "50 latest replies"; echo "

"; echo ""; // echo "
"; //update_statistic_language('forum.php'); // Checking which mode the asp page was called with switch ($page_id) { case 'str' : include("./include/forum/forum_search_result.php"); break; case 'search' : //include("./include/index/index_search.php"); break; case 'forum' : include("./include/forum/forum_forum.php"); break; case 'thread' : include("./include/forum/forum_thread.php"); break; case 'forum_confirm_post' : include("./include/forum/forum_confirm_post.php"); break; case 'new_thread' : include("./include/forum/forum_new_thread.php"); break; case 'search_threads' : include("./include/forum/forum_search_threads.php"); break; case 'forum_confirm_new_thread' : include("./include/forum/forum_confirm_new_thread.php"); break; case 'guidelines' : include("./include/forum/forum_guidelines.php"); break; case 'latest50threads' : include("./include/forum/forum_latest50threads.php"); break; case 'latest50replies' : include("./include/forum/forum_latest50replies.php"); break; case 'tip_moderator' : include("./include/forum/forum_tip_moderator.php"); break; case 'moderator_delete_post' : include("./include/forum/forum_moderator_delete_post.php"); break; default : include("./include/forum/forum_index.php"); break; } echo "
"; gui_backbutton(); ?>
 
db_close(); ?>