check($_POST['captcha_code']) == false) { header('Location: user/Sign Up/Wrong Captcha'); exit(); }*/ else { //print_r($_POST); //exit; $obj = new UserProfile; // $name = explode(' ', $_POST['name']); if($obj->_userRegister(trim(htmlspecialchars($_POST['fname'])),trim(htmlspecialchars($_POST['lname'])),trim(htmlspecialchars(strtolower($_POST['email']))),trim(htmlspecialchars($_POST['passwd'])))) { header('Location: forum-register.htm?msg=Registered'); exit(); } else { header('Location: forum-register.htm?msg=Already'); exit(); } } } break; case 'LOG IN': if((trim((htmlspecialchars($_POST['email']))=="") && (trim(htmlspecialchars($_POST['passwd']))=="")) || (trim(htmlspecialchars(($_POST['email']))=="") || trim(htmlspecialchars(($_POST['passwd']==""))))) { header('Location: '.$_SERVER['HTTP_REFERER'].'?msg=blank'); exit(); } if(!preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,3})$/", trim(htmlspecialchars($_POST['email'])))) { header('Location: /forum.htm?msg=Invalid'); exit(); } else { $obj = new UserProfile; if($obj->_userLogin(mysql_real_escape_string(strtolower($_POST['email'])), mysql_real_escape_string($_POST['passwd']))) { header('Location: '.$_SERVER['HTTP_REFERER']); exit(); } else { header('Location: /forum.htm?msg=Invalid'); exit(); } } break; case 'CHECK': if($_POST['userID']=='' || $_SESSION['user_id']=='') { header('Location: '.$_SERVER['HTTP_REFERER'].'&msg=unsign'); exit; } if($_REQUEST['page'] == 0) { $_REQUEST['page'] = 1; } $filter = new FilterString; $obj = new ForumManager; $filter->strings = array('fuck','ass','shit', 'raskle','sexual','sex','bitch','porn','punk','suck'); $filter->text = $_POST['threadBody']; $filter->keep_first_last = true; $filter->replace_matches_inside_words = true; if($filter->filter()) { if($obj->_postThread($_POST['forumID'],$_POST['topicID'],$_POST['userID'],$_POST['threadTitle'],$filter->filter())) { header('Location: forum-app-detail.htm?id='.$_POST['forumID'].'&tid='.$_POST['topicID'].'&page='.$_REQUEST['page']); exit(); } else { header('Location: forum-app-detail.htm?id='.$_POST['forumID'].'&tid='.$_POST['topicID'].'&page='.$_REQUEST['page'].'&msg=undone'); exit(); } } break; case 'DELETE': $obj1 = new ForumManager; if($obj1->_deleteThread($_REQUEST['id'])) { header('Location: '.$_SERVER['HTTP_REFERER']); exit; } else { header('Location: '.$_SERVER['HTTP_REFERER'].'&msg=undone'); exit; } break; case 'UPDATE': if($_REQUEST['page'] == 0) { $_page = 1; } $filter = new FilterString; $obj = new ForumManager; $filter->strings = array('fuck','ass','shit', 'raskle','sexual','sex','bitch','porn','punk','suck'); $filter->text = $_POST['threadBody']; $filter->keep_first_last = true; $filter->replace_matches_inside_words = true; if($filter->filter()) { if($obj->_updateThread($_POST['forumID'],$_POST['topicID'],$_POST['userID'],$_POST['threadTitle'],$filter->filter())) { header('Location: forum-app-detail.htm?id='.$_POST['forumID'].'&tid='.$_POST['topicID1'].'&page='.$_REQUEST['page']); exit(); } else { header('Location: forum-app-detail.htm?id='.$_POST['forumID'].'&tid='.$_POST['topicID'].'&page='.$_REQUEST['page'].'&msg=undone'); exit(); } } break; case 'Logout': $obj = new UserProfile; if($obj->_userLogout($_SESSION['user_id'])) { header('Location: /forum.htm'); exit(); } break; case 'NEWTPOIC': if($_POST['userID']=='') { header('Location: '.$_SERVER['HTTP_REFERER'].'&msg=unsign'); exit; } $filter = new FilterString; $obj = new ForumManager; $filter->strings = array('fuck','ass','bullshit', 'raskle','sexual','sex','bitch','porn','punk','suck'); $filter->text = $_POST['threadBody']; $filter->keep_first_last = true; $filter->replace_matches_inside_words = true; if($filter->filter()) { if($obj->_postThread($_POST['forumID'],$_POST['topicID'],$_POST['userID'],$_POST['threadTitle'],$filter->filter())) { header('Location: forum-detail.htm?id='.$_POST['forumID']); exit(); } else { header('Location: forum-detail.htm?id='.$_POST['forumID']); exit(); } } break; case 'LOGINCHECK': if($_SESSION['user_id']=='') { header('Location : login-page.htm'); exit; } else { header(' Location : forum-app-detail.htm?id='.$_REQUEST['id'].'&tid='.$_REQUEST['tid'].'&pg='.$_REQUEST['pg']); exit; } break; case 'LOG2 IN': if((trim((htmlspecialchars($_POST['email']))=="") && (trim(htmlspecialchars($_POST['passwd']))=="")) || (trim(htmlspecialchars(($_POST['email']))=="") || trim(htmlspecialchars(($_POST['passwd']==""))))) { header('Location: '.$_SERVER['HTTP_REFERER'].'?msg=blank'); exit(); } if(!preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,3})$/", trim(htmlspecialchars($_POST['email'])))) { header('Location: forum.htm?msg=Invalid'); exit(); } else { $obj = new UserProfile; if($obj->_userLogin(mysql_real_escape_string(strtolower($_POST['email'])), mysql_real_escape_string($_POST['passwd']))) { header('Location: forum.htm'); exit(); } else { header('Location:'.$_SERVER['HTTP_REFERER']); exit(); } } break; case 'Contact Us': if($_POST['name']=='' || $_POST['email'] == '' || $_POST['message']=='') { header('Location: /contact-us.htm?msg=Required'); exit; } else { $_mailHeaders = "MIME-Version: 1.0 \r\n"; $_mailHeaders .= "Content-type: text/html; charset=iso-8859-1 \r\n"; $_mailHeaders .= "Content-Transfer-Encoding: 8bit \r\n"; $_mailHeaders .= "X-Priority: 3\n"; $_mailHeaders .= "From: ".trim($_POST['name'])."<".trim($_POST['email'])."> \r\n"; if(mail(ADMIN_EMAIL, trim($_POST['options']), trim(nl2br($_POST['message'])), $_mailHeaders)) { header('Location: /contact-us.htm?msg=Sent'); exit; } else { header('Location: /contact-us.htm?msg=Failed'); exit; } } break; } } ?>