<?php
session_start();
?>
<!--
-----------------
Orbit PHP Chatter
-----------------
PHP/MySQL Online chatter with Administration and
Private Messaging Capabilities
Copyright (C) Chris Winfield-Blum - Orbit Services
www.orbitservices.net
-------------------------------------------------------
Access the Forum here:
http://forums.orbitservices.net
------------------------------------------------------
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<?php
//////////////////////
// SET PROPERTIES //
//////////////////////
// Chat Size in rows - Default 15
$chatrows = "15";
// Session Timeout for users - Default 5
$sessiontime = "15";
// Refresh Rate in Seconds - Default 5
$refreshrate = "2";
// Use Smilies - note you must download the smilies first
$use_smilies = "yes";
// Smilies Location - example img/smilies (note: no trailing / )
$smilies = "smilies";
define('SMILIES', $smilies);
// Strip HTML Tags
$StripHTMLTags = "yes";
// Exceptions to the Strip HTML Tags rule
$StripHTMLTagsExceptions = "<b><u><i>"; // It is not recommended to allow <a><img> etc as you may get spammed
// Administration User
$admin = "admin";
// Version
$version = "0.1 Beta 4";
// OrbitPHPChatter Title
$title = "Orbit PHPChatter Demo";
// OrbitPHPChatter Footer
// Please leave this as is to show your support
// for this project
$footer = "<font size=1 face=\"Arial\"><a href=\"http://www.orbitservices.net\" target=\"_blank\">Powered by Orbit PHP Chatter $version</a></font>";
// Set Logging off so we dont display the long MySQL Errors
// ~E_ALL means all off
//ini_set ( "display_errors", "E_ALL" );
// DB Settings
$db_user = ""; // Username
$db_password = ""; // Password
$db_host = ""; // Database Host
$db_name = ""; // Database Name
/* -------------------------------------------
YOU SHOULD NOT NEED TO MODIFY BEYOND THIS POINT
------------------------------------------- */
// Lets make it compliant with register_globals=off
$page = $_GET['page'];
$action = $_GET['action'];
$header = $_GET['header'];
$to = $_GET['to'];
$from = $_GET['from'];
$chatid = $_GET['chatid'];
$accepted = $_GET['accepted'];
$newmessage = $_GET['newmessage'];
$subaction = $_GET['subaction'];
$confirmed = $_GET['confirmed'];
$subpage = $_GET['subpage'];
$bgcolor = $_GET['bgcolor'];
$upgradepw = $_GET['upgradepw'];
$username = $_SESSION['username'];
// Security Checks
if($_GET['username'] != '')
{
echo "<font face='Arial'><b>Tut tut tut, you should be doing that!!</b></font>";
exit;
}
if((($_SESSION['username'] == $admin)OR($_POST['username'] == $admin))AND(file_exists('upgrade.php')))
{
echo "<font face='Arial'><b>Before you do anything please delete the upgrade.php file!!</b></font><BR><BR><a href=\"$PHP_SELF?page=login\">Refresh</a>";
exit;
}
// These are our php functions used in the script
function nice_addslashes($string)
{
// if magic quotes is on the string is already quoted, just return it
if(MAGIC_QUOTES)
return $string;
else
return addslashes($string);
}
function sanitize_sql_string($string, $min='', $max='')
{
$string = nice_addslashes($string); //gz
$pattern = "/;/"; // jp
$replacement = "";
$len = strlen($string);
if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max)))
return FALSE;
return preg_replace($pattern, $replacement, $string);
}
// HTML Convert/Revert Class
function HTMLConvert($text, $type)
{
// if type is convert
if($type == "convert")
{
// run it through htmlentities
$text = htmlentities($text, ENT_QUOTES);
}
// if type is revert
else if($type == "revert")
{
// decode our text
$text = html_entity_decode($text);
}
// if type is revert_short
else if($type == "revert_short")
{
//decode and strip out common chars we dont want
$text = html_entity_decode($text);
$text = str_replace ( "<p>", " ", $text );
$text = str_replace ( "</p>", " ", $text );
$text = str_replace ( "<br>", " ", $text );
}
// return the end result
return $text;
}
function Smilies($text)
{
$uc = $text;
$smilies = SMILIES;
$uc = str_replace ( ":)", "<IMG SRC=\"".$smilies."/smile.gif\">", $uc );
$uc = str_replace ( ":(", "<IMG SRC=\"$smilies/sad.gif\">", $uc );
$uc = str_replace ( ";)", "<IMG SRC=\"$smilies/wink.gif\">", $uc );
$uc = str_replace ( ":D", "<IMG SRC=\"$smilies/lol.gif\">", $uc );
$uc = str_replace ( ":*(", "<IMG SRC=\"$smilies/crying.gif\">", $uc );
$uc = str_replace ( ":?", "<IMG SRC=\"$smilies/confused.gif\">", $uc );
$uc = str_replace ( ":X", "<IMG SRC=\"$smilies/sealed.gif\">", $uc );
$uc = str_replace ( "8)", "<IMG SRC=\"$smilies/cool.gif\">", $uc );
$uc = str_replace ( ":P", "<IMG SRC=\"$smilies/tongue.gif\">", $uc );
$uc = str_replace ( ":@", "<IMG SRC=\"$smilies/mad.gif\">", $uc );
$uc = str_replace ( ":$", "<IMG SRC=\"$smilies/shy.gif\">", $uc );
$uc = str_replace ( ":L", "<IMG SRC=\"$smilies/love.gif\">", $uc );
$uc = str_replace ( ":|", "<IMG SRC=\"$smilies/blank.gif\">", $uc );
$uc = str_replace ( ":Z", "<IMG SRC=\"$smilies/sleep.gif\">", $uc );
$uc = str_replace ( "(devil)", "<IMG SRC=\"$smilies/devil.gif\">", $uc );
$uc = str_replace ( "(clown)", "<IMG SRC=\"$smilies/clown.gif\">", $uc );
$uc = str_replace ( "(pig)", "<IMG SRC=\"$smilies/pig.gif\">", $uc );
$uc = str_replace ( "(cow)", "<IMG SRC=\"$smilies/cow.gif\">", $uc );
$uc = str_replace ( "(monkey)", "<IMG SRC=\"$smilies/monkey.gif\">", $uc );
$uc = str_replace ( "(chicken)", "<IMG SRC=\"$smilies/chicken.gif\">", $uc );
$uc = str_replace ( "(rose)", "<IMG SRC=\"$smilies/rose.gif\">", $uc );
$uc = str_replace ( "(skull)", "<IMG SRC=\"$smilies/skull.gif\">", $uc );
$uc = str_replace ( "(alien)", "<IMG SRC=\"$smilies/alien.gif\">", $uc );
$uc = str_replace ( "(boy)", "<IMG SRC=\"$smilies/boy.gif\">", $uc );
$uc = str_replace ( "(girl)", "<IMG SRC=\"$smilies/girl.gif\">", $uc );
$uc = str_replace ( $colfnt, $ccolfnt, $uc );
$text = $uc;
return $text;
}
// Set the database access information
define('DB_USER', $db_user);
define('DB_PASSWORD', $db_password);
define('DB_HOST', $db_host);
define('DB_NAME', $db_name);
// Make connection with DB
$dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$dbc) {
die('<b>Could not connect to the Database, please check your Database Settings</b>');
exit;
}
mysql_select_db (DB_NAME);
?>
<html>
<head>
<title><?=$title;?> <?=$version;?> :: www.orbitservices.net</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<?php
// Common Javascript
?>
<!-- Popup Window -->
<script language=JavaScript>
var popWin = "";
function openwin(URL, strWidth, strHeight){
if (popWin != ""){popWin.close()}