系统聊天错误php 5.4

时间:2014-08-05 19:17:46

标签: php ajax html5

我的聊天系统出现问题 请帮助

错误

  

在此处输入预先格式化的文本[配置错误:配置文件不是   发现!]退出... [nodelete_chat.php] [none_provided-1407265447]

nodelete_chat.php .///

    if ( isset( $_SESSION['session_chat'][$sid]['asp_login'] ) )
        $l = $_SESSION['session_chat'][$sid]['asp_login'] ;
    else if ( isset( $_SESSION['session_admin'][$sid]['asp_login'] ) )
        $l = $_SESSION['session_admin'][$sid]['asp_login'] ;
    else if ( isset(  $_SESSION['session_setup']['login'] ) )
        $l =  $_SESSION['session_setup']['login'] ;
    else 
        $l = "none_provided" ;
    if ( !Util_DIR_CheckDir( "..", $l ) )
    {
        print "<font color=\"#FF0000\">[Configuration Error: config file not found!] Exiting... [nodelete_chat.php] [$l-$sid]</font>" ;
        exit ;
    }
    include_once("$DOCUMENT_ROOT/web/$l/$l-conf-init.php") ;

    if ( !$text && isset( $_SESSION['session_chat'][$sid]['chatfile_transcript'] ) && file_exists( "$DOCUMENT_ROOT/web/chatsessions/".$_SESSION['session_chat'][$sid]['chatfile_transcript'] ) && !isset( $transcript_output ) )
    {
        $transcript = join( "", file( "$DOCUMENT_ROOT/web/chatsessions/".$_SESSION['session_chat'][$sid]['chatfile_transcript'] ) ) ;
        if ( $_SESSION['session_chat'][$sid]['isadmin'] )
            $transcript = preg_replace( "/<admin_strip>(.*?)<\/admin_strip>/", "", $transcript ) ;
    }

    // if admin_id is passed, then we need to update the session
    if ( $admin_id )
        $_SESSION['session_chat'][$sid]['admin_id'] = $admin_id ;

    if ( isset( $_SESSION['session_chat'][$sid]['isadmin'] ) && $_SESSION['session_chat'][$sid]['isadmin'] && $_SESSION['session_chat'][$sid]['theme'] )
        $THEME = $_SESSION['session_chat'][$sid]['theme'] ;
    else if ( $theme_admin )
        $THEME = $theme_admin ;
?>
<html>
<head>
<title>Chat</title>
<script type="text/javascript" language="JavaScript1.2" src="<?php echo $BASE_URL ?>/js/styleswitcher.js"></script>
<style type="text/css">
<!--
@import url(../css/text-small.css);

* { margin: 0; padding: 0; }

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 3px;
}
* html body { width: 93%; } /* IE tweak */

-->
</style>

<link href="<?php echo $BASE_URL ?>/css/text-large.css" rel="alternate stylesheet" type="text/css" title="A++" />
<link href="<?php echo $BASE_URL ?>/css/text-medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
<link href="<?php echo $BASE_URL ?>/css/text-small.css" rel="alternate stylesheet" type="text/css" title="A" />
<link href="<?php echo $BASE_URL ?>/themes/<?php echo $THEME ?>/style.css" rel="stylesheet" type="text/css" />

<script language="JavaScript">
<!--
    if ( <?php echo $respawn ?> )
        window.parent.window.parent.frames['main'].window.respawn = 1 ;
//-->
</script>

</head>
<body class="chatbody">
<div id="conversation">
<?php if ( $text ): ?>
<p class="notice"><?php echo stripslashes( urldecode( $text ) ) ?></p>
<?php elseif ( $transcript ):
    echo stripslashes( urldecode( $transcript ) )  ;
?>
<?php endif ; ?>

Util_dir.php

<?php
    if ( isset( $_OFFICE_UTIL_DIR ) == true )
        return ;

    $_OFFICE_UTIL_DIR = true ;

    function Util_DIR_CheckDir( $path, $l )
    {
        $l = preg_replace( "/[^A-Z0-9a-z_@.\-]/", "", $l ) ;
        $conf_file = realpath( "$path/web/conf-init.php" ) ;
        $conf_file_l = realpath( "$path/web/$l/$l-conf-init.php" ) ;
        if ( is_dir( "$path/web/$l" ) && file_exists( $conf_file_l ) && file_exists( $conf_file ) )
            return true ;
        else
            return false ;
    }
?>

1 个答案:

答案 0 :(得分:0)

您的配置文件似乎不存在于您作为参数传递的目录中。

您应该使用简单的echo检查这些路径的功能值,如下面的代码所示:

   function Util_DIR_CheckDir( $path, $l )
    {
        $l = preg_replace( "/[^A-Z0-9a-z_@.\-]/", "", $l ) ;
        $conf_file = realpath( "$path/web/conf-init.php" ) ;
        $conf_file_l = realpath( "$path/web/$l/$l-conf-init.php" ) ;

        echo $conf_file."<br />";
        echo $conf_file_l."<br />";
        echo "$path/web/$l"."<br />";

        if ( is_dir( "$path/web/$l" ) && file_exists( $conf_file_l ) && file_exists( $conf_file ) )
            return true ;
        else
            return false ;
    }

确保这些变量包含您期望的内容