Avatar billede madsringblom Nybegynder
24. maj 2004 - 22:39 Der er 1 kommentar og
1 løsning

PHP gæstebog via flash vil ikke loade

jeg har en gæstebog som kører via en php og txt fil

på min submit knap har jeg dette script!
men den kommer aldrig længere end til at skrive "Processing..  Loading New... " i gæstebogstekstruden.


on (release) {
    if (name eq "") {
        _root.Status = "Please enter your name";
    } else if (Email eq "") {
        _root.Status = "Please enter email Address";
    } else {
        submit = "true";
        numHigh = 10;
        numLow = 0;
        _root.guestBook = "Processing..  Loading New... ";
        loadVariablesNum ("guestbook.php", 0, "POST");
        _root.Status = "Your entry has been submitted.  You should see your comments appear immediately";
        gotoAndPlay (19);
    }
}
Avatar billede madsringblom Nybegynder
24. maj 2004 - 22:45 #1
smider lige hele php-scriptet op også så har man "lidt" at kigge på :)

<?php

$Submit     = $_POST["Submit"];
$Name         = $_POST["Name"];
$Email         = $_POST["Email"];
$Comments     = $_POST["Comments"];
$NumLow     = $_REQUEST["NumLow"];
$NumHigh     = $_REQUEST["NumHigh"];


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

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

if ($submit == "true") {
// Next line tells the script which Text file to open.
    $filename     = "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 ( h:i:s A )",time()));

// 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: http://www.macromedia.com/support/flash/ts/documents/htmltext.htm

    $Input = "<b><u>$Name</u></b><br><a href="mailto:$Email">$Email</a><br><br>$Comments<br>$Today<br><br><br>.:::.";

/* 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");
    if(!$fp) die("&guestBook=cannot write $filename ......&");
    fwrite($fp, $New, 800000);
    fclose( $fp );
}

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



// Next line tells the script which Text file to open.
    $filename = "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 "&TotalEntries=$NumEntries&numLow=$numLow&numHigh=$numHigh&guestBook=";
    for ($n = $numLow; $n < $numHigh; $n++) {
    print $DataArray[$n];
        if (!$DataArray[$n]) {
            Print "<br><br><b>No More entries</b>";
        exit;
        }
    }
?>
Avatar billede madsringblom Nybegynder
31. juli 2004 - 17:03 #2
hmm det var der ikke nogen der gad tygge sig igennem jeg lukker spørgsmålet !
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester