dsklzerpx64815631
2012-10-07 09:38
采纳率: 100%
浏览 18
已采纳

致命错误:调用database.php中的未定义函数[关闭]

UPDATE Suddenly - without changing anything - it works again ON SOME PAGES, on others it doesn't even show the result of my function function_exists('decod'), any ideas why?

I get this error:

Fatal error: Call to undefined function decod() in database.php on line 10

It worked fine before, here's database.php:

//Decode base64
function decod($string){ 
  $string = base64_decode($string); 
  return ($string); 
} 

//Data double-coded with base64, just to prevent people reading
$host = "localhost";
$user = decod(DOUBLE_ENCRYPTED_USERNAME);
$pass = decod(DOUBLE_ENCRYPTED_PASSWORD);
$db = decod(DOUBLE_ENCRYPTED_DATABASE);

//Connect or print error
$con = mysql_connect($host, decod($user), decod($pass));
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}
//Select database
mysql_select_db(decod($db), $con);

图片转代码服务由CSDN问答提供 功能建议

UPDATE突然 - 没有改变任何东西 - 它在某些页面上再次起作用,在其他页面上它甚至不起作用 显示我的函数function_exists('decod')的结果,任何想法为什么?

我收到此错误:

致命错误:在第10行的database.php中调用未定义的函数decod()

以前工作正常,这里是 database.php:

  //解码base64 
函数解码($ string){
 $ string = base64_decode($ string);  
 return($ string);  
} 
 
 //用base64双重编码的数据,只是为了防止人们阅读
 $ host =“localhost”; 
 $ user = decod(DOUBLE_ENCRYPTED_USERNAME); 
 $ pass = decod(DOUBLE_ENCRYPTED_PASSWORD);  
 $ db = decod(DOUBLE_ENCRYPTED_DATABASE); 
 
 //连接或打印错误
 $ con = mysql_connect($ host,decod($ user),decod($ pass)); 
if(!$ con)  
 {
 die('无法连接:'。mysql_error()); 
} 
 //选择database 
mysql_select_db(decod($ db),$ con); 
   
 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongqianzhan8325 2012-10-07 13:08
    已采纳

    Human error - turns out my website was pointing at the wrong database.php

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongnunai3125 2012-10-07 09:41

    Well, the interpreter cannot find your function decod(). Whatever it does and whereever it is located, it must be included somewhere in your code.

    评论
    解决 无用
    打赏 举报
  • doucou19961205 2012-10-07 09:43

    you can check if the function is defined in your current file or not using

     function_exists ( string $function_name )
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题