Visualizzazione risultati 1 fino 2 di 2

Discussione: Guestbook in Swishmax con script php

  1. #1
    Guest

    Predefinito Guestbook in Swishmax con script php

    Salve a tutti

    sto' cercando di inserire nel mio sito www.anielloscotto.altervista.org un guestbook scritto in swishmax ( come il resto del mio sito ).
    Ne ho fatto l' upload dei file che lo costutuiscono ( guestbook.txt,guestbook.html,guestbook.swf e guestbook.php) nella root principale del sito e inoltre come richiesto nelle istruzioni di installazione di questo programma ho assegnato ai 2 file : guestbook.php e guestbook.txt un CHMOD pari a 777.

    Potete vedere su www.anielloscotto.altervista.org/guestbook.html che l' applicazione parte e che e' possibile inserire dei dati e farne il submit per aggiornare il file .txt che dovrebbe contenerli tutti .

    Quest' ultimo step pero' non avviene , per cui non si aggiorna il numero totale dei messaggi inseriti perche' niente e' caricato nel file guestbook.txt.

    Sono diversi giorni che cerco di capire la causa di questo problema ma non avendo un file di log in cui controllare cosa accade lato server quando clicco il pulsante submit ..mi riesce molto difficile risolvere il tutto ( data anche la mia poca conoscenza del PHP ).

    Qui di seguito riporto il contenuto dello script .php responsabile dell' aggiornamento del file .txt credo che in esso ci sia qualcosa di non corretto anche se io non ho alterato in alcun modo i file dell' applicativo stesso

    Codice PHP:
    <?php
    ##### Original PHP Script by Jeffrey Hill of [url]http://www.Flash-DB.com[/url]
    ##### Modifications by [url]www.Swish-Tutorials.com[/url] (to work with sprites in SWiSH)
    ##### Contact : Brian Ayers at [email]admin@swish-tutorials.com[/email]
    // If you are using an old version of php, remove the next set of lines.
    // or use $HTTP_POST_VARS["..."] instead.
    $Submit = $_POST["Submit"];
    $Name = $_POST["Name"];
    $Email = $_POST["Email"];
    $Website = $_POST["Website"];
    $Comments = $_POST["Comments"];
    $NumLow = $_REQUEST["NumLow"];
    $NumHigh = $_REQUEST["NumHigh"];

    // Replace special characters - you can remove the next 5 lines if wanted.
    $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Comments = ereg_replace("[^A-Za-z0-9 \@\.\/\']", "", $Comments);
    $Website = eregi_replace("http://", "", $Website);
    $Website = ereg_replace("[^A-Za-z0-9 \@\.\/\'\~\:]", "", $Website);

    // Remove slashes.
    $Name = stripslashes($Name);
    $Email = stripslashes($Email);
    $Website = stripslashes($Website);
    $Comments = stripslashes($Comments);

    // ###################################################################################
    // ########## Reading and Writing the new data to the GuestBook Database #############

    if ($Submit == "Yes") {
    // Next line tells the script which Text file to open.
    $filename = "www.anielloscotto.it/guestwook/GuestBook.txt";

    // Opens up the file declared above for reading

    $fp = fopen( $filename,"r");
    $OldData = fread($fp, 80000);
    fclose( $fp );

    // Gets the current Date of when the entry was submitted
    $Today = (date ("l dS of F Y"));

    // Puts the recently added data into html format that can be read into the Flash Movie.
    // You can change this up and add additional html formating to this area. For a complete listing of all html tags
    // you can use in flash - visit: [url]www.macromedia.com/support/flash/ts/documents/htmltext.htm[/url]

    $Input = "Name: <b>$Name</b>
    Email: <b><u><a href=\"mailto:
    $Email\">$Email</a></u></b>
    Website: <b><u><a href=\"http://
    $Website\" target=\"_blank\">$Website</a></u></b>
    Comments: <b>
    $Comments</b><br>
    <i><font size=\"-1\">Date:
    $Today</font>

    .:::."
    ;

    /* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file. This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file */

    $New = "$Input$OldData";

    // Opens and writes the file.

    $fp = fopen( $filename,"w");
    fwrite($fp, $New, 800000);
    fclose( $fp );
    echo
    '&load=loaded&';
    }

    // ###################################################################################
    // ######### Formatting and Printing the Data from the Guestbook to the Flash Movie ##



    // Next line tells the script which Text file to open.
    $filename = "www.anielloscotto.it/guestwook/GuestBook.txt";

    // Opens up the file declared above for reading

    $fp = fopen( $filename,"r");
    $Data = fread($fp, 800000);
    fclose( $fp );

    // Splits the Old data into an array anytime it finds the pattern .:::.
    $DataArray = split (".:::.", $Data);

    // Counts the Number of entries in the GuestBook
    $NumEntries = count($DataArray) - 1;

    print
    "&load=loaded&&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
    for (
    $n = $NumLow; $n < $NumHigh; $n++) {
    print
    $DataArray[$n];
    if (!
    $DataArray[$n]) {
    Print
    "<br><br><br><b>No More entries</b>";

    exit;
    }
    }
    ##### Original PHP Script by Jeffrey Hill of [url]http://www.Flash-DB.com[/url]
    ##### Modifications by [url]www.Swish-Tutorials.com[/url] (to work with sprites in SWiSH)
    ##### Contact : Brian Ayers at [email]admin@swish-tutorials.com[/email]
    ?>
    Per cortesia qualcuno piu' navigato di me in php puo' dare un' occhiata a questo script e vedere se vi sono degli errori macroscopici.

    Grazie in anticipo per l' aiuto.

    FRapuano
    Ultima modifica di debug : 31-05-2006 alle ore 15.24.34

  2. #2
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Ho provato adesso a scrivere un messaggio sul tuo guestbook e lo ha memorizzato.
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •