<?php
session_start();
$id="admin";
$pass="12345";
$tool="已登入 [<input type='submit' value='登出' onClick='logMeout();'>]
<p><a href='index.php'>重新播放</a></p>";
$form="
<form onsubmit='return false'>
<table>
<tr><td>帳號:</td><td><input type='text' id='user_id'></td></tr>
<tr><td>密碼:</td><td><input type='text' id='pass'></td></tr>
<tr><td align='center'>
<input type='submit' value='登入' onClick='logMein();'>
</td></tr>
</table>
</form>";
if($_SESSION['login']){
if($_POST['op']=='logout'){
$_SESSION['login']=false;
echo $form;
}else{
echo $tool;
}
}else{
if($_POST['username']==$id and $_POST['password']==$pass){
$_SESSION['login']=true;
echo $tool;
}else{
$_SESSION['login']=false;
echo $_POST['username'].$_POST['password'].$form;
}
}
?>