Riferimento: Problema Db
<?php
/*=======================================================================*\
| Copyright (c) 2012, Leo 'Met0do' -
|
| For more stuffs and data,
-
leo@met0do.org |
| ====================================================================== |
| 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 3 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. |
\*=======================================================================*/
###################################### php stuff ######################################
error_reporting(0); /* no errors please */
session_start(); /* for user´s data */
###################################### configurations ######################################
/* mysql configuration */
$config["db"]["server"] = 'localhost'; /* server of mysql */
$config["db"]["username"] = 'root'; /* username of mysql */
$config["db"]["password"] = 'MiaPasswordTopSecret'; /* password of mysql */
$config["db"]["db_name"] = 'hotelri'; /* database name */
/* basic configuration */
$config["hImaging"] = 'http://habbo.es/habbo-imaging/avatarimage'; /* server of the creation of avatar images */
/* avatar configuration */
$config["defaultAvatar"] = 'ch-3111-63-62.hd-3103-1.hr-3163-39.lg-285-77.sh-305-78'; /* he looks like Leon */
###################################### special functions ######################################
/* connecting to mysql server [database] */
$con = mysql_connect($config["db"]["server"], $config["db"]["username"], $config["db"]["password"]) or die('Error in Mysql configuration details, open <b>config.php</b> file and edit them.');
$db = mysql_select_db($config["db"]["db_name"], $con) or die('Error in Database Selection, open <b>config.php</b> file and edit it.');
/* function to read data set of avatar */
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; }
}
/* function to check if a substring contains in a string */
function checkIfContains($substring, $string) {
$pos = strpos($string, $substring);
if($pos === false) { return false; } else { return true; }
}
/* function to create a hash for user´s session, this will be the ID of the users */
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;
}
?>
@
~Cards