okay, so i kinda understand how to POST to my php file from a flash-form
but could someone give a quick example of the other way round,
how to set up variables in a php-file and read them from an AS-file
sry, php-noob
thanks /bon
okay, so i kinda understand how to POST to my php file from a flash-form
but could someone give a quick example of the other way round,
how to set up variables in a php-file and read them from an AS-file
sry, php-noob
thanks /bon
send you name and message.
history not forget this, since php file save all to text file.
//start code first frame //guest.fla
var url:String = "http://dnadillo.dn.ua/fla/js-swf-html/guest.php";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.user_name = "";
variables.user_message = "";
request.data = variables;
var loader:URLLoader = new URLLoader();
configureListeners(loader);
try {
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load requested document.");
}
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
// trace("completeHandler: " + loader.data.GaleryScoresText);
var vars:URLVariables = new URLVariables(loader.data);
trace("The GaleryScoresText is " + vars.buff);
my_out_txt.text=vars.buff+"
";
}
var m_filter:Mur_filter = new Mur_filter();//мой класс//на следующей строчке тоже
var load_mc_button:Mur_filter_button = new Mur_filter_button(my_mc,m_filter,load_mc_function);
function load_mc_function()
{
variables.exampleSessionId= new Date().getTime();
variables.user_name = my_name_txt.text;
variables.user_message = my_message_txt.text;
my_name_txt.text="";
my_message_txt.text="";
try {
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load requested document.");
}
}
//finish of code first frame
PHP
<?php
$result_name=strip_tags($_GET['sessionId']);//chacker killer
$result_name=strip_tags($_GET['user_name']);//хакеры ломать долго будут
$result_message=strip_tags($_GET['user_message']);//хакеры ломать долго будут
//
$split_data=$result_name." <<".$result_message.">>
";
if (strlen($split_data)<10) $split_data="";
if (filesize("guest.txt")<5000)//если больше 5000 байт, удалить все
{
$fh=fopen("guest.txt","r");//
while (!feof($fh)) //прочитать файл (read file)
{
$buff.=fgets($fh);
}
fclose($fh);//close file
}
$fh=fopen("guest.txt","w");
$split_data=$split_data.$buff;
if (strlen($split_data)>10)
{
flock($fh,LOCK_EX);//блокировка
fwrite($fh,$split_data);//write file если сообщение больше 10 байт
flock($fh,LOCK_UN);//разблокировка
}
fclose($fh);//close file
echo "buff=".$split_data;
?>
http://dnadillo.dn.ua/fla/js-swf-html/guest.swf
http://dnadillo.dn.ua/fla/js-swf-html/guest.zip
http://dnadillo.dn.ua/fla/js-swf-html/guest.txt
thanks man, much appreciated…
got everything working…very helpful
/s
:: Copyright KIRUPA 2024 //--