Flash and PHP for login status
Hello and thank you in advance for taking the time to read my question.
I currently have a login utility that is the front end of a multi page site. The individual logs in and is then granted access to what ever their "authorization level" is.
I wish to have my Flash website, request the users "authorization level" from our PHP server side script.
I have already constructed a three page timeline, where depending on their "authorization level", they will be forwarded to the page that's matches that level however I'm having a heck of time finding a reasonable place to start.
I have included a visual map of what i'm looking to accomplish as I've always found it easier to see what's being discussed.
Again, thanks in advance for anyone that might be able to help. Additonally, i have attached the image to assist with review as well.
Cheers
You will need to send variables to PHP which will in turn send it to MySQL and check for the authorization level and then send back the result to Flash via PHP... I have a very general idea of this whole thing so I won't be able to help you much (I'm still a beginner in AS3), but you can check these places for some good video tutorials on the subject:
http://www.developphp.com/Flash_tutorials/
htttp://www.gotoandlearn.com
and there's also some good tutorials on Cartoon Smart.
Good luck!
Similar Messages
-
High Score Table: Writing a Simple Text File with Flash and PHP
I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I could check that the server was running PHP - the files were also uploaded to a remote server so I could test them properly. Flash code is as follows:
//php filewriter
var myLV = new LoadVars();
function sendData() {
//sets up variable 'hsdata' to send to php
myLV.hsdata = myText;
myLV.send("hiscores.php");
I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
<?php
//assigns to variable the data POSTed from flash
$flashdata = $_POST["hsdata"];
//file handler opens file and erases all contents with w arg
$fh = fopen("scores.txt","w");
//adds data to file
fwrite ($fh,$flashdata);
//closes file
fclose ($fh);
echo 'php file is working';
?>
Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.Thanks for your help.
I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
var outLV = new LoadVars();
var inLV = new LoadVars();
function sendData() {
outLV.hsdata = "Hello from Flash";
outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
inLV.onLoad = function(success) {
if (success) {
//sets dynamic text box to show variable sent from php
statusTxt.text = phpmess;
} else {
statusTxt.text = "No Data Received";
This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
<?php
$mytxt =$_POST['hsdata'];
$myfile = "test23.txt";
$fh = fopen($myfile,'w');
//adds data to file
fwrite($fh, $mytxt);
//closes file
fclose ($fh);
$mess = "hello there from php";
echo ("&phpmess=$mess&");
?>
The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated. -
Array data between Flash and PHP
As the title suggests, I'm trying to find a good way of
getting an ActionScript/Flash dynamic array into PHP, so I can
serialize it and store it in a DB, then simply give back that same
array when it's called. Are there any popular techniques? The array
will always be a different size, containing different values -
which is why I'd like to keep the array in tact, to minimise the
amount of parameter transfers. If there's no good solution, I
suppose I could pass in parameters and read them in, create an
array and serialize that... but I'd much rather find a way of
having my flasher serialize his own array and pass me the
byte-code. Is this possible?
PHP doesn't need to read the contents of the array, simply
store it in a DB, so if there's some kind of flash method for
serializing an array into bytecode that it can unserialize and read
back later, that would be awesome.
Thanks. =]
[edit]
I found this:
http://sourceforge.net/projects/serializerclass/
a serializer class. Is this the best method?Sorry, I should have explained, we already use XML for data
transfers (though I personally find JSON much nicer with less
overhead). So, in this project, we use XML for data transfer
between flash and PHP/Database. The reason I wanted this
functionality, is because the flash array, in this one case, will
be completely dynamic and the PHP doesn't need to know the contents
of the array at all. In fact, in this instance, PHP is just the
mechanism used for storing the data. Becuase of the nature of the
data, I wanted to serialize the flash array, store it in the
database as Bytecode, then when the flash needs that information
again, I can pass back the same bytecode, which can then be
unserialized back into the original array.
I think I've found the solution, the one I linked in the
original post. I should know if it's as effective as I want it to
be in the next couple of days when my flasher gives it a try. =]
Thanks for the responses. If anyone has any other ideas,
please throw them in here. -
My internet service provider is BT in the UK. The home page is www.btinternet.com. After I've logged on, the home page displays fine - I can see the summary of my emails in one of the windows on the home page. The problem comes when I click on the mail application. The page then tries to load the email application. However, it never actually loads, it keeps jumping between connected and waiting for login. It never achieves it so I just have to click the 'back' button to get to the home page. I use chrome and ie but neither has this problem.
I retraced my steps to how i got the Google app:
App Store icon on Home Screen > Search, at bottom > entered Google
The first Google App on the screen appears:
Google logo small g in blue square: Google Search; Open (because it is already installed). Below that is a picture of the iPod with the usual Google Search screen. I have never inserted a link into a discussion group so i hope you can open this.
http://https://itunes.apple.com/us/app/google-search/id284815942?mt=8
Does this bring us any closer? -
my mac is not accepting my name and password for login because it is in arabic how am i suppose to login? how do i type Mark Yap in arabic, im typing it in pressing the actual letters on the keyboard but wint accept it?
I am assuming that you are trying to log in with the English language. If this is the case (or any other language for that matter), see if there is a button on the login screen that allows you to change your language.
-
How to hide the Columns and Views for Login user in SharePoint 2013
Hi Friends,
How to hide the Columns and Views for Login user in SharePoint 2013? Is it possible using OOB features? If not possible how can we hide the Columns and Views for Login user?
Could you please help on this.
Thanks,
Tiru
TiruHello Tirupal,
There is no OOB way to do this.
Please check this codeplex solution to achieve the same.
https://sp2013columnpermission.codeplex.com/
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful -
Flash and PHP contact form.
Hi, I created a simple web site in flash cs4 with a contact form, however, when I press submit, no email is sent even though my site says it was successfully sent. If anyone could give any advice on what I could possibly being doing wrong that would be great.
Thanks, Anthony.
Here is my actionscript and PHP:
function submit(e:MouseEvent):void
var variables:URLVariables = new URLVariables();
variables.fromname = nameText.text;
variables.fromemail = emailText.text;
variables.frommessage = messageText.text;
var req:URLRequest = new URLRequest("contact.php");
req.data = variables;
req.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, sent);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.load(req);
statusText.text = "Sending...Please wait.";
function sent(e:Event):void
statusText.text = "Your email has been sent.";
nameText.text = emailText.text = messageText.text = "";
function error(e:IOErrorEvent):void
statusText.text = "Error, please try again.";
sendButton.addEventListener(MouseEvent.CLICK, submit);
PHP:
<?php
$sendTo = "[email protected]( I am aware this needs to be different)";
$subject = "Email from Web site";
$name = $_POST['fromname'];
$from = $_POST['fromemail'];
$message = $_POST['frommessage'];
$message = stripslashes($message);
$content = "Name: " . $name . "\n";
$content .= "Email: " . $from . "\n\n";
$content .= $message;
if (mail($sendto,$subject,$content))
echo 'response=passed';
else
echo 'response=failed';
?>I had the correct case in my code, so that was not the problem. It appears that the there is no communication with the server. Do you have any other ideas as to why the send button would not actually being contacting the server?
Thanks for the help -
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
Issue:
Cisco firewalls require only one level of password i.e. the domain username and password are used for both logging in as well as reaching global configuration mode.
Background:
We have multiple Cisco network devices set up which authenticate to our Windows domain controller using NPS (Windows 2008 R2). The switches we have set up all function exactly as we would hope as they require your domain username and password to login to the device. They then require a separate password when you use the enable command, this is stored in Active Directory:
Switches:
Username:domain-username
Password:domain-password
SWITCH>enable
Password:enable-password-in-Active-Directory
SWITCH#
Firewalls (as they currently are):
Username:domain-username
Password:domain-password
FIREWALL>enable
Password:domain-password
FIREWALL #
With the firewalls however, they require your domain username and password first, and then your domain password again when using the enable command. I want the firewalls to use the enable level password that the switches currently use instead of the domain password again. The current configuration look like the following:
Current switch configuration:
aaa new-model
aaa authentication login default group radius local
aaa authentication enable default group radius enable
aaa authorization exec default group radius local
aaa session-id common
radius-server host 192.168.0.1 auth-port 1645 acct-port 1646
radius-server source-ports 1645-1646
radius-server key 7 1234abcd
Current firewall configuration:
aaa-server DC01 protocol radius
aaa-server DC01 (outside) host 192.168.0.1
aaa authentication ssh console DC01 LOCAL
aaa authentication enable console DC01 LOCAL
key 1234abcd
Any help would be great, thanks!Cisco ASA works that way by design. You could remove "aaa authentication enable" and then you could use the "enable password" command to set your enable password.
But if you do that, then ASA would change your username to "enable_15". That would break Authorization and Accounting if you're using them. Let me clarify with an example
Firewalls :
Username:domain-username
Password:domain-password
FIREWALL>show curpriv
Username : domain-username
Current privilege level : 1
Current Mode/s : P_UNPR
FIREWALL>enable
Password:enable-password-from-running-config
FIREWALL #show curpriv
Username : enable_15
Current privilege level : 15
Current Mode/s : P_PRIV
If you're using Authorization and Accounting it's recommended to stick with your current behavior. -
Field and Table for PGI status updation
Hi All,
I want to know in which field and table the PGI status will get updated.
i.e. once we do the PGI for a delivery in which table will this PGI status gets updated.
Thanks in advance for help.
HariniHi Harini,
In Table VBUK you 3 different status related fields for sales documents.
Over all status field name GBSTK ( here it gives the total status of praticular sales document) here you see options
A Not yet processed ( This means its complete open)
B Partially processed ( This means the sales doc is partially processed)
C Completely processed ( This means the sales doc is completly processed)
Delivery status and over all delivery status field name LFSTK and LFGSK respectively, these 2 fields will be same always ( here it gives the total status of praticular sales document) here you see options
A Not yet processed ( This means its completly open)
B Partially processed ( This means the delivery doc is partially processed)
C Completely processed ( This means the delivery doc is completly processed)
So overall status can be different then delivery or overall delivery status.
If sales document has 100 quantity for 1 material, if delivery is done for 50 quantity.
Then over all status field name GBSTK will be B Partially processed and delivery and overall delivery will be C Completely processed .
Regards
vK -
Creating a login page in php for login to certain pages in the website
I need to create a login page where I would assign user a password and when they input the password it would take them to pages only accesabile by that password. Can someone lead me to some good articles on how to do this? Everyting I have found so far doesn't seem to make sense or the coding doesn't work right when I input it into my html and php pages.
Thank you.The simplest method is to add .htaccess and .htpasswd text files to the protected folder of your site.
http://www.javascriptkit.com/howto/htaccess3.shtml
http://www.panix.com/web/faq/htaccess.html
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
Using databases with Flash and PHP
Hi, everyone!
I`m a PHP newbie. I just learned PHP so that I can use
databases with Flash.
I`ve got a .php script that contains html that loads up my
.swf file. The .swf file is the core of my site. What I want to
know is if I can call some PHP functions (that I have wrote in the
.php script) from within the .swf file... This functions would
perform the reading and updating of my database.
The only way I know of to modify a database from Flash is
using the POST and GET methods. But that opens up a new browser
window in which the PHP script is called. And that only handles
writing in the database. So, what if I just want to read from the
database some values and insert them into a TextField in Flash? How
do I do that?
Thanks! Ardy1. Goggle "Flash and mySQL" and you'll get a listing of alot
tutorials
2. I'm also just learning. Here's a great URL to start:
Building with Flash and MySQL
That's right, a Flash-based blog — it sounds a little
loony, but this blog pulls content from a MySQL database and feeds
it into the dynamic Flash frontend ...
www.webmonkey.com/programming/php/tutorials/tutorial2.html -
20k - Cached - -
Flash and SEO for Ecommerce Web Design
Hi
I am working with a web design company in the UK and was wondering if there are any indications of when Flash could be recognised by Google?
This is a major issue as the design features are fantastic but SEO is a nightmare.
I would love to introduce it within our ecommerce web design solutions, but only when the issue is resolved.
Message was edited by host to remove linksIn SEO terms, content is king. Basically, if you have no HTML headings and text on your web pages, there's nothing much for search engines to grab onto. No content = no traffic.
Flash is invisible to SEs, translators, screen readers, iPhones/iPads, and many other web devices. To support the widest possible audience, you might want to re-think your need for Flash and switch to HTML. Almost anything you can do with Flash can be done reasonably well with jQuery (JavaScript) http://jquery.malsup.com/cycle/
Your other option is SWF Object Replacement along with HTML equivalents for SEs and devices that don't support Flash.
http://code.google.com/p/swfobject/
Google's SEO Starter Guide (PDF)
http://www.google.com/webmasters/docs/search-engine-optimization-starter-guide.p df.
Good luck with your project,
Nancy O.
Signature deleted by host -
Highscore list using Flash and PHP
Hi,
I want to make a highscorelist using AS3 and PHP(MySQL).
I cant find a good tutorial on internet how to make something like that but I got this so far:
import fl.controls.TextInput;
import fl.controls.TextArea;
var variables:URLVariables = new URLVariables();
variables.name = "Wil";
variables.final = 2000;
var request:URLRequest = new URLRequest();
////insert in the location of the php script ////////////////
request.url = "http://www.justenter.nl/script.php";
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.load(request); //sends the request
//when the request is done loading, it goes to the completeWriting function
loader.addEventListener(Event.COMPLETE, completeWriting);
function completeWriting(event:Event):void {
var writingCompleted:TextField = new TextField;
writingCompleted.autoSize = "center";
writingCompleted.x =200;
writingCompleted.y= 200;
writingCompleted.text = event.target.data;
addChild(writingCompleted);
He is sending the score and name to the database but he is doing that when i press ctrl-enter. He is sending the data I have given in:
variables.name = "Wil";
variables.final = 2000;
I want a input textfield and a button. And When I fill in my name in the input textfield he send it to the database when I press the button.
Is there someone that can help me out?
Tnximport fl.controls.TextInput;
import fl.controls.TextArea;
var variables:URLVariables = new URLVariables();
//variables.name = "Wil";
//variables.final = 2000;
var request:URLRequest = new URLRequest();
////insert in the location of the php script ////////////////
request.url = "http://www.justenter.nl/script.php";
request.data = variables;
var loader:URLLoader = new URLLoader();
submitBtn.addEventListener(MouseEvent.CLICK,submitF); // where submitBtn is your button
function submitF(e:Event){
variables.name=nameTF.text; // where nameTF is your input texfield
variables.final = score; // where score is the variable you use to tally user score
loader.load(request); //sends the request
//when the request is done loading, it goes to the completeWriting function
loader.addEventListener(Event.COMPLETE, completeWriting);
function completeWriting(event:Event):void {
var writingCompleted:TextField = new TextField;
writingCompleted.autoSize = "center";
writingCompleted.x =200;
writingCompleted.y= 200;
writingCompleted.text = event.target.data;
addChild(writingCompleted); -
I have a php code that talks back to my flash movie on "post"
however I have recently added a more advanced feature and need some
help altering the code to work.
Right now the code is as such and works great because the
message var. is located in the root of the movie:
$message = $subscribe_message;
But now I need the script to look in a MC called "newsPop"
for the message var. I used a code similair to flash as such but
did not work.
$newsPop.message = $subscribe_message;
Can someone please help me alter the code to work and look in
the MC for the Var - remeber this is PHP code.
Thanks in advance!don't change your php script.
you can change your flash so your movieclip checks the _root
timeline for the variable or change the way you call your php
script so the variable is defined on your movieclip's
timeline. -
I have a login form (i have a mysql database and everything
set up) and the login button simply has the AS:
on (release) {
loadVariablesNum("login.php", 0, "POST");
but i don't know what else to add to make it so if you're a
registered user (which i already have a form of) then it will go to
the next frame, and if not registered, it keeps unregistered users
out.
please help, thanksfirst off, i wouldn't put any code directly on a button. it
might seem easy to you now, but in the future you will probably
find yourself wondering where the code is. it's much better to have
all your code in a single frame on the main timeline.
second, don't use loadVariablesNum(). Try using
LoadVars.sendAndLoad() instead. Assuming you have given your login
button an instance name of 'loginButton', it might look something
like this:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
for (varName in result_lv) {
trace(varName + '=' + result_lv[varName]);
} else {
trace("Error connecting to server.");
var send_lv:LoadVars = new LoadVars();
send_lv.username = 'myUsername';
send_lv.password = 'myPassword';
send_lv.sendAndLoad("https://yourdomain.com/login.php",
result_lv, "POST");
loginButton.addEventListener("click", submitListener);
Maybe you are looking for
-
I have over 16.000 duplicated addresses in my address book how do I get rid of them?
Mac osx 10.9.5.... 2.4GHz core duo.. 4 GB 800 MHz DDR2 SDRAM. I have over 16.000 cards in my address book.... due to duplicates I should have less then 1000? how do I fix this?
-
I recently had my account expire, and need to utilize the trial to finish a project. Even though my account says 'free trial' the applications will not open. How do I get the APP to recognize that I'm in trial and not expired?
-
My 6500 Slide is showing all numbers as "Private N...
Hi, Although I have updated Software, My 6500 is showing all numbers as private number. Can anyone help me on this stuff ? Regards, Amjad
-
I have an iPod nano but can't find the Nike . Is there something I need to buy?
I have an iPod Nano, but I can't find the Nike+ option. Is there something I need to buy?
-
Query - Delivered quantity at schedule line of Sales Order
Hi, I've realized a sales order report and i need extract for each schedule line the delivered quantity (VBEPD-VSMNG). How can i find the correct values? Thanks and best regards. Antonio