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; |
3. Still in the same frame of the same layer, try to get something similar to the image below:
4. Select the input text box that is just below the username box, and set its variable to loginname
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:
And now you should have something similar to this:
6. Still in the main layer, add two new blank keyframes.:
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:
and set its variable to: status
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.





