PunBB is light, simple and robust forum. We have decided to use it on a specific project and to use its user management system. Here is a simple example on how you can login to punBB using Flex interface :
I-Php Script
!! : This php script is insecure. Please take care of protecting your nice server from attacks. Brief intro.
<?php
$userx=$_REQUEST[”user”];
$passwordx=$_REQUEST[”password”];
define(’PUN_ROOT’, ‘modules/forum/’);
require PUN_ROOT.’include/common.php’;
$mysql = mysql_connect(”Serv”, “adm”, “adm”);
mysql_select_db( “marsweb” );
$result_pun = mysql_query(”select `id` from `forum_users` where `username`=’$userx’ “);
$row_pun = mysql_fetch_array($result_pun);
pun_setcookie($row_pun[’id’],pun_hash(”$passwordx”),time() + 86400);
?>
II- The mxml flex file :
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”vertical”>
<mx:Script source=”myFunctions.as” />
<mx:HTTPService id=”loginForum” result=”fnDiplayResult(event)” fault=”fnHandleFault(event)”/>
<mx:Button label=”loginForum” click=”login_into_Forum()” />
<mx:TextInput id=”infos” />
</mx:Application>
III The actionscript File :
public function login_into_Forum():void
{
var Obj:Object=new Object();
loginForum.method=”GET”;
loginForum.url=”ForumLogin.php?user=”+user+”&password=”+password
loginForum.send();
}
private function fnDiplayResult(event):void{infos.text=”Login Success”}