Flash and PHP

Source: Internet
Author: User

P {margin-bottom: 0.08in ;}

Flash and
ASP:

Paste the two Codes first.
:

Flash:

 

 

Webpage tutorial Network

 

VaR Loader: urlloader = new urlloader ();

 

VaR URL: URLRequest = new
URLRequest ("test. asp ");

 

URL. method = urlrequestmethod. post;

 

VaR values: urlvariables = new
Urlvariables ();

 

Values. Message = "Hello im flash! ";

URL. Data = values;

 

Loader. dataformat =
Urlloaderdataformat. variables;

Loader. addeventlistener (event. Complete, loaded );

Function loaded (E: Event ){

Out1.text = loader. Data;

// Output: phpmessage = Im PHP
Message! & Flashmessage = Hello im flash!

Out2.text = loader. Data. phpmessage;

// Im PHP message!

Out3.text = loader. Data. flashmessage;

// Hello im flash!

Out4.text = loader. Data. dbmessage;

}

Loader. Load (URL );

 

Webpage tutorial Network

 

 

Webpage tutorial Network

 

ASP:

Webjx. com

 

<% @ Language = "JavaScript" %>

<%

// Receive
Data transmitted in Flash

VaR flashdata;

 

Flashdata = request ("message ");

// Send
Flash data

VaR aspmessage;

Aspmessage = 'im ASP message! ';

 

 

// Database operations

// ================================================

VaR conn;

VaR RS;

VaR SQL;

VaR strpath;

Strpath = "test. mdb ";

Try {

Conn =
Server. Createobject ("ADODB. Connection ");

Conn. connectionstring = "provider = Microsoft. Jet. oledb.4.0; Data
Source = "+ server. mappath (strpath );

Conn. open ();

} Catch (e ){

Response. Write ('<Meta; charset = UTF-8 "/> <p
Style = "font-size: 12px; font-weight: bold; Border: 1px solid
#006; padding: 6px; Background: # FCC "> database connection error. Check the connection string.
! </P> ');

Response. End

}

Rs = server. Createobject ("ADODB. recordset ")
;

SQL = "select * from name ";

Rs. Open (SQL, Conn, 1, 1 );

// ================================================

Response. Write ("phpmessage =" + aspmessage + "&" + "flashmessage =" + flashdata + "&" + "dbmessage =" + RS ("companyName "));

 

 

 

%>

 

Webjx. com

 

See
Flash and
The variable names in ASP files know how to transfer each other.
For some database Inserts
, Update
, Query operations
, As long as you receive
Flash data
, Run directly
ASP-related database operation commands
. Copy directly
The IIS path can be tested.
. Online viewing address
: Plete, loaded );

Function loaded (E: Event ){

Out1.text = loader. Data;

// Output: phpmessage = Im PHP
Message! & Flashmessage = Hello im flash!

Out2.text = loader. Data. phpmessage;

// Im PHP message!

Out3.text = loader. Data. flashmessage; webjx. com

// Hello im flash!

Out4.text = loader. Data. dbmessage;

}

Loader. Load (URL );

 

 

 

PHP:

Webjx. com

 

Webjx. com

 

<? PHP

// Database operations are involved here

// ============================================

Define ('database _ Server ',
'Localhost ');

Define ('database _ username ',
'Root ');

Define ('database _ password ',
'Root ');

Define ('database _ name ',
'Flextest ');

$ Link = @ mysql_connect (database_server, database_username, database_password );

@ Mysql_select_db (database_name, $ link );

$ Result = @ mysql_query ("select *
From Users ");

$ User = @ mysql_fetch_array ($ result, mysql_assoc );

// Echo $ user ['userid'];

$ Dbvar = $ user ['userid'];

// ============================================

// Receive
Data transmitted in Flash

$ Flashdata = $ _ post ['message'];

 

 

// Give
Data sent by flash

$ Phpmessage = 'im PHP message! ';

Echo
"Phpmessage = $ phpmessage & flashmessage = $ flashdata & dbmessage = $ dbvar ";

?>

Webjx. com

 

 

The code is simple.
, No need to explain
, In fact, and
ASP does not have many regions
. Copy directly
PHP path to test
. The database file is directly stored in
Run the following command under phpMyAdmin:
In flextest. SQL
The SQL statement is enough.
Because the company bans ports
, I cannot operate my space online
SQL database
No Online Demo address
When you have time to add
.

 

Flex and
PHP:

Paste the two Codes first.
:

Flex:

Webjx. com

 

 

 

Webjx. com

 

 

<? XML version = "1.0"
Encoding = "UTF-8"?>

<Mx: Application
Xmlns: MX = "/2006/mxml"
Creationcomplete = "oninit ()" xmlns = "*"
Layout = "absolute" backgroundgradientcolors = "[# ffffff,
# C0c0c0] ">

<Mx: SCRIPT>

<! [CDATA [

Public Function
Oninit (): void

{

Userrequest. Send ();

} Webjx. com

]>

</MX: SCRIPT>

<Mx: httpservice id = "userrequest"
Url = "request. php" useproxy = "false" method = "Post">

<Mx: Request xmlns = "">

<Username> {username. Text} </username> <emailaddress> {emailaddress. Text} </emailaddress>

</MX: Request>

</MX: httpservice>

<Mx: form x = "22" Y = "10"
Width = "356">

<Mx: hbox>

<Mx: Label text = "username"/>

<Mx: textinput
Id = "username"/>

 

 

</MX: hbox>

<Mx: hbox>

<Mx: Label text = "email
Address "/>

<Mx: textinput
Id = "emailaddress"/>

</MX: hbox>

<Mx: button label = "Submit"
Click = "userrequest. Send ()"/>

</MX: Form>

<Mx: DataGrid id = "dguserrequest"
X = "22" Y = "128"
Dataprovider = "{userrequest. lastresult. Users. User}">

<Mx: columns>

<Mx: datagridcolumn
Headertext = "User ID" datafield = "userid"/>

<Mx: datagridcolumn
Headertext = "User Name" datafield = "username"/>

</MX: columns>

</MX: DataGrid>

<Mx: textinput x = "22"
Y = "292" id = "selectedemailaddress"
TEXT = "{dguserrequest. selecteditem. emailaddress}"/>

</MX: Application>

Webjx. com

 

 

PHP:

 

 

 

 

Webpage tutorial Network

 

 

<? PHP

/* Thanks to Pete Macie for the code
Below */

 

Define ('database _ Server ',
'Localhost ');

Define ('database _ username ',
'Root ');

Define ('database _ password ',
'Root ');

Define ('database _ name ',
'Flextest ');

 

# Connect to the database

$ Mysqli = new mysqli (database_server,
Database_username, database_password, database_name );

 

# Check connection

If (mysqli_connect_errno ()){

Printf ("MySQL connect failed:
% S \ n ", mysqli_connect_error ());

Exit ();

}

 

# Quote variable to make safe

Function quote_smart ($ value ){

Global $ mysqli;

 

Webjx. com

 

# Stripslashes

If (get_magic_quotes_gpc ())

$ Value =
Stripslashes ($ value );

 

# Quote if not integer

If (! Is_numeric ($ value ))

$ Value =
$ Mysqli-> real_escape_string ($ value );

Return $ value;

}

 

If (! Empty ($ _ post )&&
$ _ Server ['request _ method'] = 'post '){

If ($ _ post ['emailaddress']
& $ _ Post ['username']) {webpage tutorial Network

# Add the user

$ Query = sprintf ("insert
Into users values ('', '% s',' % s ')",
Quote_smart ($ _ post ['username']),
Quote_smart ($ _ post ['emailaddress']);

If
(! @ $ Mysqli-> query ($ query )){

Printf ("'flextest' user database query insert error: % s \ n ",
$ Mysqli-> error );

$ Mysqli-> close ();

Webjx. com

 

Exit ();

}

}

}

 

# Return a list of all the users

If (! $ Result = @ $ mysqli-> query ("select
* From Users ")){

Printf ("'flextest'
User Database Query select error: % s \ n ", $ mysqli-> error );

$ Mysqli-> close ();

Exit ();

}

 

$ Xml_return = "<users> ";

While ($ user =
Mysqli_fetch_array ($ result, mysqli_assoc )){

$ Xml_return. = webjx. com

"<User> <userid> ". $ user ['userid']. "</userid> <username> ". $ user ['username']. "</username> <emailaddress> ". $ user ['emailaddress']. "</emailaddress> </user> \ n ";

}

$ Xml_return. = "</users> ";

$ Mysqli-> close ();

Echo $ xml_return;

?>

 

 

The code here is
Adobe
An instance in the phpria SDK
.
If you want all source code, leave your email
, I will send
. Flex and
No more PHP
, Directly
PHP Code Conversion
ASP code is enough.
, And
Flash.
.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.