Riferimento: Problema Con IIS e Il mio retro!
ecco il core.php
<?php
/*===================================================+
|| # HoloCMS - Website and Content Management System
|+===================================================+
|| # Copyright © 2008 Meth0d. All rights reserved.
|| #
|+===================================================+
|| # HoloCMS is provided "as is" and comes without
|| # warrenty of any kind. HoloCMS is free software!
|+===================================================*/
/** HOLOCMS MAINCORE
* @author Meth0d
* @
Desc Main HoloCMS Processor
* @
USAge N/A
*/
define("IN_HOLOCMS", TRUE);
session_start();
// #########################################################################
// Start the initalization process
@include('./config.php');
@include('../config.php');
// Launch the installer if needed
if(empty($sqlpassword) || empty($sqlusername) || empty($sqldb) || empty($sqlhostname)){
header("location:install.php");
exit;
} else {
if(file_exists('install.php') || file_exists('upgrade.php') && $bypass_check != true){
echo "Attenzione , ci sono dei file di installazione del cms , rimuovili per continuare";
exit;
}elseif(file_exists('check.php')){
header("location:check.php");
} else {
include('includes/mysql.php');
}
}
// Validate the langauge
$language_path = "./".$language."index.php";
$language_path_2 = "../".$language."index.php";
if(file_exists($language_path) || file_exists($language_path_2)){
$valid_language = true;
} else {
$language = "en";
$valid_language = false;
}
// #########################################################################
// Define the variables HoloCMS wants to use later on
$remote_ip = $_SERVER[REMOTE_ADDR];
$configsql = mysql_query("SELECT * FROM cms_system LIMIT 1") or die(mysql_error());
$config = mysql_fetch_assoc($configsql);
$enable_sso = $config['enable_sso'];
$language = $config['language'];
$sitename = $config['sitename'];
$shortname = $config['shortname'];
$ip = $config['ip'];
$dcr = $config['dcr'];
$port = FetchServerSetting('server_game_port');
$fport = FetchServerSetting('server_mus_port');
$texts = $config['texts'];
$variables = $config['variables'];
$reload_url = $config['reload_url'];
$maintenance = $config['site_closed'];
$H = date('H');
$i = date('i');
$s = date('s');
$m = date('m');
$d = date('d');
$Y = date('Y');
$j = date('j');
$n = date('n');
$today = $d;
$month = $m;
$year = $Y;
$date_normal = date('d-m-Y',mktime($m,$d,$Y));
$date_reversed = date('Y-m-d', mktime($m,$d,$y));
$date_full = date('d-m-Y H:i:s',mktime($H,$i,$s,$m,$d,$Y));
$date_time = date('H:i:s',mktime($H,$i,$s));
$date_hc = "".$j."-".$n."-".$Y."";
$regdate = $date_normal;
$s1ql = mysql_query("SELECT * FROM server_status LIMIT 1");
$r1ow = mysql_fetch_assoc($s1ql);
$online_count = $r1ow['users_online'];
$server_on_localhost = $config['localhost'];
$habboversion = "63_1dc60c6d6ea6e089c6893ab4e0541ee0/116";
$forumid = FilterText($_GET['id']);
$analytics = HoloText($config['analytics'], true)."\n";
// #########################################################################
function edit_date($data , $full = false)
{
$xbits = explode(" ", $data);
$xdate = explode("-", $xbits[0]);
$mesi = array('01' => 'gen', '02' => 'feb', '03' => 'mar', '04' => 'apr', '05' => 'mag', '06' => 'giu', '07' => 'lug', '08' => 'ago', '09' => 'set', '10' => 'ott' , '11' => 'nov', '12' => 'dic');
if($full != true) { $data = "".$xdate[0]."-".strtr($xdate[1], $mesi)."-".$xdate[2].""; }else{ $data = "".$xdate[0]."-".strtr($xdate[1], $mesi)."-".$xdate[2]." ".$xbits[1].""; }
return $data;
}
function FetchServerSetting($strSetting, $switch = false){
$tmp = mysql_query("SELECT sval FROM system_config WHERE skey = '".$strSetting."' LIMIT 1") or die(mysql_error());
$tmp = mysql_fetch_assoc($tmp);
if($switch !== true){
return $tmp['sval'];
} elseif($switch == true && $tmp['sval'] == "1"){
return "Enabled";
} elseif($switch == true && $tmp['sval'] !== "1"){
return "Disabled";
}
}
// #########################################################################
function getContent($strKey){
$tmp = mysql_query("SELECT contentvalue FROM cms_content WHERE contentkey = '".FilterText($strKey)."' LIMIT 1") or die(mysql_error());
$tmp = mysql_fetch_assoc($tmp);
return $tmp['contentvalue'];
}
// #########################################################################
function getServer($value, $switch = false){
$sql = mysql_query("SELECT sval FROM system_config WHERE skey = '".$value."' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_assoc($sql);
if($switch !== true){
return $row['sval'];
} else if($switch && $row['sval'] == "1"){
return "Attivato";
} else if($switch && $row['sval'] !== "1"){
return "Disattivato";
}
}
// #########################################################################
// If a user is logged out and has a 'remember me' cookie, validate the information
// in the cookie and log the user in if everything's valid.
// Please do not mess with this. It is a fairly simple process, but if it doesn't work
// properly it can cause a huge mess. Everything in this function is commented.
@include('./includes/inc.crypt.php');
@include('../includes/inc.crypt.php');
if(!session_is_registered(username) && $_COOKIE['remember'] == "remember"){
// Get variables stored in cookies; the username and sha1 hashed password
$cname = FilterText($_COOKIE['rusername']);
$cpass_hash = $_COOKIE['rpassword'];
// Now fetch the password that belongs to this user from the database
$csql = mysql_query("SELECT password FROM users WHERE username = '".$cname."' LIMIT 1") or die(mysql_error());
$cnum = mysql_num_rows($csql);
// If no results are returned (invalid username, destroy the cookie
if($cnum < 1){
setcookie("remember", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
setcookie("rusername", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
setcookie("rpassword", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
} else {
// We found a user, now get his password and hash it
$crow = mysql_fetch_assoc($csql);
$correct_pass = $crow['password'];
// Check if the hashed database password and hash in the cookie match
// If no, destroy the cookie. If yes, log the user in.
if($cpass_hash == $correct_pass){
$_SESSION['username'] = $cname;
$_SESSION['password'] = $crow['password'];
mysql_query("UPDATE users SET lastvisit = '".$date_full."' WHERE username = '" . $cname . "'") or die(mysql_error());
header("Location: security_check.php");
exit;
} else {
setcookie("remember", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
setcookie("rusername", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
setcookie("rpassword", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/");
}
}
}
// #########################################################################
function IsEven($intNumber)
{
if($intNumber % 2 == 0){
return true;
} else {
return false;
}
}
// #########################################################################
function bbcode_format($str){
// Parse smilies
if(HoloText(getContent('enable-smilies'), true) == "1"){
$str = str_replace("
", " <img src='./web-gallery/smilies/smile.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(";)", " <img src='./web-gallery/smilies/wink.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(":P", " <img src='./web-gallery/smilies/tongue.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(";P", " <img src='./web-gallery/smilies/winktongue.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(":p", " <img src='./web-gallery/smilies/tongue.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(";p", " <img src='./web-gallery/smilies/winktongue.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace("(L)", " <img src='./web-gallery/smilies/heart.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace("(l)", " <img src='./web-gallery/smilies/heart.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(":o", " <img src='./web-gallery/smilies/shocked.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
$str = str_replace(":O", " <img src='./web-gallery/smilies/shocked.gif' alt='Smiley' title='Smiley' border='0'> ", $str);
}
// Parse BB code
$simple_search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[s\](.*?)\[\/s\]/is',
'/\[quote\](.*?)\[\/quote\]/is',
'/\[link\=(.*?)\](.*?)\[\/link\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'/\[color\=(.*?)\](.*?)\[\/color\]/is',
'/\[size=small\](.*?)\[\/size\]/is',
'/\[size=large\](.*?)\[\/size\]/is',
'/\[code\](.*?)\[\/code\]/is',
'/\[habbo\=(.*?)\](.*?)\[\/habbo\]/is',
'/\[room\=(.*?)\](.*?)\[\/room\]/is',
'/\[group\=(.*?)\](.*?)\[\/group\]/is',
'/\[img\](.*?)\[\/img\]/is'
);
$simple_replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<s>$1</s>',
"<div class='bbcode-quote'>$1</div>",
"<a href='$1'>$2</a>",
"<a href='$1'>$2</a>",
"<font color='$1'>$2</font>",
"<font size='1'>$1</font>",
"<font size='3'>$1</font>",
'<pre>$1</pre>',
"<a href='./user_profile.php?id=$1'>$2</a>",
"<a onclick=\"roomForward(this, '$1', 'private'); return false;\" target=\"client\" href=\"./client.php?forwardId=2&roomId=$1\">$2</a>",
"<a href='./group_profile.php?id=$1'>$2</a>",
"<img src='$1'/>"
);
$str = preg_replace ($simple_search, $simple_replace, $str);
return $str;
}
// #########################################################################
function GenerateTicket(){
$data = "";
for ($i=1; $i<=6; $i++){
$data = $data . rand(0,10);
}
$data = $data . "";
for ($i=1; $i<=20; $i++){
$data = $data . rand(0,10);
}
$data = $data . "";
$data = $data . rand(0,10);
return $data;
}
// #########################################################################
if(session_is_registered('username')){
$rawname = $_SESSION['username']; // Has slashes added and lacking proper capitals
$rawpass = $_SESSION['password']; // HoloHash()'ed user password
$usersql = mysql_query("SELECT * FROM users WHERE username = '".$rawname."' AND password = '".$rawpass."' LIMIT 1");
$myrow = mysql_fetch_assoc($usersql);
$password_correct = mysql_num_rows($usersql);
$my_id = $myrow['id'];
//$my_name = $myrow['username'];
$user_rank = $myrow['rank'];
$check = mysql_query("SELECT * FROM bans WHERE value = '".$rawname."' LIMIT 1") or die(mysql_error());
$is_banned = mysql_num_rows($check);
if($password_correct !== 1){ // Login Anti
session_destroy();
header("location:index.php?error=1");
exit;
} elseif($is_banned > 0){
$bandata = mysql_fetch_assoc($check);
$reason = $bandata['reason'];
$expire = $bandata['expire'];
if($is_banned > 0){
$login_error = "Sei stato bannato per \"" . $reason . "\". il tuo ban finisce " . $expire . ".";
include('logout.php');
session_destroy();
exit;
}
}
if($enable_sso == 1 && $password_correct == 1){
$myticket = $myrow['auth_ticket'];
// if(empty($myticket) || $myticket == "0" || strlen($myticket) < 39){
// $myticket = GenerateTicket();
// mysql_query("UPDATE users SET ticket_sso = '".$myticket."', ipaddress_last = '".$remote_ip."' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
// }
} else {
$myticket = "";
}
$logged_in = true;
$name = HoloText($myrow['username']);
} else {
$user_rank = 0;
$name = "Guest";
$my_id = "GUEST";
//$myticket = "";
$logged_in = false;
}
// #########################################################################
// Gift check (noob/welcome stuff)
/*
$sql = mysql_query("SELECT noob,gift,sort,roomid,lastgift FROM users WHERE id='".$my_id."' LIMIT 1");
$row = mysql_fetch_assoc($sql);
if($row['gift'] < 3) {
if($row['noob'] == 1) {
if($row['lastgift'] < date("d-m-Y")) {
mysql_query("INSERT INTO cms_noobgifts (userid,gift,read) VALUES ('".$my_id."','".$row['gift']."','0')");
mysql_query("UPDATE users SET lastgift='".date("d-m-Y")."',gift=gift+'1' WHERE id='".$my_id."' LIMIT 1");
}
}
}
// #########################################################################
*/
if($enable_status_image == "1"){
if($server_on_localhost != 0 || $ip == "127.0.0.1"){
$fip = "127.0.0.1";
} else {
$fip = $ip;
}
$fp = @fsockopen($fip, $fport, $errno, $errstr, 1);
if($fp){
$online = "online";
fclose($fp);
} else {
$online = "offline";
}
}else{
$online = "online";
}
// #########################################################################
if($user_rank > 5){
if(session_is_registered(hkusername) && session_is_registered(hkpassword)){
$rank['iAdmin'] = "1";
} else {
$rank['iAdmin'] = "0";
}
} else {
$rank['iAdmin'] = "0";
}
// #########################################################################
function GetUserBadge($strName){ // supports user IDs also
if(is_numeric($strName)){
$check = mysql_query("SELECT id FROM users WHERE id = '".$strName."' AND badge_status = '1' LIMIT 1") or die(mysql_error());
} else {
$check = mysql_query("SELECT id FROM users WHERE username = '".FilterText($strName)."' AND badge_status = '1' LIMIT 1") or die(mysql_error());
}
$exists = mysql_num_rows($check);
if($exists > 0){
$usrrow = mysql_fetch_assoc($check);
$check = mysql_query("SELECT * FROM user_badges WHERE user_id = '".$usrrow['id']."' AND badge_slot = '1' LIMIT 1") or die(mysql_error());
$hasbadge = mysql_num_rows($check);
if($hasbadge > 0){
$badgerow = mysql_fetch_assoc($check);
return $badgerow['badge_id'];
} else {
return false;
}
} else {
return false;
}
}
// #########################################################################
function GetUserGroup($my_id){
$check = mysql_query("SELECT groupid FROM user_stats WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
$has_fave = mysql_num_rows($check);
if($has_fave > 0){
$row = mysql_fetch_assoc($check);
$groupid = $row['groupid'];
return $groupid;
} else {
return false;
}
}
// #########################################################################
function GetUserGroupBadge($my_id){
$check = mysql_query("SELECT groupid FROM user_stats WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
$has_badge = mysql_num_rows($check);
if($has_badge > 0){
$row = mysql_fetch_assoc($check);
$groupid = $row['groupid'];
$check = mysql_query("SELECT badge FROM groups WHERE id = '".$groupid."' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_assoc($check);
$badge = $row['badge'];
return $badge;
} else {
return false;
}
}
// #########################################################################
// Calculate the amount of HC Days left
function HCDaysLeft($my_id){
// Query for the info we need to calculate
$sql = mysql_query("SELECT months_left,date_monthstarted FROM users_club WHERE userid = '".$my_id."' LIMIT 1") or die(mysql_error());
$tmp = mysql_fetch_assoc($sql);
$valid = mysql_num_rows($sql);
if($valid > 0){
// Collect the variables we need from the query result
$months_left = $tmp['months_left'];
$month_started = $tmp['date_monthstarted'];
// We take 31 days for every month left, assuming each month has 31 days
$days_left = $months_left * 31;
// Split up the day/month/year so we can use it with mktime
$tmp = explode("-", $month_started);
$day = $tmp[0];
$month = $tmp[1];
$year = $tmp[2];
// First of all make the dates we want to compare, do some math
$then = mktime(0, 0, 0, $month, $day, $year, 0);
$now = time();
$difference = $now - $then;
// If this month expired already
if ($difference < 0){
$difference = 0;
}
// Now do some math
$days_expired = floor($difference/60/60/24);
// $days_expired stands for the days we already wasted in this month
// 31 days for each month added together, minus the days we've wasted in the current month, is the amount of days we have left, totally
$days_left = $days_left - $days_expired;
return $days_left;
} else {
return 0;
}
}
// #########################################################################
if($maintenance == "1" && !$is_maintenance && $rank['iAdmin'] < 1){
header("Location: maintenance.php");
exit;
} elseif($rank['iAdmin'] == 1 && $maintenance == 1){
$notify_maintenance = true;
}
// #########################################################################
function AddUser($username = '', $real_name = '', $password = '', $mail = '', $figure = '', $motto = '', $home_room = '', $birth = '', $fb_id = 0)
{
mysql_query("INSERT INTO users (username, real_name, password, mail, credits, look, motto, account_created, last_online, ip_last, ip_reg, home_room, birth, facebook_id) VALUES ('".$username."', '".FilterText($real_name)."', '".$password."', '".$mail."', '50000', '".$figure."', '".$motto."', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['REMOTE_ADDR']."', '".$home_room."','".$birth."','".$fb_id."')");
$user_id = mysql_insert_id();
mysql_query("INSERT INTO user_stats (id, RoomVisits, OnlineTime, Respect, RespectGiven, GiftsGiven, GiftsReceived, DailyRespectPoints, DailyPetRespectPoints) VALUES ('".$user_id."', 0, 0, 0, 0, 0, 0, 3, 3)");
mysql_query("INSERT INTO user_info (user_id, bans, cautions, reg_timestamp, login_timestamp, cfhs, cfhs_abusive) VALUES ('".$user_id."', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0')");
}
// #########################################################################
function IsHCMember($my_id){
if(HCDaysLeft($my_id) > 0 ){
return true;
} else {
// Make sure that HC members are _not_ rank 2 and that they do not have their gay little badge
$check = mysql_query("SELECT * FROM users_club WHERE userid = '".$my_id."' LIMIT 1");
$clubrecord = mysql_num_rows($check);
if($clubrecord > 0){
mysql_query("UPDATE users SET badge_status = '0', hc_before='1' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
mysql_query("UPDATE users SET rank = '1' WHERE id = '".$my_id."' AND rank = '2' LIMIT 1") or die(mysql_error());
mysql_query("DELETE FROM users_badges WHERE badgecode = 'HC1' OR badgeid = 'HC2' AND userid = '".$my_id."' LIMIT 1");
mysql_query("DELETE FROM users_club WHERE userid = '".$my_id."' LIMIT 1") or die(mysql_error());
if(function_exists(SendMUSData) !== true){ include('includes/mus.php'); }
}
return false;
}
}
// #########################################################################
function GiveHC($user_id, $months){
$sql = mysql_query("SELECT * FROM users_club WHERE userid = '".$user_id."' LIMIT 1") or die(mysql_error());
$valid = mysql_num_rows($sql);
if($valid > 0){
mysql_query("UPDATE users SET rank = '1' WHERE rank = '1' AND id = '".$user_id."' LIMIT 1") or die(mysql_error());
mysql_query("UPDATE users_club SET months_left = months_left + ".$months." WHERE userid = '".$user_id."' LIMIT 1") or die(mysql_error());
$check = mysql_query("SELECT * FROM user_badges WHERE badge_id = 'HC6' AND user_id = '".$user_id."' LIMIT 1") or die(mysql_error());
$found = mysql_num_rows($check);
if($found !== 1){ // No badge. Poor thing.
mysql_query("UPDATE users SET badge_status = '0' WHERE id = '".$user_id."' LIMIT 1") or die(mysql_error());
mysql_query("UPDATE user_badges SET badge_slot = '0' WHERE user_id = '".$user_id."'") or die(mysql_error());
mysql_query("INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('".$user_id."','HC1','1')") or die(mysql_error());
}
} else {
$m = date('m');
$d = date('d');
$Y = date('Y');
$date = date('d-m-Y', mktime($m,$d,$Y));
mysql_query("INSERT INTO users_club (userid,date_monthstarted,months_expired,months_left) VALUES ('".$user_id."','".$date."','0','0')") or die(mysql_error());
GiveHC($user_id, $months);
}
if(function_exists(SendMUSData) !== true){ include('includes/mus.php'); }
}
// #########################################################################
if(session_is_registered(username)){
$blob = time();
mysql_query("UPDATE users SET online1 = '".$blob."', ipaddress_last = '".$remote_ip."' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
mysql_query("UPDATE users SET ip_last = '".$remote_ip."' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
//if($phail == true){
//echo "<b>Please wait..</b><br />Please wait while we update your HoloDB compatability..<br />";
//mysql_query("ALTER TABLE `users` ADD `online` TEXT NOT NULL ;") or die(mysql_error());
//echo "Done! Please reload this page to proceed. You will not see this message again.";
//exit;
//}
}
// #########################################################################
function IsUserOnline($intUID){
$result = mysql_fetch_array(mysql_query("SELECT online FROM users WHERE id = '".$intUID."' LIMIT 1")) or die(mysql_error());
if($result['online'] == 1){
return true;
} else {
return false;
}
}
// #########################################################################
function IsUserBanned(){
}
// ######################################################################### MUS servono per Phoenix Emulator
function SendMUS($header, $data){
$ip = "37.59.232.23";
$port = 30001;
$musData = $header . chr(1) . $data;
$sock = @
Socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@
Socket_connect($sock, $ip, $port);
@
Socket_send($sock, $musData, strlen($musData), MSG_DONTROUTE);
@
Socket_close($sock);
}
// #########################################################################
function mysql_evaluate($query, $default_value="undefined") {
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) < 1){
return $default_value;
} else {
return mysql_result($result, 0);
}
}
// ######################################################################### Non serve
function CheckGruppi() {
$gruppif = mysql_query("SELECT * FROM group_memberships WHERE is_current = '1'") or die(mysql_error());
while($gruppir = mysql_fetch_assoc($gruppif)) {
mysql_query("UPDATE user_stats SET groupid = '".$gruppir['groupid']."' WHERE id = '".$gruppir['userid']."'") or die(mysql_error());
}
}
// ######################################################################### Filter
function FilterText($str, $advanced=false) {
if($advanced == true){ return mysql_real_escape_string($str); }
$str = mysql_real_escape_string(htmlspecialchars($str));
return $str;
}
function HoloText($str, $advanced=false, $bbcode=false) {
if($advanced == true){ return stripslashes($str); }
$str = stripslashes(nl2br(htmlspecialchars($str)));
if($bbcode == true){$str = bbcode_format($str); }
return $str;
}
function stringToURL($str,$lowercase=true,$spaces=false){
$str = trim(preg_replace('/\s\s+/',' ',preg_replace("/[^A-Za-z0-9-]/", " ", $str)));
if($lowercase == true){ $str = strtolower($str); }
if($spaces == true){ $str = str_replace(" ", "-", $str); }else{ str_replace(" ", "", $str); }
return $str;
}
function textInJS($str, $clean = false){
$str = str_replace("??","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("?‘","?",$str);
$str = str_replace("?±","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("?‰","?",$str);
$str = str_replace("?©","?",$str);
$str = str_replace("?“","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("??","?",$str);
$str = str_replace("?","?",$str);
if($clean == true)
{
$str = str_replace("?","N",$str);
$str = str_replace("?","n",$str);
$str = str_replace("?","A",$str);
$str = str_replace("?","a",$str);
$str = str_replace("?","E",$str);
$str = str_replace("?","e",$str);
$str = str_replace("?","O",$str);
$str = str_replace("?","o",$str);
$str = str_replace("?","U",$str);
$str = str_replace("?","u",$str);
$str = str_replace("?","I",$str);
$str = str_replace("?","i",$str);
}
return $str;
}
function FilterSpecialChars($strInput)
{
$strInput = str_replace(chr(1), ' ', $strInput);
$strInput = str_replace(chr(2), ' ', $strInput);
$strInput = str_replace(chr(3), ' ', $strInput);
$strInput = str_replace(chr(9), ' ', $strInput);
}
function SwitchWordFilter($str)
{
$sql = mysql_query("SELECT word FROM system_wordfilter") or die(mysql_error());
while($row = mysql_fetch_assoc($sql)){
$str = str_replace($row['word'],getServer("wordfilter_censor"),$str);
}
return $str;
}
function EscapeString($string = '')
{
return mysql_real_escape_string(stripslashes(trim(htmlspecialchars($string))));
}
###################################### php stuff ######################################
error_reporting(0); /* no errors please */
session_start(); /* for user´s data */
/* NON TOCCARE */
$config["hImaging"] = 'http://habbo.it/habbo-imaging/avatarimage'; /* Trololololololollollolooooooooooooooooooooool */
/* Scegli avatar predefinito */
$config["defaultAvatar"] = 'ch-3111-63-62.hd-3103-1.hr-3163-39.lg-285-77.sh-305-78'; /* Questo look è figo */
###################################### Connessione al mysql ######################################
/* NON TOCCARE */
$con = mysql_connect($sqlhostname, $sqlusername, $sqlpassword) or die('Errore con la connessione al mysql, apri <b>config.php</b> e modifica con i tuoi dati.');
$db = mysql_select_db($sqldb, $con) or die('Database non trovato, apri <b>config.php</b> e modifica con i tuoi dati.');
// #########################################################################
/* Funzione per il caricamento dei look */
function readAvatarSet($type, $gender, $publicDir = 'json/', $extFile = '.txt'){
/* formating avatar set file */ $set_file = $publicDir.$type.'-'.strtolower($gender).'.txt';
/* check if file exists */ if(file_exists($set_file) != false){ $x = fopen($set_file, "r");
/* reading file and returning data as string */ $s = fread($x, filesize($set_file)); fclose($x); return $s; } else { return null; }
}
// #########################################################################
/* Funzione per il check delle stringhe */
function checkIfContains($substring, $string) {
$pos = strpos($string, $substring);
if($pos === false) { return false; } else { return true; }
}
// #########################################################################
/* Non serve a nulla */
function createSecurityHash($length, $numbers, $upper){
if (1 > $length) $length = 8;
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$numChars = 62; $string = '';
if (!$numbers) { $numChars = 52; $chars = substr($chars, 10, $numChars); }
if (!$upper) { $numChars -= 26; $chars = substr($chars, 0, $numChars); }
for ($i = 0; $i < $length; $i++) { $string .= $chars[mt_rand(0, $numChars - 1)]; }
return $string;
}
// #########################################################################
function Securise($str)
{
$str = mysql_real_escape_string(htmlspecialchars(stripslashes(nl2br(trim($str)))));
return $str;
}
// ######################################################################### Redirect for Facebook
function Redirect($url){
$redirect = header("location:".$url."");
return $redirect;
}
// ########################################################################## Facebook Connect
define('APP_ID', '356256347780987');
define('APP_SECRET', 'fb7de9b599a9bef750ca952ed5532b99');
// ######################################################################### Version
@include('./includes/version.php');
@include('../includes/version.php');
?>