DragonTooth™
(FLASH) IAD Login and CMS DragonToothBanner-4
DragonTooth™
(FLASH) IAD Login and CMS DragonToothBanner-4
DragonTooth™
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Welcome To DragonTooth (GameDEV). Our Administrators: Emptrix, Amethyst, Shizuko~Conan, Yamino. To Contact Us, e-mail: Dragon_Tooth@live.com.
 
HomeLatest imagesSearchRegisterLog in
Welcome to DragonToothDEV Forum. We are currently not taking anymore new users, however we will accept users that has Friend's Recommendation. Members who's friends are joining please pm one of the Administrators the username of your friend's newly created account to get it activated.

 

 (FLASH) IAD Login and CMS

Go down 
AuthorMessage
Emptrix
Staff Administrator
Emptrix


Posts : 1218
Points : 1916
Reputation : 13
Join date : 2009-05-09
Age : 33
Location : The World That Never Was

(FLASH) IAD Login and CMS Empty
PostSubject: (FLASH) IAD Login and CMS   (FLASH) IAD Login and CMS EmptyFri Mar 04, 2011 1:13 pm

Login AS3
Code:
stop();
/*import flash.display.MovieClip;
import fl.events.*;
import flash.events.*;
import flash.net.NetConnection;
import flash.net.Responder;

    var gateway:String = "http://localhost/amfphp1.9/gateway.php";
    var connection:NetConnection;
    var responder:Responder;*/
      
      
         btnlogin.addEventListener(MouseEvent.CLICK, processLogin);
         responder = new Responder(onResult, onFault);
         connection = new NetConnection;
         connection.connect(gateway);
         
function processLogin (e: MouseEvent): void {
   var username: String;
   var password: String;
   
   username = txtUsername.text;
   password = txtPassword.text;
   
   if (username.length == 0)
      lblerror.text = "Please enter your username";
   else if (password.length == 0)
      lblerror.text = "Please enter your password";
   else {
      lblerror.text = "";
      submitLogin (username, password);
   }
}   

function submitLogin(username:String, password:String):void
{
   connection.call("bsl_accounts.checkLogin", responder, username, password);
}

function onResult(results:Object):void
{
   if (results.length == 0)
       lblerror.text = "Wrong userID or Password.";
   else
       gotoAndStop("Admin");
      
}

function onFault(responds:Object):void
{   
   for(var i in responds)
   {
      trace("[" + i + "]\t" + responds[i]);
   }
}


CheckLogin.php
Code:
<?php

class bsl_accounts
{

   // Database info
   private $dbHost = "localhost";
   private $dbUser = "root";
   private $dbPass = "";
   private $dbName = "bsl_db";
   
   private $_connection = null;
   
   function bsl_accounts()
   {

      $this->methodTable = array
      (
         "connect" => array
         (
            "access" => "private"
         ),
         "checkLogin" => array
         (
            "access" => "remote",
            "description" => "bsl_accounts."
         ),
      );
   }
   
   /**
    * @access private
    * @desc Connect to database - **PRIVATE**
    */
   function connect()
   {
      
      if($this->_connection == null)
      {
         $this->_connection = mysql_connect(
            $this->dbHost,
            $this->dbUser,
            $this->dbPass
         );
         mysql_select_db($this->dbName, $this->_connection);
      }
      
   }
   
   /**
    * List of books.
    */
   function checkLogin($username, $password)
   {
      $this->connect();
      
      $sql = "SELECT * FROM accounts WHERE username = '" . $username . "' AND password = '" . $password . "'";
      
      $result = mysql_query($sql, $this->_connection);
      
      $rows = array();
      
      while($row = mysql_fetch_array($result, MYSQL_ASSOC))
      {
         array_push($rows, $row);
      }
      
      return $rows;
   }

}
?>
Back to top Go down
http://emptrix.tk
 
(FLASH) IAD Login and CMS
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
DragonTooth™ :: Help & Support :: Help & Requests-
Jump to: