Now: Tutorial for Web and Software Design > Flash > Special Effect > Flash Content
> Simple Authentication System [Bookmark it]
Simple Authentication System

Please note that this authentication system isn't really secure. I'm currently writing a tutorial on how to have a more secure authentication system using mySQL.

I divided this tutorial in two main part. The first being the "login interface", and the second is the "register interface".

First part

1. Before you even make a new flash document, you need to make a text file, that you will name auth.txt. Copy&paste the following text into the auth.txt.

&username1=password1&
&username2=password2&
&username3=password3&
&username4=password4&

Now save the text file.

2. Open a new flash document, set its size to 200×200. Name the layer main, and in its first frame put the following Action Script:

stop();
loadVariables("auth.txt", "");
stage.showMenu = False;

image 1

3. Still in the same frame of the same layer, try to get something similar to the image below:

image 2

4. Select the input text box that is just below the username box, and set its variable to loginname

image 3

5. Do the same for the input text box that is below the password box, except that this time set its variable to loginpass, and also set the line type to password:

image 4

And now you should have something similar to this:

image 5

6. Still in the main layer, add two new blank keyframes.:

image 6

Add a stop(); script in both frames, frame 2, and 3.

In the second frame add a text that says authentication completed, and in the third frame add a text that says: authentication failed

7. Now, go back to the first frame and select the login button, and assign it this action script

on (release, keyPress "<Enter>") {
if (loginname != undefined and loginpass != undefined) {
if (eval(loginname) eq loginpass) {
gotoAndStop(2);
} else {
gotoAndStop(3);
}
}
}

And now you're done with the First part of this tutorial.

This is the Second part. Here, we will add the "register" interface.

8. Firstly you must go back to the first frame of the layer "main", and paste this script on the "register" button you made at the beginning of this tutorial.

on (release) {
gotoAndStop(4);
}

9. Copy&paste all the content that is on the first frame and paste it on the fourth frame. And delete the login button. Also make a new dynamic text box:

image 7

and set its variable to: status

image 8

10. Assign this Action Script to the register button:

on (release, keyPress "<Space>") {
if (loginname != undefined and loginpass != undefined) {
if (eval(loginname) == undefined) {
trace(eval(loginname));
loadVariables("auth.php", _root, "POST");
} else {
status = "username already in use";
}
} else {
status = "all fields must be field";
}
}

Here's the php code, Download and Save it as auth.php.

note: Depending on your host, you must set the 'auth.txt' 's CHMOD to 666, so that the .php file can write on it.

CHMOD is a UNIX command that changes the access permission- ch ange mod e - Therefore if you have a Windows based server you won't need to change anything.

For those who want to know how to CHMOD, usually you can throught your FTP client.


[Bookmark][Print] [Close][To Top]
  • Prev Article-Flash:

  • Next Article-Flash:
  • Related Materias
    Motion Animations
    Effects on Animations
    Examples of ActionScript 2
    Butterfly Wings Animation
    Layers in Flash
    Buttons in Flash
    Symbols in Flash
    Attaching Movie Clips usin
    Graphics in Flash
    Creating the Illusion of S
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial