Hmm... Tag lige et kik på
http://www.cwz.dk/ log ind på chatten og log så af igen!
Her er lidt kode:
login.php:
<SNIP>
<?
if( $username && $userpass )
{
require(\"chatbase.php\");
$mychat = new HexChat();
if( ($keys=$mychat->login($username, $userpass)) > 0 )
{
$startdate = date(\"Y-m-d H:i:s\");
echo \"<head><title>$chatname - $username</title></head>\";
echo \"<frameset rows=\\\"50,*,100\\\" frameborder=0 framespacing=0 border=0>\";
echo \"<frame name=\\\"HEXCHAT_TOPIC\\\" src=\\\"topic.php?ukey=$keys[0]&skey=$keys[1]\\\" marginwidth=0 marginheight=0 scrolling=no frameborder=0 border=0 noresize>\";
echo \"<frame name=\\\"HEXCHAT_MESSAGE\\\" src=\\\"top.php?ukey=$keys[0]&skey=$keys[1]\\\" marginwidth=0 marginheight=0 scrolling=no frameborder=0 border=0 noresize>\";
echo \"<frame name=\\\"HEXCHAT_PANEL\\\" src=\\\"bund.php?ukey=$keys[0]&skey=$keys[1]\\\" marginwidth=0 marginheight=0 scrolling=no frameborder=0 border=0 noresize>\";
echo \"</frameset>\";
}
elseif( $keys == 0 )
echo \"<html><body>\".$ERROR_BadUserPass.\"</body></html>\";
else
echo \"<html><body>\".$ERROR_Banned.\"</body></html>\";
mysql_close();
exit;
}
?>
<html>
<HTML>
<BODY VLINK=\"DFDFBF\" LINK=\"DFDFBF\" BGCOLOR=\"#98987F\" TEXT=\"White\" alink=\"DFDFBF\" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<head>
<link rel=\"stylesheet\" href=\"
http://www.cwz.dk/chat/phpuni.css\"></head>
<BR>
<BR>
<BR>
<CENTER>
<form action=\"login.php\" method=post>
<FONT SIZE=2 FACE=\"Tahoma, arial\" color=#DFDFBF>Brugernavn :</FONT><BR><input class=but type=text size=10 name=username><BR>
<FONT SIZE=2 FACE=\"Tahoma, arial\" color=#DFDFBF>Kodeord :</FONT><BR><input class=but type=password size=10 name=userpass><BR>
<input class=but type=submit value=\"Log På\">
</form>
</CENTER>
<script language=\"JavaScript1.2\">
<!--
/*
No Right Click
*/
if (window.Event) // Only Netscape will have the CAPITAL E.
document.captureEvents(Event.MOUSEUP); // catch the mouse up event
function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
</body></html>
</SNIP>
logout.php
<SNIP>
<HTML>
<BODY VLINK=\"DFDFBF\" LINK=\"DFDFBF\" BGCOLOR=\"#98987F\" TEXT=\"White\" alink=\"DFDFBF\" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<head>
<link rel=\"stylesheet\" href=\"
http://www.cwz.dk/chat/phpuni.css\"><base target=\"hojre\">
</head>
<?
if( $skey && $ukey )
{
require(\"chatbase.php\");
$mychat = new HexChat();
if( (is_object($myuser=$mychat->validate_user($ukey, $skey))) )
{
$slutdato = date(\"Y-m-d H:i:s\");
$myuser->logout($mychat);
$startdato=\"2000-11-24 23:25:54\";
$slutdato=\"2000-12-31 23:59:59\";
if (eregi(\'^([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)$\',$startdato,$a)) {
$start=mktime($a[4],$a[5],$a[6],$a[2],$a[3],$a[1]);
} else {
echo \"Fejl i startdato<br>\\n\";
}
if (eregi(\'^([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)$\',$slutdato,$a)) {
$slut=mktime($a[4],$a[5],$a[6],$a[2],$a[3],$a[1]);
} else {
echo \"Fejl i startdato<br>\\n\";
}
echo \"$startdato = $start<br>\\n\";
echo \"$slutdato = $slut<br>\\n\";
$diff = $slut-$start;
$hours = floor($diff / (60*60));
$mints = floor(($diff - $hours*60*60) / 60);
echo \"<P> Du har været på chatten i $hours timer og $mints minutes<br>\\n\";
}
else
$mychat->display_error($ERROR_NotLoggedIn);
mysql_close();
exit;
}
header(\"Location: login.php\");
?>
</SNIP>