原文地址: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');
flex部分:
<?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
testflex.php
<!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>
完

PHP日志记录对于监视和调试Web应用程序以及捕获关键事件,错误和运行时行为至关重要。它为系统性能提供了宝贵的见解,有助于识别问题并支持更快的故障排除

Laravel使用其直观的闪存方法简化了处理临时会话数据。这非常适合在您的应用程序中显示简短的消息,警报或通知。 默认情况下,数据仅针对后续请求: $请求 -

PHP客户端URL(curl)扩展是开发人员的强大工具,可以与远程服务器和REST API无缝交互。通过利用Libcurl(备受尊敬的多协议文件传输库),PHP curl促进了有效的执行

Laravel 提供简洁的 HTTP 响应模拟语法,简化了 HTTP 交互测试。这种方法显着减少了代码冗余,同时使您的测试模拟更直观。 基本实现提供了多种响应类型快捷方式: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

您是否想为客户最紧迫的问题提供实时的即时解决方案? 实时聊天使您可以与客户进行实时对话,并立即解决他们的问题。它允许您为您的自定义提供更快的服务

文章讨论了PHP 5.3中引入的PHP中的晚期静态结合(LSB),从而允许静态方法的运行时分辨率调用以获得更灵活的继承。 LSB的实用应用和潜在的触摸


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

WebStorm Mac版
好用的JavaScript开发工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

Dreamweaver CS6
视觉化网页开发工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。