Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:48
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Recent Tutorial Support
| |-+  Flash GuestBook Support (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis)
| | |-+  The PHP solution for the problem of "יאח" ( french people ) - utf8_decode
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: The PHP solution for the problem of "יאח" ( french people ) - utf8_decode  (Read 959 times)
dav
Server what's that
*
Posts: 3



View Profile Email
« on: 08/24/05, 08:51 »

<?
############### .::Comments are indicated by the # symbol - you can erase all of these if needed.
############### .::Author: Jeffrey F. Hill
############### .::Website: www.Flash-dB.com
############### .::If you have any questions either post them in the Flashkit Scripting & Backend Message board - or visit Flash-db.com and email me.

############### 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.
   $Comments2=utf8_decode($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 = "Nom: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></b></u><br>Website: <b><u><a href=\"http://$Website\" target=\"_blank\">$Website</a></b></u><br>Commentaire: <b>$Comments2</b><br><i><font size=\"-1\">Date: $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 utf8_encode($DataArray[$n]);
      if (!$DataArray[$n]) {
      Print "<br><br><b>Fin des commentaires</b>";
      exit;
      }
   }
   


####################################################################################
###############  End GuestBook Script
?>
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything