سؤال

خلفية صغيرة:

لدي موقع كنيستنا على خطة استضافة ويندوز جودادي المشتركة.بينما أنا أكره ويندوز وسوف نقل الموقع إلى خادم لينكس على أساس ، وهذا ليس حسابي استضافة ، لذلك لا أستطيع أن أفعل ذلك.أحاول حاليا تنفيذ واجهة المستخدم الرسومية لتحميل الخطب على الموقع.أنا أعرف كيفية القيام بذلك على خادم لينكس ، لذلك اعتقدت أن رمز ويندوز تكون مماثلة.المكان الوحيد الذي أنا تتعثر هو مسار التحميل.المسار المطلق على خادم جودادي لدينا هو

D:\Hosting\5402716\html\WFBC\wacofamily.com\sermons\2014\

ومع ذلك ، فإن الخط المائل العكسي يهرب من الأحرف الخاصة ، لذلك اعتقدت أنني بحاجة إلى اثنين.

D:\\Hosting\\5402716\\html\\WFBC\\wacofamily.com\\sermons\\2014\\

المشكلة:

ثم اختبرت التحميل ، لكنني تلقيت هذا الخطأ:

تم استلام الرسالة التالية على مستوى النظام:أذونات أو خطأ ذي صلة نقل الملف إلى د: الاستضافة ، 02716 إتش تي إم دبليو إف بي سي ، <url> 4 دبليو إف بي سي ، 20130106 صباحا ، إم بي 3

يبدو أن فب هو القضاء على جميع مائل باستثناء \54 و \201.وفقا ل هذا الموقع, ، \54 عبارة عن فاصلة و \201 غير مستخدم (أو فارغ).هذا ما يفسر سبب حصولي على الفاصلة واختفاء 201 في 2014.لكنه لا يفسر لماذا لا تصبح الخط المائل العكسي المزدوج مجرد خط مائل عكسي واحد.هنا هو البرنامج النصي فب الذي من المفترض أن تحميل الصورة:

<?php
    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    require_once 'authorize.php';
    if(!(strtolower($this_user_type) == 'admin') && !(strtolower($this_user_type) == 'administrator') && !(strtolower($this_user_type) == 'elder')) {
        header('Location: /login.php?message=You%20do%20not%20have%20permission%20to%20view%20this%20page.%20%20You%20are%20a(n)%20'.$this_user_type.'.');
        exit;
    }
    ini_set('upload_max_filesize', '20971520');
    ini_set('post_max_size', '20971520');
    ini_set('memory_limit', '20971520');
    ini_set('max_input_time', 360);
    ini_set('max_execution_time', 360);
    require_once 'appConfig.php';
    require_once 'databaseConnection.php';
    $php_errors = array(1 => 'Maximum file size in php.ini exceeded', 2 => 'Maximum file size in HTML form exceeded', 3 => 'Only part of the file was uploaded', 4 => 'No file was selected to upload.');
    $article_id = htmlentities(trim($_REQUEST['sermon_id']));
    $date = htmlentities(trim($_REQUEST['date']));
    $pastor = htmlentities(trim($_REQUEST['pastor']));
    $title = htmlentities(trim($_REQUEST['title']));
    $passage = htmlentities(trim($_REQUEST['passage']));
    $folder_name = date('Y', strtotime($date));
    if (!is_dir('../../sermons/'.$folder_name."/")) {
        mkdir('../../sermons/'.$folder_name, 0777) or handle_error("the server couldn't upload the image you selected.", 'could not create directory');
    }
    $upload_dir = HOST_WWW_ROOT.'sermons\\'.$folder_name.'\\';
    $image_fieldname = "sermon_mp3";
    ($_FILES[$image_fieldname]['error'] == 0) or handle_error("the server couldn't upload the image you selected.", $php_errors[$_FILES[$image_fieldname]['error']]);
    @is_uploaded_file($_FILES[$image_fieldname]['tmp_name']) or handle_error("you were trying to do something naughty. Shame on you!", "Uploaded request: file named '{$_FILES[$image_fieldname]['tmp_name']}'");
    $upload_filename = $upload_dir.$_FILES[$image_fieldname]['name'];
    @move_uploaded_file($_FILES[$image_fieldname]['tmp_name'], $upload_filename) or handle_error("we had a problem saving your image to its permanent location.", "permissions or related error moving file to {$upload_filename}");
    if ($article_id) {
        $stmt = $mysqli->prepare("UPDATE `wfbcsermons`.`sermons` SET `date`=?, `pastor`=?, `sermon`=?, `book`=?, `chapter`=?, `end_chapter`=?, `start_verse`=?, `end_verse`=?, `path`=? WHERE `id`=?;") or handle_error("There was a problem updating the database.", "prepare failed :".htmlspecialchars($mysqli->error));
        $stmt->bind_param('sssssssssi', $sermon_date, $sermon_pastor, $sermon_title, $book, $chapter, $end_chapter, $start_verse, $end_verse, $sermon_path, $id) or handle_error("There was a problem updating the database.", "bind_param failed :".htmlspecialchars($stmt->error));
        $sermon_date = $date;
        $sermon_pastor = $pastor;
        $sermon_title = $title;
        $passage_pieces = explode(" ", $passage);
        $book = $passage_pieces[0];
        $number_pieces = explode("-", $passage_pieces[1]);
        $start_pieces = explode(":", $number_pieces[0]);
        $chapter = $start_pieces[0];
        $start_verse = $start_pieces[1];
        $end_pieces = explode(":", $number_pieces[1]);
        $end_chapter = $start_pieces[0];
        $end_verse = $start_pieces[1];
        $sermon_path = 'http://www.wacofamily.com/sermons/'.$folder_name.'/'.$_FILES[$image_fieldname]['name'];
        $id = $sermon_id;
        $stmt->execute() or handle_error("There was a problem updating the database.", "execute failed :".htmlspecialchars($stmt->error));
    }
    else {
        $stmt = $mysqli->prepare("INSERT INTO `wfbcsermons`.`sermons` (`date`, `pastor`, `sermon`, `book`, `chapter`, `end_chapter`, `start_verse`, `end_verse`, `path`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);") or handle_error("There was a problem updating the database.", "prepare failed :".htmlspecialchars($mysqli->error));
        $stmt->bind_param('sssssssssi', $sermon_date, $sermon_pastor, $sermon_title, $book, $chapter, $end_chapter, $start_verse, $end_verse, $sermon_path) or handle_error("There was a problem updating the database.", "bind_param failed :".htmlspecialchars($stmt->error));
        $sermon_date = $date;
        $sermon_pastor = $pastor;
        $sermon_title = $title;
        $passage_pieces = explode(" ", $passage);
        $book = $passage_pieces[0];
        $number_pieces = explode("-", $passage_pieces[1]);
        $start_pieces = explode(":", $number_pieces[0]);
        $chapter = $start_pieces[0];
        $start_verse = $start_pieces[1];
        $end_pieces = explode(":", $number_pieces[1]);
        $end_chapter = $start_pieces[0];
        $end_verse = $start_pieces[1];
        $sermon_path = 'http://www.wacofamily.com/sermons/'.$folder_name.'/'.$_FILES[$image_fieldname]['name'];
        $stmt->execute() or handle_error("There was a problem updating the database.", "execute failed :".htmlspecialchars($stmt->error));
    }
    $stmt->close();
    $mysqli->close();
    header("Location: ../../admin.php");
    exit();
?>

هنا هو التطبيق.بي إتش بي الذي يحدد المضيف:

<?php
    define("DEBUG_MODE", true);
    define("SITE_ROOT", "http://www.wacofamily.com/");
    define("DATABASE_HOST", "wfbcsermons.db.5402716.hostedresource.com");
    define("DATABASE_USERNAME", "**********");
    define("DATABASE_PASSWORD", "**********");
    define("DATABASE_NAME", "wfbcsermons");
    define("HOST_WWW_ROOT", "D:\\Hosting\\5402716\\html\\WFBC\\wacofamily.com\\");
    function js_redirect($url, $seconds=0) {  
        echo "<script language=\"JavaScript\">\n";  
        echo "<!-- hide from old browser\n\n";       
        echo "function redirect() {\n";  
        echo "window.location = \"" . $url . "\";\n";  
        echo "}\n\n";  
        echo "timer = setTimeout('redirect()', '" . ($seconds*1000) . "');\n\n";  
        echo "-->\n";  
        echo "</script>\n";  
        return true;  
    }  
    function handle_error($user_error_message, $system_error_message) {
        js_redirect('http://www.wacofamily.com/error.php?error_message='.$user_error_message.'&system_error_message='.$system_error_message, 0);
        exit();
    }
    function debug_print($message) {
        if (DEBUG_MODE) {
            echo $message;
        }
    }
?>

ما حاولت:

لقد جربت السلاسل التالية:

أربع خطوط مائلة للخلف (كما هو الحال في التعبير العادي):

define("HOST_WWW_ROOT", "D:\\\\Hosting\\\\5402716\\\\html\\\\WFBC\\\\wacofamily.com\\\\");

مائل واحد داخل علامات الاقتباس المفردة:

define("HOST_WWW_ROOT", 'D:\Hosting\5402716\html\WFBC\wacofamily.com\\');

باستخدام &#92;, ، وهو رمز حرف هتمل لشرطة مائلة للخلف:

define("HOST_WWW_ROOT", "D:&#92;Hosting&#92;5402716&#92;html&#92;WFBC&#92;wacofamily.com&#92;");

باستخدام \134 الذي يجب أن يكون التسلسل الثماني لشرطة مائلة للخلف

define("HOST_WWW_ROOT", "D:\134Hosting\1345402716\134html\134WFBC\134wacofamily.com\134");

باستخدام مائلة إلى الأمام كما هذا السؤال قال:

define("HOST_WWW_ROOT", "D:/Hosting/402716/html/WFBC/wacofamily.com/");

استخدام فاصل الدليل كما اقترح ماشافيتي:

define("HOST_WWW_ROOT", "D:".DIRECTORY_SEPARATOR."Hosting".DIRECTORY_SEPARATOR ."402716".DIRECTORY_SEPARATOR ."html".DIRECTORY_SEPARATOR ."WFBC".DIRECTORY_SEPARATOR ."wacofamily.com".DIRECTORY_SEPARATOR );

وبطبيعة الحال ، فإن مائل مزدوج

define("HOST_WWW_ROOT", "D:\\Hosting\\5402716\\html\\WFBC\\wacofamily.com\\");

لقد أجريت هذه التغييرات على جميع السلاسل المتضمنة في إنشاء مسار التحميل.لقد قمت بتضمين تعريف المضيف فقط لتوفير المساحة.

كما ذكرني سيرنارش ، إذا كنت أردد المسار الذي أستخدمه ، فإنه يظهر مع الخطوط المائلة العكسية على ما يرام.ومع ذلك ، فإنه عندما تمرير المسار إلى وظيفة موفيلودواددفيل أن شيئا ما يذهب أحمق.

هل كانت مفيدة؟

المحلول 2

حسنا ، لقد اكتشفت ذلك والآن أشعر بالغباء.انتهى بي الأمر باستخدام مائلة إلى الأمام.السبب في أن هذا لم ينجح في وقت سابق هو أن الأذونات (التي اعتقدت أنني راجعت) لم يتم تعيينها للسماح لي بالكتابة.لذلك ، لأي شخص آخر مع هذه المشكلة:

  1. استخدم الخطوط المائلة للأمام
  2. تحقق من الأذونات الخاصة بك (وتحقق منها مرتين وثلاثية)

نصائح أخرى

يجب عليك استخدام خطوط شريطية () لقراءة البيانات

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top