Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Flash/PHP/MySQL] Login system

Newbie Spellweaver
Joined
Jun 22, 2008
Messages
12
Reaction score
0
Ok so first off i am EXTREMELY sorry if this is the wrong section or anything, but I think its correct. So here is my problem:

I'm trying to make a simple flash game that holds accounts in a PHP file. I was just wondering if someone could help make me an actionscript/php source or file that could get me going. I looked for about 1 hour and everything required MySQL, and I think that is a little too advanced. If you could post a source I would really, really appreciate it . I just need a simple login/register FLA and a php file to hold the variables, then one for all the users. I'm also going to try to add a health variable to the PHP but I would like to study any codes I get to help get more advanced in PHP. OR If anyone could give me a good tutorial on using MySQL to make the table or whatever I would also appreciate that. Oh and all my files are in my C:\wampserver\www folder which holds everything.

Thanks, any help is REALLY appreciated.
 
Newbie Spellweaver
Joined
Sep 14, 2007
Messages
88
Reaction score
0
Re: Help with flash/php connection?

eh wl first off it would be msql, acounts. So uh idk if that helps lol
 
Newbie Spellweaver
Joined
Jun 22, 2008
Messages
12
Reaction score
0
Re: Help with flash/php connection?

Oh ok, so I have my wampserver folder, but how would i incorporate mysql into that?
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
If you have WAMP, just grab a script WITH MySQL (you don't want one without, really)...tons out there, and when it works, you can tweak and learn how it works.
 
Newbie Spellweaver
Joined
Jun 22, 2008
Messages
12
Reaction score
0
Im sorry I dont really understand what to do with wamp since I reeeally need a tutorial on how to make a table and add to it in flash, all the other tutorials are outdated. If someone knows how to do this i would reaaaallly appreciate it if they could post a new noob - friendly tutorial :d

Also: If you can't do that please simply post how i can store variables in a .php from flash and load them on a flash buttonclick
 
Last edited:
Junior Spellweaver
Joined
Feb 23, 2008
Messages
131
Reaction score
1
u have to make a MySQL database im pretty sure
 
---
Loyal Member
Joined
Aug 18, 2004
Messages
641
Reaction score
3
Well, I'm not familiar with flash but for MySQL.
If you want to make new database or create new column, just go to phpMyAdmin.

Run WAMP, left click on the icon at the bottom right and click phpMyAdmin.
 
Initiate Mage
Joined
Sep 5, 2008
Messages
1
Reaction score
0
Im sorry I dont really understand what to do with wamp since I reeeally need a tutorial on how to make a table and add to it in flash, all the other tutorials are outdated. If someone knows how to do this i would reaaaallly appreciate it if they could post a new noob - friendly tutorial :d

Also: If you can't do that please simply post how i can store variables in a .php from flash and load them on a flash buttonclick

Judging by your posts (in this thread) you have no clue what you're doing, so I suggest you learn a few things : PHP, MySQL (very easy), and ActionScript (its used in Flash as a scripting language) you can't just read a tutorial on what you want to make, it wont show you how to fix things if something goes wrong you have to learn how to do things yourself, I suggest buying two books, one on using mysql and php from the begining and one on Flash that covers enough on action script, then I assure you that you will be able to create whatever it is you want to. But only if you LEARN those things I recommended but reading a tutorial will not be the best thing and no tutorial will be written for what YOU want to make unless you wana make whatevers in a tutorial with the following PHP, MySQL and Flash on it. Well theres my two cents in the matter.
 
Newbie Spellweaver
Joined
Jun 22, 2008
Messages
12
Reaction score
0
I actually very much so know what I'm doing in actionscript and I have an idea for PHP, I just don't understand all the MySQL
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
PHP is not, and should not be used as a database. MySQL is not the standard for connecting with Flash. Storing a database in PHP is just as good as storing one in ActionScript; which is useless. If you want to use PHP conditional statements (much stronger and easier than ActionScript), then you should parse the PHP into XML, and load the XML file into your flash file via ActionScript.

If all that confuses you, then you should Google: Flash XML PHP tutorial

I'd strongly suggest using a MySQL database to hold your data. Only because it's more secure than XML in every way.

I'm not that good at sending data from flash.. But there are tons of ways to get data into flash.
Here's an XML tutorial for you:

Create an XML file named myxml.xml with this code:
Code:
<broadcast>
<story>
<lead>Just Started working on XML</lead>
<body>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut porta massa eu dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean egestas. Duis vulputate vehicula nibh. Phasellus interdum, pede et interdum tristique, dui arcu tincidunt magna, non sollicitudin justo ipsum ut massa. Aenean vitae tellus sit amet nibh semper posuere. Sed mattis ligula eget purus. Praesent nisi. Morbi eu massa eget quam tempor dignissim. Curabitur mi. In hendrerit eleifend ligula. Ut vel justo nec nisi facilisis elementum. Etiam tempor odio quis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer sed elit quis augue convallis pulvinar. Quisque nisi enim, pulvinar a, scelerisque nec, tristique lacinia, massa. Nulla mattis luctus sem.</body>
<URL>http://www.lipsum.com/</URL>
</story>
<story>
<lead>Less About XML</lead>
<body>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut porta massa eu dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean egestas. Duis vulputate vehicula nibh. Phasellus interdum, pede et interdum tristique, dui arcu tincidunt magna, non sollicitudin justo ipsum ut massa. Aenean vitae tellus sit amet nibh semper posuere. Sed mattis ligula eget purus. Praesent nisi. Morbi eu massa eget quam tempor dignissim. Curabitur mi. In hendrerit eleifend ligula. Ut vel justo nec nisi facilisis elementum. Etiam tempor odio quis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer sed elit quis augue convallis pulvinar. Quisque nisi enim, pulvinar a, scelerisque nec, tristique lacinia, massa. Nulla mattis luctus sem.</body>
<URL>http://www.lipsum.com/</URL>
</story>
<story>
<lead>Even Less About XML</lead>
<body>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut porta massa eu dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean egestas. Duis vulputate vehicula nibh. Phasellus interdum, pede et interdum tristique, dui arcu tincidunt magna, non sollicitudin justo ipsum ut massa. Aenean vitae tellus sit amet nibh semper posuere. Sed mattis ligula eget purus. Praesent nisi. Morbi eu massa eget quam tempor dignissim. Curabitur mi. In hendrerit eleifend ligula. Ut vel justo nec nisi facilisis elementum. Etiam tempor odio quis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer sed elit quis augue convallis pulvinar. Quisque nisi enim, pulvinar a, scelerisque nec, tristique lacinia, massa. Nulla mattis luctus sem.</body>
<URL>http://www.lipsum.com/</URL>
</story>
</broadcast>
Now create a flash file in the same directory with 2 layers.
- Name the first one Script.
- Name the second one Content.

In the Content layer:
- Create a dynamic, multi-line text field with an instance name of txt.

In the Script layer:
- To get the XML data, write (or paste) this code in the Actions Panel:
Code:
// The first step is to activate the XML object
headlineXML = new XML();
/*
With the XML Object now active you must now load an XML foramtted document.
Any DTD or XLS formatting will be ignored.
*/
headlineXML.onLoad = myLoad;
headlineXML.load("myxml.xml");
// Before proceeding to far into the program, make sure the XML document has loaded
// Extract information from the XML file
function myLoad(ok) {
	if (ok == true) {
		Publish(this.firstChild);
	}
}

function Publish(HeadlineXMLNode) {
	if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
		content = "";
		story = HeadlineXMLNode.firstChild;
		while (story != null) {
			if (story.nodeName.toUpperCase() == "STORY") {
				lead = "";
				body = "";
				URL = "";
				element = story.firstChild;
				while (element != null) {
					if (element.nodeName.toUpperCase() == "LEAD") {
						lead = element.firstChild.nodeValue;
					}
					if (element.nodeName.toUpperCase() == "BODY") {
						body = element.firstChild.nodeValue;
					}
					if (element.nodeName.toUpperCase() == "URL") {
						URL = element.firstChild.nodeValue;
					}
					element = element.nextSibling;
				}
				content += "<font size='+2' color='#FFFF00'><b><a href='"+URL+"'><u>"+lead+"</u></a></b></font><br><i>"+body+"</i><br><br>";
				txt.htmltext=content;
			}
			story = story.nextSibling;
		}
	}
}

Try experimenting with this code by changing some values and names. Be aware that if you change the name of a field in the XML file, you'll have to change the information in the ActionScript.

For example, if you want to change the field, "body" in the XML file to "user", you would have to go into your ActionScript, find where it says "BODY" and change it to "USER".

Hope this helps..
- Spence.

P.S. When you're done, it should look relatively like
 
Last edited:
Back
Top