View Full Version : Loggin in using getURL

05-07-2008, 03:55 PM
Hey Kids,
got any tips on how to log a user into a website using a flash movie outside of a browser? i am writing an application which checks the users login information, once we've confirmed its correct, there a button that allow them to "check their account".

i want that button to open the page and POST their login information. getURL allows you to do thisvar strUserId = DB.data.userid;
var strPassword = DB.data.password;
getURL(this.url, dtc.name, "POST");but unfortunately when i check the header information, nothing happens because the URL is set as GET, not POST.

05-07-2008, 04:07 PM
test it as a projector .. or open the published swf via the latest flash player instead of using test movie.. because when you use test movie .. it only emulates GET.. so any calls to POST will be translated as get in the test environment..

05-08-2008, 07:35 PM
What I ended up having to do was dynamically create an html file that used JavaScript to log the user in and set the target too a new window

function logUser (uri, uI, uP)
var htmlFile = dtc.path + "logger.html";
var htmlStr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
htmlStr += '\n<html>';
htmlStr += '\n<head>';
htmlStr += '\n<title>Trimark Live Toolbar: Initiating Login</title>';
htmlStr += '\n<script language="javascript">';
htmlStr += '\nfunction goLogin() {';
htmlStr += '\ndocument.login.submit();';
htmlStr += '\n}';
htmlStr += '\n</script>';
htmlStr += '\n</head>';
htmlStr += '\n<body onload="goLogin();">';
htmlStr += '\n<form name="login" target="' + dtc.name + '" method="post" action="http://www....">';
htmlStr += '\n<input type="hidden" name="strUserId" value="' + uI + '">';
htmlStr += '\n<input type="hidden" name="strPassword" value="' + uP + '">';
htmlStr += '\n<input type="hidden" name="elocation" value="' + uri + '">';
htmlStr += '\n</form>';
htmlStr += '\n</body>';
htmlStr += '\n</html>';

mFile.writeString(htmlFile, htmlStr);

var formWindow = mApplication.createMediaWindow(htmlFile, -1, -1, 1, 1);

I am using mProjector so mFile and mApplication are methods of that Class