function end_session() { //lopeta_sessioon() in the example $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 42000, '/'); } session_destroy(); show_main_page(); }
function main() { create_html_start(); if (!isset($_SESSION['ms_username'])) { show_login(); } else { show_main_page(); } create_html_end(); }
$mainContentView = 'view/main_page.html'; if (isset($_GET['mode'])) { $mode = $_GET['mode']; switch ($mode) { case 'main_page': show_main_page(); break; case 'gallery': show_gallery(); break; case 'img_upload': show_img_upload(); break; case 'login': show_login(); break; case 'register': show_register(); break; case 'image': show_image(); break; default: show_error('404'); } } else { show_main_page(); } //include 'view/head.html'; //include $mainContentView; //include 'view/foot.html';
if (!$_POST['author'] || !$_POST['contents']) { header("Location: http://" . $_SERVER['SERVER_NAME'] . "/" . PAGE_COMMENTS . "&nid=" . $_POST['nid'] . "&action=add"); } else { add_comment_contents($dbconn, get_diary_uid()); } } show_comments_page($dbconn, $diary_login); } break; case 'guestbook': include INCLUDE_PATH . 'guestbook.inc.' . PHP_EXT; switch (@$_GET['action']) { case 'add': show_guestbook_add_page($dbconn, $diary_login); break; default: if (!empty($_POST)) { if (!$_POST['author'] || !$_POST['inscription']) { header("Location: http://" . $_SERVER['SERVER_NAME'] . "/" . PAGE_GUESTBOOK . "&action=add"); } else { add_guestbook_inscription($dbconn, get_diary_uid()); } } show_guestbook_page($dbconn, $diary_login); } break; default: include INCLUDE_PATH . 'index.inc.' . PHP_EXT; show_main_page($dbconn, $diary_login); } pg_close($dbconn);