Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   гостевая...как сменить язык? (http://www.flasher.ru/forum/showthread.php?t=67765)

alexpro 10.08.2005 20:07

гостевая...как сменить язык?
 
Установил гостевую...не знаю, как мне язык сменить.
Текст на кириллице не записывается в файл.
http://newtimegroup.com.ua/chorus/GuestBook.html

вот скрипт из РНР-файла:
<?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"];
$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);


// Remove slashes.
$Name = stripslashes($Name);
$Email = stripslashes($Email);
$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/fl...s/htmltext.htm

$Input = "Name: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></u></b><br>Comments: <b>$Comments</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");
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;
}
}
?>


или мне нужно во Флэше что-то менять?




и еще один вопрос:
самостоятельно на странице гостевая работает, а если я загружаю мувик в swf. , то данные отправляются, но не приходят обратно:
http://newtimegroup.com.ua/chorus/intro.html > ссылка контакт

вот ссылка на fla. :
http://our-friendship.de/g.fla




Спасибо

DOG-Paul 10.08.2005 23:56

Интуиция мне подсказывает, что надо поиграться в этих строчках
$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
$Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
или стереть их к чёртовой матери! :)

iNils 11.08.2005 00:28

У тебя с сайта уходит русский текст в виде: тесС
Попробуй в html прописать вместо <meta http-equiv=Content-Type content="text/html; charset=">
вот это
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">

alexpro 11.08.2005 11:55

Изменил строчки
$Name = ereg_replace("[^А-Яа-яA-Za-z0-9 ]", "", $Name);
$Email = ereg_replace("[^А-Яа-яAA-Za-z0-9 \@\.\-\/\']", "", $Email);
$Comments = ereg_replace("[^А-Яа-яAA-Za-z0-9 \@\.\-\/\']", "", $Comments);

...так же пытался их стереть....результат тот же (((

alexpro 11.08.2005 11:58

<meta http-equiv=Content-Type content="text/html; charset=windows-1251"> не помогло (((

может существуют какие-то специальные тэги для кириллицы в РНР???

Speckle 11.08.2005 13:01

посмотри тут
http://ua2.php.net/manual/en/function.iconv.php
эта функция переводит в нужную кодировку, только надо чтоб стоял модуль iconv у php. Просто все строки, котрорые в кирилице (имя, текс сообщения) переводишь в нужную кодировку, наверное из windows-1251 в utf-8, флеш ведь только utf-8 понимает? как-то так
$Comments = iconv('CP1251', 'UTF-8', $Comments);

iNils 11.08.2005 13:16

во флеше поставь System.useCodepage = true;

но у тех у кого системная страница не киррилическая работать не будет

Speckle 11.08.2005 13:21

Цитата:

Сообщение от iNils
во флеше поставь System.useCodepage = true;

но у тех у кого системная страница не киррилическая работать не будет

так сказал ведь, что в файл не записывается кирилица

iNils 11.08.2005 13:26

Цитата:

Сообщение от Speckle
так сказал ведь, что в файл не записывается кирилица

В какой файл?

Speckle 11.08.2005 13:28

Цитата:

Сообщение от alexpro
Установил гостевую...не знаю, как мне язык сменить.
Текст на кириллице не записывается в файл.
...

я так поняла, что имеется ввиду текстовый файл с данными? надо чтобы он был в юникоде, поэтому и кирилицу нужно переводить в юникод перед записью в файл. Ну и System.useCodepage = true; во флеше тоже конечно должно быть.

alexpro 11.08.2005 13:32

Я вставил, но не знаю, правильно ли разместил код...

<?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"];
$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);
$Name = iconv('CP1251', 'UTF-8', $Name);
$Email = ereg_replace("[^А-Яа-яA-Za-z0-9 \@\.\-\/\']", "", $Email);
$Email = iconv('CP1251', 'UTF-8', $Email);
$Comments = ereg_replace("[^А-Яа-яA-Za-z0-9 \@\.\-\/\']", "", $Comments);
$Comments = iconv('CP1251', 'UTF-8', $Comments);

// Remove slashes.
$Name = stripslashes($Name);
$Email = stripslashes($Email);
$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/fl...s/htmltext.htm

$Input = "Name: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></u></b><br>Comments: <b>$Comments</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");
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;
}
}
?>

Speckle 11.08.2005 13:42

$Email = iconv('CP1251', 'UTF-8', $Email);
это точно лишнее, мыло ведь в кирилице не может быть.
ну ты проверял, что получается?

alexpro 11.08.2005 13:52

...ну теперь хоть текст появился, только почему-то вместо всех букв только верхний регистр С и Р ....зайди посмотри
http://newtimegroup.com.ua/chorus/GuestBook.html

Speckle 11.08.2005 13:57

Цитата:

Сообщение от alexpro
...ну теперь хоть текст появился, только почему-то вместо всех букв только верхний регистр С и Р ....зайди посмотри
http://newtimegroup.com.ua/chorus/GuestBook.html

это наверняка текст выходит не в windows1251, а в какой-то другой...
попробуй вмсто cp1251 KOI8-R (или ISO-8859-1), когда-то точно угадаем, что правильно :)

iNils 11.08.2005 14:20

Это utf-8

Speckle 11.08.2005 14:24

Цитата:

Сообщение от iNils
Это utf-8

выводиться? ну да, т.к. мы в него переводили, надо выяснить из чего переводить, чтобы правильно отображалось

iNils 11.08.2005 14:27

Цитата:

Сообщение от Speckle
выводиться? ну да, т.к. мы в него переводили, надо выяснить из чего переводить, чтобы правильно отображалось

Флеш отсылал данные в формате utf-8.

Speckle 11.08.2005 14:32

в пхп данные приходят в кирилице, их нужно перевести в утф, пусть alexpro выяснит какая у него кириличная кодировка, т.е. в
$Name = iconv('CP1251', 'UTF-8', $Name);
(исходная кодировка, получаемая кодировка, текст)
вместо CP1251 написать нужную, наверное KOI8-R, ему там виднее

iNils 11.08.2005 14:36

у него уже заработало я смотрю.

Speckle 11.08.2005 14:40

ну и отлично
alexpro, чего там за проблема была?

alexpro 11.08.2005 14:42

Наконец-то получилось!
Спасибо, ребята!
Оказывается дело было в System.useCodepage = true;
Я только что его вставил а в РНР-ке удалил ненужные тэги

Только не понял, в какой скрипт нужно было вставлять, сюда
on (release) {
if (Name eq "") {
_root.Status = "Âàøå èìÿ";
} else if (Email eq "") {
_root.Status = "Âàø e-mail";
} else {
Submit = "Yes";
NumHigh = 10;
NumLow = 0;
_root.GuestBook = "Çàãðóçêà äàííûõ...";
System.useCodepage = true;
loadVariablesNum ("GuestBook.php", 0, "POST");
_root.Status = "Çàãðóçêà äàííûõ çàâåðøåíà";
gotoAndStop (2);
}
}


или сюда?
NumLow = 0;
NumHigh = 10;
loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
System.useCodepage = true;
stop();


я вставил в оба

alexpro 11.08.2005 14:52

Цитата:

Сообщение от Speckle
ну и отлично
alexpro, чего там за проблема была?

Проблема была во Флэше оказывается...
Я протупил...нужно было в начале его исправить. Извините, что отнял время с кодировками :)

Тут другая проблема:
Когда я гостевуху загружаю в мувик, она не работает...
только самостоятельно (((
http://newtimegroup.com.ua/chorus/test-page.html

Speckle 11.08.2005 18:39

если ты имеешь ввиду один мувик в другой, то может быть из-за того, что пути пишуться относительно рута? тогда посмотри this._lockroot = true;


Часовой пояс GMT +4, время: 19:45.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.