Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Problema con fwrite e array

    Ciao a tutti,
    Ho un problema con la funzione fwrite, passandogli un array da scrivere.

    Mi spiego, ho questo codice:
    Codice PHP:
    <?
    include("config.inc.php");    
    $Apri=fopen('config.inc.php''w');
    $Scrivi=fwrite($Apri'<?
    define("upload_directory", "' 
    upload_directory '");
    define("full_path", "' 
    full_path '");
    $max_bytes=' 
    $max_bytes ';
    $max_files=' 
    $max_files ';
    $allowed_ext=' 
    $allowed_ext ';
    $allowed_ext_documents=' 
    $allowed_ext_documents ';
    $allowed_ext_markup=' 
    $allowed_ext_markup ';
    $allowed_ext_script=' 
    $allowed_ext_script ';
    $allowed_ext_sources=' 
    $allowed_ext_sources ';
    $allowed_ext_archives=' 
    $allowed_ext_archives ';
    $allowed_ext_executables=' 
    $allowed_ext_executables ';
    $allowed_ext_graphics=' 
    $allowed_ext_graphics ';
    $allowed_ext_audio=' 
    $allowed_ext_audio ';
    $allowed_ext_video=' 
    $allowed_ext_video ';
    $allowed_ext_others=' 
    $allowed_ext_others '; 
    $password="' 
    $password '";
    $Log="' 
    $Log '";
    $Log_error="' 
    $Log_error '";
    $Renomination="' 
    $Renomination '";
    $mail="' 
    $mail '";
    $address="' 
    $address '";
    $PasswordAdmin="' 
    $PasswordAdmin '";
    ?>'
    );
    $Chiudi=fclose($Apri);
    Le variabili che aggiungo quando scrivo nel file config.inc.php sono contenute nello stesso file che includo all'inizio della pagina, solo che da un file di partenza del genere:

    Codice PHP:
    <?
    define
    ("upload_directory""./up/");
    define("full_path""http://ste95.no-ip.org/The Uploader/up/");
    $max_bytes=1500*1024*1024;
    $max_files=3;
    $allowed_ext=array("zip""rar""jpg""exe""doc""rtf""htm""html""php""js""vb""pinarolo""zip""rar""exe""com""jpg""png""mp3""wma""avi""vob""ani""sys""txt");
    $allowed_ext_documents=array("doc""rtf""txt");
    $allowed_ext_markup=array("htm""html");
    $allowed_ext_script=array("php""js");
    $allowed_ext_sources=array("vb""pinarolo");
    $allowed_ext_archives=array("zip""rar");
    $allowed_ext_executables=array("exe""com");
    $allowed_ext_graphics=array("jpg""png");
    $allowed_ext_audio=array("mp3""wma");
    $allowed_ext_video=array("avi""vob");
    $allowed_ext_others=array("ani""sys");
    $password="301826e732d77bd72946e1443f2808ce";
    $Log="true";
    $Log_error="true";
    $Renomination="false";
    $mail="false";
    $address="barone.dan@tiscali.it";
    $PasswordAdmin="301826e732d77bd72946e1443f2808ce";
    ?>
    Ottengo questa roba, in cui gli array vanno a farsi benedire:

    Codice PHP:
    <?
    define
    ("upload_directory""./up/");
    define("full_path""http://ste95.no-ip.org/The Uploader/up/");
    $max_bytes=1572864000;
    $max_files=3;
    $allowed_ext=1;
    $allowed_ext_documents=Array;
    $allowed_ext_markup=Array;
    $allowed_ext_script=Array;
    $allowed_ext_sources=Array;
    $allowed_ext_archives=Array;
    $allowed_ext_executables=Array;
    $allowed_ext_graphics=Array;
    $allowed_ext_audio=Array;
    $allowed_ext_video=Array;
    $allowed_ext_others=Array; 
    $password="301826e732d77bd72946e1443f2808ce";
    $Log="true";
    $Log_error="true";
    $Renomination="false";
    $mail="false";
    $address="barone.dan@tiscali.it";
    $PasswordAdmin="301826e732d77bd72946e1443f2808ce";
    ?>

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    Codice PHP:
    $stringa_da_scrivere_nel_file '$allowed_ext_documents=' $allowed_ext_documents ';'
    Così concateni una stringa con un array.. a te serve scrivere l'array

    Prova così

    Codice PHP:
    $stringa_da_scrivere_nel_file '$allowed_ext_documents=' .var_export($allowed_ext_documents) . ';'
    Ciau
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

  3. #3
    In quel modo salva questo:

    $allowed_ext_documents=;

  4. #4
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    Codice PHP:
    $stringa_da_scrivere_nel_file '$allowed_ext_documents='.var_export($allowed_ext_documentstrue) . ';'
    Usiamolo sto manuale
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

  5. #5
    Grazie mille.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.