The $_post variable in PHP is an array that collects values from the method= "post" with the name and value of the variable sent by the HTTP POST method.
The information sent from a form with a post method is not visible to anyone, and there is no limit to the information sent.
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "Utf-8" /> <title>Feiruo</title> </Head> <Body> <formAction= "welcome.php"Method= "POST">Name:<inputtype= "text"name= "Name" />Age :<inputtype= "text"name= "Age" /> <inputtype= "Submit" /> </form> </Body></HTML>
<?php echo "Your name is ' $_post[' name '] ' and you're ' $_post[' age '] '.";? >
The $_request variable contains the $_get,$_post method and $_cookie content, so you can use the $_request variable to get the results of the data sent through the $_get and $_post methods.
In fact, a lot of time to learn PHP, but has not been well practiced, today using AS3.0 call PHP files to write data to the MySQL database.
Here is the php file register.php:
<?PHPHeader("Content-type:text/html;charset=utf-8"); Define(' db_user ', ' localhost '); Define(' Db_root ', ' ROOT '); Define(' Db_pwd ', ' Exda8hp954abzvd8 '); Define(' db_name ', ' feiruodata '); $getName=$_post[' _name ']; $getPswd=$_post[' _PSWD ']; //Connect to MySQL $con[Email protected]mysql_connect(DB_USER,DB_ROOT,DB_PWD) or die(' Connection error '); //Select Database mysql_select_db(Db_name,$con) or die(' occured error '); mysql_query(' SET NAMES UTF8 ') or die(' Show error '); $query= "INSERT into excise01 (user_name,user_pswd) VALUES ('$getName‘,‘$getPswd‘)"; $row[Email protected]mysql_query($query) or die(' Cuowu '); //Close the database Mysql_close(); ?>
AS3.0 file:
Package {Import Flash.display.sprite;import flash.events.mouseevent;import Flash.net.urlrequest;import Flash.net.urlloader;import Flash.net.urlrequestmethod;import Flash.events.event;import flash.net.URLVariables; public class REGISTER_MC extends Sprite{private const _url= "http://localhost/feiruo/register.php";p rivate var _verify: _verifycode;//Verification Code private VAR _request:urlrequest;private var _loader:urlloader;private var _code:string= "";p ublic function Register_mc () {//set character interval nickname.restrict = "A-za-z\u4e00-\u9fa5"; verifycode.restrict = "a-za-z0-9"; _VERIFY= New _verifycode (); This.addchild (_verify); _verify.x=verifycode.x-_verify.width/2;_verify.y=verifycode.y; Registerbtn.addeventlistener (Mouseevent.mouse_down,registerfunc); Cancelbtn.addeventlistener (MouseEvent.MOUSE_ DOWN,CANCELFUNC); This.addeventlistener (Event.enter_frame, Function (e:event): void {(Nickname.text). replace (/([]{1})/g, "") = = "" | | password.text.length<4)? registerbtn.enabled=false:registerbtn.enabled=true; });} Private FUnction Registerfunc (e:mouseevent): Void{if (Cancelbtn.haseventlistener (Mouseevent.mouse_down)) Cancelbtn.removeeventlistener (Mouseevent.mouse_down,cancelfunc); if (registerbtn.enabled) {verifyCode.text.toLowerCase () ==_verify.scode.tolocalelowercase () register (): Verifycod e.text= "Error"; _verify.refreshcode (e); Cancelfunc (e); }}private function Register (): Void{var _var:urlvariables=new urlvariables (); _request=new urlrequest (_url); _ Request.method=urlrequestmethod.post;_var._name=nickname.text;_var._pswd=password.text;_request.data=_var;_ Loader=new URLLoader (_request);} Private Function Cancelfunc (e:mouseevent): void{nickname.text= "";p assword.text= ""; verifycode.text= "";}}}
AS3.0 Verification Code:
package{/* * @ClassName:p ackage::verifycode * * @Intro: Use ActionScript3.0 to draw common simple verification code * * @Author: Not if *@e-mail:[email Protected] * @Date: 2015.07.12 * */import flash.display.sprite;import flash.display.shape;import Flash.text.TextField; Import Flash.text.textformat;public class Verifycode extends sprite{private var tt:sprite=new Sprite ();p rivate var tt: Sprite=new Sprite (); private Var bg:shape;private var word:shape;private var blurw:shape;private var randsum:uint= (Math.random () *78)%26; Public Function Verifycode (arr:array) {INIT_IMAGEBG (); Init_imageblur (); Init_imagew (arr); Init_imagex (); Init_mask () ; This.addchild (TT); This.addchild (TT); Tt.addchild (Init_mask ()); Tt.mask=tt;} Private Function Init_mask (): Sprite{var d:sprite=new Sprite ();d. Graphics.clear ();d. Graphics.beginfill (SetColor (), 1 );d. Graphics.drawrect (0,0,65,32);d. Graphics.endfill (); return D;} Private Function Init_imagebg (): Void{bg=new Shape (); Bg.graphics.clear (); Bg.graphics.beginFill (0xffffff,0); Bg.graphics.drawRect (0,0,65,32);Bg.graphics.endFill (); tt.addchild (BG);} Private Function Init_imagew (codes:array): Void{word=new Shape (); for (var i:uint=0; i<codes.length; i++) {var T: Textfield=new TextField (); var f:textformat=new TextFormat (); f.size = * Math.random () + 12;f.color = SetColor () +0x66666 6;f.bold=true;t.text = Codes[i];t.x = i * + 1;t.selectable = False;t.y = Math.random () * 5-1;tt.addchild (t); t.setText Format (f);}} Private Function Init_imageblur (): Void{blurw=new Shape (); for (var r:uint=0; r<=3; r++) {BlurW.graphics.lineStyle ( Math.random () *1,setcolor ()); BlurW.graphics.lineTo (65*math.random () +5,35*math.random () +4); blurW.graphics.moveTo (65*math.random () -10,35*math.random ()-5); Blurw.alpha=.8;tt.addchild (BLURW);}} Private Function Init_imagex (): Void{init_imagew ([".", ".", ".", "."]); Private Function SetColor (): Uint{var _color:uint = 0xCCCCCC * Math.random () + 0x222200;return _color;}}}
package{/* * @ClassName:p ackage::verifycode * * @Intro: Transfer the drawn characters to Verifycode * * @Author: *@e-mail:[email protected] *@ date:2015.07.12 * */import flash.display.sprite;import flash.display.shape;import flash.events.MouseEvent;public Class _verifycode extends sprite{public var scode:string= "";p ublic var code:array = [];p rivate var words:string = "QYhg123 Ubnmw0erty89lkjpuxcvioplohgfkj45fidsazdsaz67xcwertvbnm ";p rivate var vcode:verifycode;public function _VerifyCode () {vcode=new Verifycode (getString ()); AddChild (Vcode); Vcode.buttonmode=true;this.addeventlistener (Mouseevent.mouse _down,refreshcode);} Public Function Refreshcode (e:mouseevent): void{removechild (Vcode); Vcode=new Verifycode (GetString ()); AddChild ( Vcode);} Private Function GetString (): Array{code=[];scode= "", for (var a:uint=0; a<=3; a++) { Scode+=words.charat ( Math.random () *words.length*3)%words.length); Code.push (Scode.charat (a));} return code;}}}
as3.0+php writing to MySQL