# # # # # # # # # # get settings require "settings.php"; # decide what to do if (isset($_POST["key"])) { switch ($_POST["key"]) { case "addview": $OUTPUT = addview($_POST); break; case "write": $OUTPUT = write($_POST); break; default: $OUTPUT = view(); } } else { # Display default output $OUTPUT = view(); } # get template require "template.php"; # Default view function view()
<?php include 'layout_manager.php'; include 'content_function.php'; addview($_GET['cid'], $_GET['scid'], $_GET['tid']); ?> <html> <head><title>Inki's PHP Forum Tutorial</title></head> <link href="/forum-tutorial/styles/main.css" type="text/css" rel="stylesheet" /> <body> <div class="pane"> <div class="header"><h1><a href="/forum-tutorial">PHP and MySQL Forum Tutorial</a></h1></div> <div class="loginpane"> <?php session_start(); if (isset($_SESSION['username'])) { logout(); } else { if (isset($_GET['status'])) { if ($_GET['status'] == 'reg-success') { echo "<h1 style='color: green;'>new user registered successfully!</h1>"; } else { if ($_GET['status'] == 'login-fail') { echo "<h1 style='color: red;'>invalid username and/or password!</h1>"; } } } loginform(); } ?> </div>