<?
@session_start();
@include "conn.php";
?>
<html>
<head>
<title>talk</title>
</head>
<body bgcolor=black>
<br><br>
<table border=0 align=center width=500 height=500 style=background:'black';color:'lightgreen'>
<tr align=center><td><hr></td></tr>
<tr align=center>
<td>
<form method=post action=index.php name=lfrm>
<?
if($_POST[jid] && $_POST[jpw])
{
if(strlen($_POST[jid])>10) exit("<meta http-equiv=refresh content=0;url=index.php>");
if(strlen($_POST[jpw])>10) exit("<meta http-equiv=refresh content=0;url=index.php>");
$ipck=@mysql_fetch_array(mysql_query("select ip from talk where ip='$_SERVER[REMOTE_ADDR]'"));
if($ipck[0]) exit("<meta http-equiv=refresh content=0;url=index.php>");
$ck=@mysql_fetch_array(mysql_query("select id from talk where id='$_POST[jid]'"));
if($ck[0]) exit("<meta http-equiv=refresh content=0;url=index.php>");
$_POST[jpw]=md5("zombie_$_POST[jpw]");
$_POST[jid]=trim("$_POST[jid]");
@mysql_query("insert into talk values('$_POST[jid]','$_POST[jpw]','$_SERVER[REMOTE_ADDR]')");
echo("<script>alert('Done!');</script>");
exit("<meta http-equiv=refresh content=0;url=index.php>");
}
if($_POST[id] && $_POST[pw])
{
$q=@mysql_fetch_array(mysql_query("select * from talk where id='$_POST[id]' and pw=md5('zombie_$_POST[pw]')"));
if(!$q[0]) exit("<meta http-equiv=refresh content=0;url=index.php>");
if($q[id] && $q[pw])
{
$_SESSION[id]="$q[id]";
echo("<script>alert('hi $q[id]');</script>");
echo("<meta http-equiv=refresh content=0;url=msg.php>");
exit();
}
}
if($_GET[mode]=="join")
{
echo("<tr><td>id : <input type=text name=jid maxlength=10></td></tr>");
echo("<tr><td>pw : <input type=password name=jpw maxlength=20></td></tr>");
echo("<tr><td align=center><input type=submit value='Join'></td></tr>");
}
if(!$_GET[mode])
{
$vid="ID";
$vpw="PW";
$ck=mysql_fetch_array(mysql_query("select * from talk where ip='$_SERVER[REMOTE_ADDR]'"));
if($ck[id] && $ck[pw])
{
$vid="$ck[id]";
}
echo("
<tr align=center><td><input name=id type=text style=width:200;font:20;background:'black';border:0;color:'lightgreen' value='$vid' maxlength=10 onclick=if(this.value=='ID')this.value='';></td></tr>
<tr align=center><td><input name=pw type=password style=width:200;font:20;background:'black';border:0;color:'lightgreen' value='$vpw' maxlength=20 onclick=if(this.value=='PW')this.value='';></td></tr>
<tr align=center><td><input type=submit value='Login' style=border:0;background:'silver';width:100;height:50> <input type=button value='Join' style=border:0;background:'silver';width:100;height:50 onclick=location.href='?mode=join'>
");
} ?>
<tr align=center><td><hr></td></tr>
</table>
<br><center><a href=index.phps>source</a></center>
</body>
</html>