Fatal error: Call to undefined function

Résolu/Fermé
le_fermier Messages postés 63 Date d'inscription mardi 1 avril 2008 Statut Membre Dernière intervention 9 février 2011 - 28 mai 2009 à 15:59
le_fermier Messages postés 63 Date d'inscription mardi 1 avril 2008 Statut Membre Dernière intervention 9 février 2011 - 31 mai 2009 à 00:30
Bonjour,

Pouvez vous les amis me montrer comment installer une extension PHP sur un serveur hébergé ? a savoir "mcrypt_module"

J ai uploadé mon nouveau site sur le serveur mais quand j'essaie d'y accéder j'ai ce message :

Fatal error: Call to undefined function: mcrypt_module_open() in /home/httpd/vhosts/mon-site.com/httpdocs/dossier-sous-domaine/admin/includes/class_utils.php on line 233

=================
La ligne 233 dans class_utils.php il y'a ceci :

$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');

=================
Le contenu complet de class_utils.php est :

<?php
$PHP_SELF = $_SERVER['PHP_SELF'];
if (eregi("class_utils.php",$PHP_SELF)) {
Header("HTTP/1.0 404 Not Found");
die();
}
/**
*Class Database file
*Utils extends DB_Sql class.
**/
require_once(_DirINCLUDES."class_mysql.php");
/**
*Adds somes utilities like encryptation, image resize, save image to folder, delete folder, check date format, etc...
*@author Josep Marxuach
*@version 1.0
*@copyright 2004 by IT eLazos SL
*@package Site
*/
class utils extends DB_Sql {
/**
*Cryptar.
*Si 1 = todas los gets son encryptados, 0 = todos los gets son planos
*@var Integer
*/
var $cryptar = True ;
/**
*Random.
*Si 1 = encrypta con un numero final random rand(1,100) para que sean siempre diferentes, 0 = Se encripta sin Rand
*@var boolean
*/
var $Random = False;
var $iv64="cx0DjR012c0PACRAvpm01LojVUjvUL0cH9Yyp5/WMYc=";
var $ekey = "a7bc27daf59679de9db7b68b1ef92785";

/**
* Encryptar una url.
* Recoge todas variables de una URL y las encrypta. Devuelve una variable URL=texto emcriptado.
*@param string Vars de una URL para encriptar
**/
function url_encrypt($text){
//$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
//$iv=base64_decode($this->iv64);
$text="url".$text;
if ($this->Random) $text.="#".rand(1,100);else $text.="#00";
//$text=mcrypt_encrypt(MCRYPT_RIJNDAEL_256,"color",$text, MCRYPT_MODE_ECB,$iv);
if ($this->cryptar) $text=$this->ecrypt($text);
$text="url=".base64_encode($text);
return $text;
}
/**
* Desencryptar una url.
* Recoge la variable url de una URL y la desencrypta. Devuelve las variables en formato URL.
*@param string URL para desencriptar
**/
function txt_encrypt($text){
//$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
//$iv=base64_decode($this->iv64);
$text="url".$text;
if ($this->Random) $text.="#".rand(1,100);else $text.="#00";
//$text=mcrypt_encrypt(MCRYPT_RIJNDAEL_256,"color",$text, MCRYPT_MODE_ECB,$iv);
if ($this->cryptar) $text=$this->ecrypt($text);
$text=base64_encode($text);
return $text;
}
/**
*Desencryptar texto.
*@param string Texto a desencriptar.
**/
function decrypt_string($text){
//$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
//$iv=base64_decode($this->iv64);
//echo $text."<br/>";
$text=base64_decode($text);
//echo $text."<br/>";
//$text=mcrypt_decrypt(MCRYPT_RIJNDAEL_256,"color",$text, MCRYPT_MODE_ECB,$iv);
if ($this->cryptar) $text=$this->dcrypt($text);
return $text;
}
/**
*Encryptar texto.
*@param string Texto a encriptar.
**/
function url_decrypt($text){
$text=$this->decrypt_string($text);
if (substr($text, 0, 3)=="url") {

$text=rtrim($text);
$text=substr($text, 3, (strrpos($text,"#")-3));

if ($pos=strpos($text,"&ref="))
{
$url=substr($text, 0, $pos);
$referer=substr($text,(strpos($text,"http://")), strlen($text));
} else $url=$text;
//echo $referer."................";
parse_str($url,$result);
if (isset($referer)) $result["referer"]=$referer;

return $result;
} else return FALSE;
}
/**
*Change image size used by another method save_image
*@author Josep Marxuach
*@access private
**/
function img_resize($imagen, $destino, $max_pixels, $SelectSide=true){
/* TIPOS DE IMAGENES
1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(orden de bytes intel),
8 = TIFF(orden de bytes motorola), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC,
14 = IFF, 15 = WBMP, 16 = XBM.
*/

if (file_exists($imagen)) {

if (!$tam = getimagesize($imagen)) return false ; //Devuelve una array con varios datos

if ($tam[2]!=2) return false; // no es jpg

if (!$img_origen = imagecreatefromjpeg($imagen)) return false;

//$x=imagesx($img_origen);
//$y=imagesy($img_origen);

$x=$tam[0];
$y=$tam[1];
if ($SelectSide){
if ($x>$y)
{ $nova_largura = $max_pixels; $nova_altura = $max_pixels * $y / $x;}
else
{ $nova_altura = $max_pixels; $nova_largura = $max_pixels * $x / $y;}
} else {
$nova_largura = $max_pixels; $nova_altura = $max_pixels * $y / $x;
}
$img_destino = imagecreatetruecolor($nova_largura,$nova_altura);
imagecopyresampled($img_destino,$img_origen,0,0,0,0,$nova_largura,$nova_altura, $x, $y);
imagejpeg($img_destino,$destino);
return TRUE;
} else return FALSE;
}
/**
* Cambia el tamany de una imatge
**/
function save_imagen($imagen_old, $imagen, $origen, $destino, $max_pixels){

if ($imagen && !ereg("[^A-Za-z0-9._]", $imagen)) {
if (!$this->img_resize($origen.$imagen, $destino.$imagen, $max_pixels, false))
{unlink($origen.$imagen);return false;} else unlink($origen.$imagen); // borro el fichero de temporal
if (isset($imagen_old)
&& $imagen_old!=""
&& file_exists($destino.$imagen_old))
unlink($destino.$imagen_old);
return true; // borro el fichero de anterior
} else return false;
}
/**
* Cambia el formato de la fecha para que se pueda introducir en una base de datos SQL
* El formato SQL es YYYYMMDD
**/
function date_sql_format($date,$current_format){

if (!isset($date) || $date=="") return false;

if (strchr($date,"-")) $date=ereg_replace("-","/",$date);

if (strchr($date,".")) $date=ereg_replace("\.","/",$date);

if ($current_format=="d/m/Y" || $current_format=="d/m/y")
list($day,$month,$year) = explode("/",$date);
else list($month, $day, $year) = explode("/",$date);

if (strlen($year)!=4) return false;
//if ($year<=99)
//if ($year<65) $year="20$year"; else $year="19$year";

//echo $day.$month.$year;
if (!checkdate($month,$day,$year)) return false;

return sprintf ("%4s%02s%02s", $year, $month, $day);
}
/**
* Borrar un directorio este lleno o no
**/
function deldir($dir){

if (!$current_dir = opendir($dir)) return false;

while($entryname = readdir($current_dir)){
if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){
$this->deldir("$dir/$entryname");
}elseif($entryname != "." and $entryname!=".."){
unlink("$dir/$entryname");
}
}
closedir($current_dir);
rmdir($dir);
return true;
}
/**
* Devuelve una lista de valores de un array separados por coma
**/
function array2list($array_values,$separator){
reset($array_values);
$result="";
foreach($array_values as $value)
if (is_array($value)){
$result2="";
foreach($value as $value2 )
if ($result2=="") $result2=$value2;else $result2=$result2.";".$value2;
if ($result=="") $result=$result2;else $result=$result."$separator".$result2;
} else
{ if ($result=="") $result=$value;else $result=$result."$separator".$value;}
return $result;
}
/**
* Reverse of parse_str(). Converts array into
* string with query format
**/
function rev_parse_str ($params) {
$str = '';
foreach ($params as $key => $value) {
$str .= (strlen($str) < 1) ? '' : '&';
$str .= $key . '=' . rawurlencode($value);
}
return ($str);
}
/**
* Encripta un texto.
*@param string texto a encryptar.
**/
function ecrypt($text) {
$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
$iv=base64_decode($this->iv64);
mcrypt_generic_init($td, $this->ekey, $iv);
$encrypted = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return urlencode($encrypted); //Poner si hay problemas con el servidor http
//return $encrypted;
}
/**
* Decripta un texto.
*@param string texto a desencryptar
**/
function dcrypt($encrypted){
$encrypted=urldecode($encrypted); //poner si hay problemas con el servidor http
$td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
$iv=base64_decode($this->iv64);
mcrypt_generic_init($td, $this->ekey, $iv);
$decrypted = mdecrypt_generic($td, $encrypted);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
//echo trim($decrypted)."<br/>";
return trim($decrypted);
}

//************************************FIN CLASSE
}
?>

1 réponse

le_fermier Messages postés 63 Date d'inscription mardi 1 avril 2008 Statut Membre Dernière intervention 9 février 2011 5
31 mai 2009 à 00:30
résolu
2