Avatar billede 0ffline Nybegynder
26. september 2002 - 12:20 Der er 10 kommentarer og
1 løsning

Virker stadig ikke med æ, ø og å

Da jeg ikke i mit tidligere spørgsmål fik scriptet til at virke, prøver jeg lige igen da det da for søren må lykkes tilsidst...
Jeg sidder med denne her flash/php gæstebog, hvor diverse indlæg bliver smidt ind i et txt dokument, hvorfra det så igen bliver indlæst i Flash'en.
Dette virker OK, men hvis man bruger bogstaverne 'æ' 'ø' elller 'å' springes disse bare over og indlæses ikke
Gæstebogen er et tilpasset script hentet hos flashkit, og selve PHP'en ser således ud --->
<?

############### Begin GuestBook Script #####################################

##The first 3 lines use a regular expression to match a pattern then replace it with nothing.  The only reason for this is so we only allow necessary characters to be entered into the guestbook. This also takes out slashes which are sometimes added in the post headers to make the string friendly.  You can erase or take these lines out if you want.

    $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
    $Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
    $Comments = ereg_replace("æ", "&aelig;", $Comments);
    $Comments = ereg_replace("ø", "&oslash;", $Comments);
    $Comments = ereg_replace("å", "&aring;", $Comments);
    $Comments = ereg_replace("Æ", "&AElig;", $Comments);
    $Comments = ereg_replace("Ø", "&Oslash;", $Comments);
    $Comments = ereg_replace("Å", "&Aring;", $Comments);

    $Website = eregi_replace("http://", "", $Website);
    $Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

    $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 = "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.

    $Input = "Navn: <b>$Name</b><br>Kommentar: <b>$Comments</b><br><i><font size=\"-1\">Dato: $Today</font><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+");
    fwrite($fp, $New, 80000);
    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, 80000);
    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>Der er ikke flere indlæg</b>";
        exit;
        }
    }
   


####################################################################################
###############  End GuestBook Script
?>

Gæstebogen kan ses her -->
http://www.exciter.dk/feedback.asp
Avatar billede 0ffline Nybegynder
26. september 2002 - 12:23 #1
Det skal lige siges at dette blev tilføjet efter mit sidste spørgsmål -->
  $Comments = ereg_replace("æ", "&aelig;", $Comments);
    $Comments = ereg_replace("ø", "&oslash;", $Comments);
    $Comments = ereg_replace("å", "&aring;", $Comments);
    $Comments = ereg_replace("Æ", "&AElig;", $Comments);
    $Comments = ereg_replace("Ø", "&Oslash;", $Comments);
    $Comments = ereg_replace("Å", "&Aring;", $Comments);
................................................
og er også afprøvet ved at skrive
$Comments = str_replace(".......... istedetfor
Avatar billede bongobride Nybegynder
26. september 2002 - 12:34 #2
hvorfor er det asp? - Skal det ikke være php?
Avatar billede 0ffline Nybegynder
26. september 2002 - 12:36 #3
Alle mine andre sider skal laves i asp, det er kun gæstebogen der bruger php. Men jeg tror ikke at det skulle give noget problem
Avatar billede bongobride Nybegynder
26. september 2002 - 12:37 #4
<?

############### Begin GuestBook Script #####################################

##The first 3 lines use a regular expression to match a pattern then replace it with nothing.  The only reason for this is so we only allow necessary characters to be entered into the guestbook. This also takes out slashes which are sometimes added in the post headers to make the string friendly.  You can erase or take these lines out if you want.

    $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);

    $Website = eregi_replace("http://", "", $Website);
    $Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

    $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.
    $Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
    $Comments = ereg_replace("æ", "&aelig;", $Comments);
    $Comments = ereg_replace("ø", "&oslash;", $Comments);
    $Comments = ereg_replace("å", "&aring;", $Comments);
    $Comments = ereg_replace("Æ", "&AElig;", $Comments);
    $Comments = ereg_replace("Ø", "&Oslash;", $Comments);
    $Comments = ereg_replace("Å", "&Aring;", $Comments);
    $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.

    $Input = "Navn: <b>$Name</b><br>Kommentar: <b>$Comments</b><br><i><font size=\"-1\">Dato: $Today</font><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+");
    fwrite($fp, $New, 80000);
    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, 80000);
    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>Der er ikke flere indlæg</b>";
        exit;
        }
    }
   


####################################################################################
###############  End GuestBook Script
?>
Avatar billede bongobride Nybegynder
26. september 2002 - 12:40 #5
hmmmm....
Er det ikke fordi det er i flash den henter det?
Avatar billede 0ffline Nybegynder
26. september 2002 - 12:48 #6
Jeg er ikke helt klar over om der skulle ligge en begrænsning der.
Virker dog ikke særlig sandsynligt syntes jeg.
Den eneste action der ligger der med hensyn til indlæsning ser således ud -->

NumLow = 0;
NumHigh = 10;
loadVariablesNum ("RisRos.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
stop();
Avatar billede 0ffline Nybegynder
26. september 2002 - 12:50 #7
Samt textfelter er sat som dynamisk, og html
Avatar billede 0ffline Nybegynder
26. september 2002 - 13:00 #8
Det er heller ikke under indlæsningen tilbage til Flash det går galt, da æ ø å ikke engang vises i selve txtfilen.
Avatar billede 0ffline Nybegynder
26. september 2002 - 13:24 #9
YES...
Nu virker det dælme
Avatar billede 00player Nybegynder
25. april 2003 - 10:01 #10
Hvordan fik du den til at virke så? Jeg har også forsøgt med alt muligt.
Avatar billede breon Nybegynder
27. september 2003 - 12:34 #11
Jeg sidder lige nu, med præcis det samme problem. Jeg har også en gæstebog, hvor teksten bliver gemt i txt fil og hentet ind i Flash, men æøå bliver ikke gemt i tekstfilen. Så hvis du kan fortælle hvordan du fik det til at virke, ville det være en stor hjælp for mange.
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
Vi tilbyder markedets bedste kurser inden for webudvikling

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