線上書籍

Home

[1002] PHP入門班

<?php session_start(); require_once "function.php"; //error_reporting(0); $link=@mysql_connect("localhost" , "tad0616" ,"12345"); if(!$link) echo "資料庫連不上!"; //設定使用UTF8編碼 mysql_query("SET NAMES 'utf8'"); //選擇資料庫 mysql_select_db('tad0616'); $_SESSION['isLeader'] = isset($_SESSION['isLeader']) ? $_SESSION['isLeader'] : ""; $_SESSION['isAdmin'] = isset($_SESSION['isAdmin']) ? $_SESSION['isAdmin'] : ""; $admin_logout=''; if($_SESSION['isAdmin']){ $admin_logout='<li><a href="class.php?op=logout">管理員登出</a></li>'; } $leader_logout=''; if($_SESSION['isLeader']){ $leader_logout='<li><a href="index.php?op=logout">班級管理員登出</a></li>'; } $toolbar=' <li class="current_page_item"><a href="index.php">首頁</a></li> <li><a href="index.php?op=edit">新增文章</a></li> <li><a href="index.php?op=admin">文章管理</a></li> <li><a href="class.php">班級管理</a></li> <li><a href="class.php?op=edit">新增班級</a></li> '.$admin_logout.$leader_logout ; ?>