Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MY ACTIONSCRIPT
  2.  
  3. //----------------------------------------------------------
  4. // Log out, and shut down connection
  5. //----------------------------------------------------------
  6. function closeConnection()
  7. {
  8.         smartfox.disconnect()
  9.         gotoAndStop("connect")
  10. }
  11.  
  12.  
  13.  
  14. //STEP 3:
  15.  //Go to {code] connect frame:
  16. var loader:LoadVars = new LoadVars();
  17. //variable which will load the response from the php file
  18. var sender:LoadVars = new LoadVars();
  19. //variable which will send the login info to the php file
  20. function login() {
  21.         _root.error = "Connecting To The Database";
  22.         if(user.text != ""){
  23.                 if(pass.text != ""){
  24.                         submit._visible = false;
  25.                         sender.user = user.text;
  26.                         sender.pass = pass.text;
  27.                         sender.sendAndLoad("dbuserconnect.php", loader, "POST");
  28.                         //sender.sendAndLoad("Link to your Login PHP file", loader, "POST");
  29.                 }else{
  30.                         error = "Please enter your password"
  31.                         submit._visible = true;
  32.                 }
  33.         }else{
  34.                 error = "Please enter your username"
  35.                 submit._visible = true;
  36.         }
  37. }
  38. loader.onLoad = function(success:Boolean) {
  39.         // This boolean variable (success) will return true or false
  40.         // on whether the PHP file was retrieved
  41.         if (success) {
  42.                 trace("Recieved php file answer");
  43.                 trace("count: "+this.count)
  44.                 trace("username: "+this.postuser)
  45.                 trace("password: "+this.postpass)
  46.                 //checking the answer from the php file
  47.                 if (this.check1 == 1)
  48.             {
  49.             error = "Please wait while you are logged in..."
  50.                _root.smartfox.connect(ip, port)
  51.                 } else if (this.check1 == 2) {
  52.                         error = "The username or password you entered was incorrect"
  53.                         submit._visible = true;
  54.                         //put here the rest of the code to be executed when the username and pass are wrong
  55.                 }
  56.         } else {
  57.                 error = "There was a problem connecting to the php file"
  58.                 submit._visible = true;
  59.         }
  60. };
  61. //loadVariables("dbuserconnect.php", this, "GET")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement