Viewing file: conn.php (2.04 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
define("DIF_HORARIA",0);
$bbddhost="localhost";
$bbdduser="fichfilk_papyre";
$bbddpassword="ilvm2rg2";
$bbdd="fichfilk_papyre";
date_default_timezone_set('Europe/Madrid');
$conn=&mysql_connect($bbddhost,$bbdduser,$bbddpassword);
mysql_set_charset('latin1',$conn);
//$conn=mysql_connect("localhost","papyre2","ilvm1rg1");
mysql_select_db($bbdd,$conn)or die(mysql_error());
function elimina_acentos($cadena){
$tofind = "��&:�����������������������������������������������������+[]?�!�,;�'".'\\';
$replac = "--y_nNAAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuy_()----_-i-"."-";
return(strtr($cadena,$tofind,$replac));
}
function elimina_acentos_light($cadena){
$tofind = "��&:���������������������������������������������������+[]!,;�'".'\\';
$replac = "--y_AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuy_()-_-i-"."-";
return(strtr($cadena,$tofind,$replac));
}
class Encriptor
{
# The key (for security reason, it must be private)
private $Key='W2KPRO_7_caballos_vienen_de_bonanza';
// Generates the key
public function __construct($Key = 'W2KPRO_7_caballos_vienen_de_bonanza') {
$Key = str_split(md5($Key), 1);
$signal = false;
$sum = 0;
foreach($Key as $char) {
if($signal) {
$sum -= ord($char);
$signal = false;
} else {
$sum += ord($char);
$signal = true;
}
}
if($sum < 0) $sum *= -1;
$this->Key = $sum;
}
// Encrypt
public function encrypt($text) {
$text=base64_encode($text);
$text = str_split($text, 1);
$final = NULL;
foreach($text as $char) $final .= sprintf("%03x", ord($char) + $this->Key);
return $final;
}
// Decrypt
public function decrypt($text) {
$final = NULL;
$text = str_split($text, 3);
foreach($text as $char) $final .= chr(hexdec($char) - $this->Key);
return base64_decode($final);
}
}
?>
|