Ima txt file koji se zove ShoutBox.txt i u sebi sadrži samo title= .
Možete li mi molim Vas napisati neki kod da php skripta upiše u *.txt file poruku koja sadrži varijable dobivene iz flasha. Ovakav bi trebao biti format poruke:
<b>$ime</b><br><b>$poruka</b>
Molim vas pomozite...
Ali PhP mora ispunjavati ovaj uvjet, da se svaki put kada se php upiše novu poruku, da je upiše ispred title=. evo primjera: kako bi trebalo biti:
title=<b>Marko</b><br><b>hihi</b><br><b>mirko</b><br><b>haha</b>
E sada imam ja jedan php kod, ali on upiuje svaku poruku ispred title= pa flash nemože iscitati novu poruku.
<?php
// 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);
$Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
$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 = "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 = "Ime<b>$Name</b>= <b>$Name</b><br>Link<b>$Name</b>= <b><u><a href=\"$Website\" target=\"_blank\">$Website</a></u></b>";
/* 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 ("Title=", $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>Nema vishe nichega</b>";
exit
}
}
?>
E to je PhP kod koji ja imam. On kada upiše poruku tekst će izgledati ovako:
<b>Marko</b><br><b>hihi</b>title=<b>mirko</b><br><b>haha</b>
A meni treba ovako izgledati kada se upiše nova vijest:
title=<b>Marko</b><br><b>hihi</b><br><b>mirko</b><br><b>haha</b>
Ako je ovo nemoguće može li se uraditi nešto ovako da poruka bude ovakvog tipa:
title= <b>$ime</b><br><b>$poruka</b>, ali da se svaki put prije nego php upiše novu poruku, php izbriše title= koji već postoji u tekstu.
Aje nadam se da ste me shvatili.
Evo sada skraćeno možete li napraviti nekakvu php skriptu da upisuje poruku (tipa <b>$ime</b><br><b>$poruka</b> ) u txt file koji već sadrži title=, ito tako da se svaka poruka nađe iza title= pa da to izgleda ovako title=<b>Marko</b><br><b>hihi</b><br><b>mirko</b><br><b>haha</b>, ili da napravite da poruka izgleda ovako " title= <b>$ime</b><br><b>$poruka</b> ", ali da se title= koji već postoji u tekstu izbriše prije upisivanja nove poruke u *.txt