Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once('class.php');
- $user = new User();
- if (!$user->isLoggedIn()) {
- header("Location:login_html.php");
- }
- echo "Welcome ".$_SESSION['user']."<br>";
- echo "<a href='redirect.php'>Logout</a> <br>";
- $section = $_GET['section'];
- if(isset($_POST['submit'])){
- if(empty($_POST['topic']) || empty($_POST['message'])){
- echo "<p style='color:red'>All fields are required</p>";
- }
- else{
- $message = str_ireplace('stupid', 'silly', $_POST['message']);
- $message = $user->escapeInput($message);
- $topic = $user->escapeInput($_POST['topic']);
- $user->createTopic($topic,$message,$_SESSION['user'],$section);
- header("Location:section.php?section=".$section);
- }
- }
Add Comment
Please, Sign In to add comment