2017-01-25 10 views
1

こんにちは私は、ヘッダーとフッターを表示する単純なindex.phpスクリプトを作成しましたが、解決できないコードでエラーを取得し続けます。 ここに私のコードです。require(MYSQL);エラーが発生しました

<?php 
require('./includes/config.inc.php'); 
require(MYSQL); 
include('./includes/header.html'); 
?><h1> 
    Welcome 
</h1> 
<?php /* PAGE CONTENT ENDS HERE! */ 
include('./includes/footer.html'); 
?> 
:これはindex.phpのある

<?php 
if (!defined('LIVE')) DEFINE('LIVE', false); 
DEFINE('CONTACT_EMAIL', '[email protected]'); 
define ('BASE_URI', 'C:\xampp\htdocs\ecommerce\.'); 
define ('BASE_URL', 'localhost/ecommerce/html/index.php'); 
define ('MYSQL', BASE_URI . 'mysql.inc.php'); 
session_start(); 
function my_error_handler($e_number, $e_message, $e_file, $e_line,  $e_vars) { 
    $message = "An error occurred in script '$e_file' on line $e_line:\n$e_message\n"; 
    $message .= "<pre>" .print_r(debug_backtrace(), 1) . "</pre>\n"; 
    if (!LIVE) { 
     echo '<div class="alert alert-danger">' . nl2br($message) . '</div>'; 
    } else { 
     error_log ($message, 1, CONTACT_EMAIL, 'From:[email protected]'); 
     if ($e_number != E_NOTICE) { 
      echo '<div class="alert alert-danger">A system error occurred. We apologize for the inconvenience.</div>'; 
     } 
    } 
    return true; 
} 
function redirect_invalid_user($check = 'user_id', $destination = 'index.php', $protocol = 'http://') { 
    // Check for the session item: 
    if (!isset($_SESSION[$check])) { 
     $url = $protocol . BASE_URL . $destination; // Define the URL. 
     header("Location: $url"); 
     exit(); // Quit the script. 
    } 
} ?> 

:これはconfig.inc.phpファイルである

<?php 
DEFINE ('DB_USER', 'root'); 
DEFINE ('DB_PASSWORD', ''); 
DEFINE ('DB_HOST', 'localhost'); 
DEFINE ('DB_NAME', 'ecommerce1'); 
$dbc =mysqli_connect (DB_HOST,DB_USER,DB_PASSWORD,DB_NAME); 
mysqli_set_charset($dbc, 'utf8'); 
function escape_data ($data, $dbc){ 
    if(get_magic_quotes_gpc()) $data =stripslashes($data); 
    return mysqli_real_escape_string($dbc, trim ($data)); 
}?> 

このファイルはmysql.inc.phpと呼ばれています

This is the error i get Here is my project hierarchy

+0

その偽者の許可は何ですか? –

+0

@MiteshPant私はそれを全ての特権に設定しました – Abdallah

+0

PHP 5.4で "Magic quotes"が削除され、 'get_magic_quotes_gpc()'の呼び出しはおそらく大きな間違いです。データベースを操作するときに 'stripslashes'、*特に*を使用しないでください。同様に、その面倒な 'escape_data'関数を取り除き、[パラメータ化されたクエリ](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php)と[' bind_param'](http: /php.net/manual/en/mysqli-stmt.bind-param.php)を使用してユーザーデータをクエリに追加します。 – tadman

答えて

0

mysql.inc.phpの前にあなたのパスに余分なドットがあるように見えます.BASE_URIの末尾にあるドットを削除してみてください

+0

'define( 'BASE_URI'、 'C​​:\ xampp \ htdocs \ ecommerce \'); ' –

+0

私はエラーを解決できました。 'BASE_URI'、 'C​​:\ xampp \ htdocs \ ecommerce \\');私がスラッシュを1つ使用すると、それは役に立たない – Abdallah

関連する問題