Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Harish Chauhan  >  Chat Class  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: example
Class: Chat Class
Chat room management with talks stored in files
Author: By
Last change:
Date: 8 years ago
Size: 1,091 bytes
 

Contents

Class file image Download
<?php
@session_start();
include_once(
"chat.inc.php");

if(!empty(
$_POST['name']))
{
    
$room="newroom";
    
$_SESSION['SES_USER_NAME']=$_POST['name'];
    
$mychat=new Chat($room);
    if(
$mychat->addUser($_POST['name'])===false)
    {
        
$_SESSION['SES_USER_NAME']='';
        
$_SESSION['MSG_LINES']=0;
        echo 
$mychat->room->getError();
    }
    
}

?>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function openchat()
{
    window.open("chat.php?room=<?=$room?>",'','toolbar=0,status=0,height=500,width=770');
}
//-->
</SCRIPT>
</head>
<body>
<table cellspacning=1 cellpadding=2 border=0>
<?php if(empty($_SESSION['SES_USER_NAME'])){?>

<form name='' action='' method='POST'>
<tr><td><b>Enter Your Name:</b></td>
<td><input name='name'></td>
<td colspan=><input type='submit' name='addme' value='Go!'></td>
</tr></form>
<?php }else {?>
<tr><td>
<a href='javascript:openchat()'>click here</a> to start the <a href='javascript:openchat()'>Chat.</a>
</td></tr>
<SCRIPT LANGUAGE="JavaScript">
<!--
openchat();
//-->
</SCRIPT>
<?php }?>

</table>
</body>
</html>