フレックスPHPインタラクティブ
元のアドレス: http://blog.sina.com.cn/s/blog_4dd475390100ryp9.html
データベース tiask を作成し、次の SQL を実行します
/*Navicat MySQL Data TransferSource Server : localhostSource Server Version : 50067Source Host : localhost:3306Source Database : tiaskTarget Server Type : MYSQLTarget Server Version : 50067File Encoding : 65001Date: 2011-10-09 16:59:33*/SET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for `flextest`-- ----------------------------DROP TABLE IF EXISTS `flextest`;CREATE TABLE `flextest` ( `name` varchar(10) NOT NULL, `pwd` longtext, PRIMARY KEY (`name`)) ENGINE=MyISAM DEFAULT CHARSET=gb2312;-- ------------------------------ Records of flextest-- ----------------------------INSERT INTO `flextest` VALUES ('user', '1234');-- ------------------------------ Table structure for `user_list`-- ----------------------------DROP TABLE IF EXISTS `user_list`;CREATE TABLE `user_list` ( `name` longtext, `pwd` longtext) ENGINE=MyISAM DEFAULT CHARSET=gb2312;-- ------------------------------ Records of user_list-- ----------------------------INSERT INTO `user_list` VALUES ('user', '1234');
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; import mx.controls.Alert; [Bindable] private var result1:ArrayCollection; private var login_result:String; [Bindable] private var sendChoice:String; private function goLogin():void{ if(username.text=="" || userpwd.text=="") Alert.show("没有填写用户名或密码"); else{ sendChoice="login"; login.send(); } } private function goRegis():void{ if(username.text=="" || userpwd.text=="") Alert.show("没有填写用户名或密码"); else{ sendChoice="regis"; login.send(); } } private function resultHandler(event:ResultEvent):void{ login_result=event.result.html.body.users.a.toString(); if(login_result=="ok"){ Alert.show("欢迎,登录成功"); } if(login_result=="nohave"){ Alert.show("没有找到这个用户名 请先注册!"); } if(login_result=="pwderror"){ Alert.show("密码错误! 请从新登陆!"); } if(login_result=="nameishave"){ Alert.show("用户名已经存在,请选择别的用户名注册"); } if(login_result=="regisok"){ Alert.show("注册成功,请从新登陆"); } if(login_result=="error"){ Alert.show("错误"); } } ]]> </mx:Script> <mx:HTTPService id="login" method="POST" showBusyCursor="true" url="http://localhost/testflex.php" result="resultHandler(event)"> <mx:request xmlns=""> <mx:username> {username.text} </mx:username> <mx:userpwd> {userpwd.text} </mx:userpwd> <mx:sendchoice> {sendChoice} </mx:sendchoice> </mx:request> </mx:HTTPService> <mx:Panel width="310" height="265" layout="absolute" title="登录" fontSize="12" fontWeight="normal"> <mx:TextInput x="93" y="51" id="username" fontSize="12" restrict="0-9,a-z" maxChars="8"/> <mx:TextInput x="92" y="95" id="userpwd" fontSize="12" displayAsPassword="true" maxChars="8" restrict="0-9,a-z"/> <mx:Button x="78" y="154" label="登录" id="btn1" click="goLogin()" fontWeight="normal" fontSize="12"/> <mx:Label x="32" y="53" text="用户名:" fontSize="12"/> <mx:Label x="43" y="97" text="密码:" fontSize="12"/> <mx:Button x="154" y="154" label="注册" fontSize="12" fontWeight="normal" id="btn2" click="goRegis()"/> <mx:Label x="10" y="10" text="测试用 用户名 user 密码 1234" fontSize="12" width="243"/> </mx:Panel> </mx:Application>
php 部分: e
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>flex login</title> </head> <body> <?php $return=""; if(isset($_POST[username]) && isset($_POST[userpwd]) && isset($_POST[sendchoice])){ $uname=$_POST[username]; $upwd=$_POST[userpwd]; $choice=$_POST[sendchoice]; $link = mysql_connect("localhost","root","") or die (mysql_error()); if($link){ $select=mysql_select_db("tiask",$link); mysql_query("set names gb2312"); if($choice=="login"){ $sql=mysql_query("select * from flextest where name='$uname'"); $result=mysql_fetch_object($sql); if($result==false){ $return='<users>'; $return.='<a>nohave</a>'; $return.='</users>'; }else if($result->pwd==$upwd){ $return='<users>'; $return.='<a>ok</a>'; $return.='</users>'; }else{ $return='<users>'; $return.='<a>pwderror</a>'; $return.='</users>'; } } if($choice=="regis"){ $sql=mysql_query("select * from user_list where name='$uname'"); $result=mysql_fetch_object($sql); if($result==false){ $sql_1=mysql_query("insert into user_list(name,pwd) values('$uname','$upwd')",$link); if($sql_1){ $return='<users>'; $return.='<a>regisok</a>'; $return.='</users>'; } }else{ $return='<users>'; $return.='<a>nameishave</a>'; $return.='</users>'; } } } mysql_close(); } else{ $return='<users>'; $return.='<a>error</a>'; $return.='</users>'; } echo $return;?> </body> </html>

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









PHPクライアントURL(CURL)拡張機能は、開発者にとって強力なツールであり、リモートサーバーやREST APIとのシームレスな対話を可能にします。尊敬されるマルチプロトコルファイル転送ライブラリであるLibcurlを活用することにより、PHP Curlは効率的なexecuを促進します

顧客の最も差し迫った問題にリアルタイムでインスタントソリューションを提供したいですか? ライブチャットを使用すると、顧客とのリアルタイムな会話を行い、すぐに問題を解決できます。それはあなたがあなたのカスタムにより速いサービスを提供することを可能にします

記事では、PHP 5.3で導入されたPHPの後期静的結合(LSB)について説明し、より柔軟な継承を求める静的メソッドコールのランタイム解像度を可能にします。 LSBの実用的なアプリケーションと潜在的なパフォーマ

JWTは、JSONに基づくオープン標準であり、主にアイデンティティ認証と情報交換のために、当事者間で情報を安全に送信するために使用されます。 1。JWTは、ヘッダー、ペイロード、署名の3つの部分で構成されています。 2。JWTの実用的な原則には、JWTの生成、JWTの検証、ペイロードの解析という3つのステップが含まれます。 3. PHPでの認証にJWTを使用する場合、JWTを生成および検証でき、ユーザーの役割と許可情報を高度な使用に含めることができます。 4.一般的なエラーには、署名検証障害、トークンの有効期限、およびペイロードが大きくなります。デバッグスキルには、デバッグツールの使用とロギングが含まれます。 5.パフォーマンスの最適化とベストプラクティスには、適切な署名アルゴリズムの使用、有効期間を合理的に設定することが含まれます。

記事では、入力検証、認証、定期的な更新など、脆弱性から保護するためのフレームワークの重要なセキュリティ機能について説明します。

この記事では、フレームワークにカスタム機能を追加し、アーキテクチャの理解、拡張ポイントの識別、統合とデバッグのベストプラクティスに焦点を当てています。

PHP開発でPHPのCurlライブラリを使用してJSONデータを送信すると、外部APIと対話する必要があることがよくあります。一般的な方法の1つは、Curlライブラリを使用して投稿を送信することです。
