Location: PHPKode > scripts > OekakiPoteto > oekakipoteto/chat.php
<?

//IP Banning
include('banscript.php');	
include('dbconn.php');
if(isset($OekakiU)) {
	$testrslt = mysql_query("SELECT usrname, usrpass, usrflags FROM ".$OekakiPoteto_MemberPrefix."oekaki WHERE usrname='$OekakiU'");
	
	//extract the fields selected above into variables
	@extract(mysql_fetch_array($testrslt));
	
	//check if passwords are correct and that the user is a non-pending member
	if (($OekakiPass !== $usrpass) || !strstr($usrflags,"G")) {
		unset($OekakiU);
		unset($OekakiPass);
		header ('Location: error.php?error='.urlencode("You do not have access as a registered member to use the chat."));
	}
}
?>

<html>
<head>
<script language="JavaScript">

<!--
  function openWindow(url, w, h) {
    var options = "width=" + w + ",height=" + h + ",";
    options += "resizable=yes,scrollbars=yes,status=no,";
    options += "menubar=no,toolbar=no,location=no,directories=no";
    var newWin = window.open(url, 'newWin2', options);
    newWin.focus();
  }
//-->
</script>
<?
function rootpath(){
	global $DOCUMENT_ROOT;
	$rootdir = $DOCUMENT_ROOT;
	if ($DOCUMENT_ROOT[strlen($DOCUMENT_ROOT)] == "/"){
		return $rootdir;
	} else {
		$rootdir = $rootdir."/";
		return $rootdir;
	}
}

$refresh = 1;
include('config.php');
include('dbconn.php');
include('niftytoo.php');


if($apostrophes == "0"){
	set_magic_quotes_runtime(0);

	function nifty3_convert($in){
		return $in;
	}
} else {
	function nifty3_convert($in){
		return addslashes($in);
	}
}

if ($send=="Send") {
	$hostname = gethostbyaddr($REMOTE_ADDR);
	$comment = nifty3_convert($comment);
	$result5 = mysql_query("SELECT count(ChatID) as rowno FROM ".$OekakiPoteto_MemberPrefix."oekakichat");
	$rownum2 = mysql_result($result5, 0, 'rowno');
	if(intval($rownum2) > $chatMax) {
		$chatdel = mysql_query("DELETE FROM ".$OekakiPoteto_MemberPrefix."oekakichat");
	}
	if (isset($OekakiU)) {
		$result = mysql_query("INSERT into ".$OekakiPoteto_MemberPrefix."oekakichat SET usrname='$OekakiU', comment='$comment',hostname='$hostname', IP='$REMOTE_ADDR'");
		} else {
		if ($name != "") {
		$result = mysql_query("INSERT into ".$OekakiPoteto_MemberPrefix."oekakichat SET usrname='Guest', postname='$name', comment='$comment',hostname='$hostname',email='$email',url='$url', IP='$REMOTE_ADDR'");
		} 
		}
}


include('online.php');

if (!$pageno) $pageno=0;

if (!$sort) $sort="0";
if ($sort==0) {
$result5 = mysql_query("SELECT count(ChatID) as rowno FROM ".$OekakiPoteto_MemberPrefix."oekakichat");
$rownum2 = mysql_result($result5, 0, 'rowno');
$pages = intval($rownum2/$chatDisp) + 1;
$rsql = "SELECT * FROM ".$OekakiPoteto_MemberPrefix."oekakichat order by posttime desc LIMIT ".($pageno*$chatDisp).", ".$chatDisp;
$result5 = mysql_query($rsql);
$rownum = mysql_numrows($result5);
} else {
$result5 = mysql_query("SELECT count(ChatID) as rowno FROM ".$OekakiPoteto_MemberPrefix."oekakichat");
$rownum2 = mysql_result($result5, 0, 'rowno');
$pages = intval($rownum2/$chatDisp) + 1;
$rsql = "SELECT * FROM ".$OekakiPoteto_MemberPrefix."oekakichat order by posttime desc LIMIT ".($pageno*$chatDisp).", ".$chatDisp;
$result5 = mysql_query($rsql);
$rownum = mysql_numrows($result5);
}
$chatq = "SELECT * FROM ".$OekakiPoteto_MemberPrefix."oekakichat WHERE (DATE_ADD(posttime,INTERVAL 1 MINUTE) > NOW())";
$oresult = mysql_query($chatq);
$orownum = mysql_numrows($oresult);
$online = mysql_query("SELECT onlineusr, locale FROM ".$OekakiPoteto_MemberPrefix."oekakionline WHERE locale='chat'");
$onlinerow = mysql_numrows($online);
?>
<meta http-equiv="refresh" content="15;url=chat.php">
</head>
<?
	$testrslt = mysql_query("SELECT usrname, usrpass, language, templatesel, usrflags FROM ".$OekakiPoteto_MemberPrefix."oekaki WHERE usrname='$OekakiU'");
	
	//extract the fields selected above into variables
	$row = mysql_fetch_array($testrslt);

if($OekakiU == ""){
	include("language/".$language.".php");
	include("templates/".$template.".php");
	} else {
	include("templates/".$row[templatesel].".php");
	include("language/".$row[language].".php");
}
?>
<body bgcolor="<?=$bgColor?>" text="<?=$textColor?>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="templates/<?=$bgImage?>" link="<?=$link?>" vlink="<?=$vLink?>" alink="<?=$aLink?>">


  
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center" class="infotable">
  <tr> 
      <td><font size="-2"><b><?=$langop_common_mpage?>:</b> 
        <? WHILE ($i4 < $pages):?>
        [ <a href="chat.php?pageno=<?=$i4?>"><?=$i4+1?></a> ] 
        <? 
$i4++;
endwhile;?>
        </font></td>
    </tr>
  </table>
  
<table width="95%" cellpadding="2" align="center">
  <tr> 
    <td height="22" class="header"><?=$langop_chat_msgbox?> (<a href="#" onClick="openWindow('niftyusage.php', 500, 300); return false"><?=$langop_common_niftytoo?></a>)</td>
  </tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0" class="infotable" align="center">
  <tr> 
    <td width="75%" valign="top"> 
      <table width="95%" border="0" cellspacing="0" cellpadding="0" class="infotable" align="left">
        <tr> 
          <td><b><?=$langop_chat_conversation?></b></td>
        </tr>
        <?  
//Output rows until the value of i matches the number of rows
for ($i = 0; $i < $rownum ; $i++) {?>
        <tr> 
          <td> 
<? if(substr(mysql_result($result5,$i,"comment"),0,3) == "/me"){
	if (mysql_result($result5,$i,"usrname") == "Guest") {
?><font color="<?=$link?>">* <a href="mailto:<?=mysql_result($result5,$i,"email");?>"><ACRONYM TITLE="<?=mysql_result($result5,$i,"IP");?> / <?=mysql_result($result5,$i,"hostname");?>"><?=mysql_result($result5,$i,"postname");?></ACRONYM>&nbsp;<?=nifty2_convert(substr(mysql_result($result5,$i,"comment"),3));?></font><?} else {?><font color="<?=$link?>">* <a onClick="openWindow('profile.php?user=<?=urlencode(mysql_result($result5,$i,"usrname"));?>', 300, 400); return false" href="#"><ACRONYM TITLE="<?=mysql_result($result5,$i,"IP");?> / <?=mysql_result($result5,$i,"hostname");?>"><?=mysql_result($result5,$i,"usrname");?></ACRONYM></a><?=nifty2_convert(substr(mysql_result($result5,$i,"comment"),3));?></font>
<? } } else { ?>
&lt;<?if (mysql_result($result5,$i,"usrname") == "Guest") {?>#<a href="mailto:<?=mysql_result($result5,$i,"email");?>"><ACRONYM TITLE="<?=mysql_result($result5,$i,"IP");?> / <?=mysql_result($result5,$i,"hostname");?>"><?=mysql_result($result5,$i,"postname");?></ACRONYM></a>&gt;&nbsp;<?=nifty2_convert(mysql_result($result5,$i,"comment"));?><?} else {?>*<a onClick="openWindow('profile.php?user=<?=urlencode(mysql_result($result5,$i,"usrname"));?>', 300, 400); return false" href="#"><ACRONYM TITLE="<?=mysql_result($result5,$i,"IP");?> / <?=mysql_result($result5,$i,"hostname");?>"><?=mysql_result($result5,$i,"usrname");?></ACRONYM></a>&gt;&nbsp;<?=nifty2_convert(mysql_result($result5,$i,"comment"));?>
            <?}}?> 
          </td>
        </tr>
        <? }?>
      </table>
    </td>
    <td width="25%" valign="top"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="infotable">
        <tr> 
          <td> 
            <div align="right"><b> <?=$langop_word_registered?>:</b></div>
          </td>
        </tr>
        <tr> 
          <td> 
            <div align="right"> 
              <? for($s=0; $s < $onlinerow; $s++){?>
              <a onClick="openWindow('profile.php?user=<?=urlencode(mysql_result($online,$s,"onlineusr"));?>', 300, 400); return false;" href="#"> 
<?=mysql_result($online,$s,"onlineusr");?>
              </a><br>
              <? } ?>
            </div>
          </td>
        </tr>
      </table>
      <br>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="infotable">
        <tr> 
          <td> 
            <div align="right"><b><?=$langop_word_guests?>:</b></div>
          </td>
        </tr>
        <tr> 
          <td> 
            <div align="right"> 
              <? for($o=0; $o < $orownum; $o++) { ?>
              <?if (mysql_result($oresult,$o,"usrname") == "Guest") {?>

              <a href="mailto:<?=mysql_result($oresult,$o,"email");?>"> 
              <?=mysql_result($oresult,$o,"postname");?>
              </a><br>
              <? }} mysql_close($dbconn);?>
            </div>
          </td>
        </tr>
      </table>

    </td>
  </tr>
</table>
<a name="bottom"></a> 
</body>
</html>
Return current item: OekakiPoteto