Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set('Europe/London');
- $site = "http://www.socialf.tk";
- error_reporting(E_ALL ^ E_NOTICE);
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <link href='styles/main.css' rel="stylesheet" type="text/css"></link>
- <title><?php echo $title; ?></title>
- <style type="text/css">
- body
- {
- background-color:#b0c4de;
- }
- #login{
- }
- #window{
- width:320px;
- height:290px;
- background-color:#D8D8D8;
- border:1px solid #333333;
- overflow:scroll
- }
- #send{
- width:320px;
- height:33px;
- background-color:;
- border:1px solid #333333;
- }
- #status{
- width:320px;
- height:25px;
- background-color:;
- }
- </style>
- </head>
- <body>
- <?php
- $title = "Social Fun";
- ?>
- <div id="wrapper">
- <?php
- session_start();
- $username = $_SESSION['username'];
- $userid = $_SESSION['id'];
- $user = $_SESSION['user'];
- if($user){
- require('connect.php');
- $time = date("d F, Y \a\\t\ H:i:s");
- ?>
- <?php
- echo "<div id='status'>";
- echo "Your chatting username is: <b>$user</b>";
- echo "<br>";
- echo "</div>";
- echo "<font color='red'>$errormsg</font>";
- echo "<div id='window'>";
- $query = mysql_query("SELECT * FROM chat ORDER BY time DESC");
- $numrows = mysql_num_rows($query);
- if($numrows >0 ){
- $query = "SELECT * FROM chat";
- $result = mysql_query($query);
- while ($row = mysql_fetch_array($result))
- {
- // display information for each dog.
- echo "<b>$row[user]</b> On <i>$row[time]</i> - <br>$row[content]<hr>";
- }
- }
- else
- echo "No message be the first!";
- echo "<a name='chat'></a>";
- echo "</div>";
- $form = "<div id='send'>
- <form action='chat.php#chat' method='post'>
- <center><input type='text' name='msg' style='width:75%;' />
- <input type='submit' name='loginbtn' id='loginbtn' /></center>
- </div>";
- $message = $_POST['msg'];
- if($_POST['loginbtn']){
- if($message){
- echo "$form";
- mysql_query("INSERT INTO chat VALUES('$user', '$time', '$message')");
- }
- else
- echo "<font color='red'>You must enter a message.</font> $form";
- }
- else
- echo "$form";
- ?>
- <?php
- }
- else
- echo "You must be logged in to chat.";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement