Hi all,
I’m having a problem with this script that I’m adapting from a user & password to password with a URL attached, it was written by wu-tang.
The problem is that I don’t seem to be able to pull the URL from the Array. I don’t have a problem pulling the URL from the XML. I’m not sure what I’m doing wrong.
Any help would be appreciated.
EXTERNAL XML FILE
<books>
<book passTitle=“password0” password=“test0” title=“url0” SITE=“url/test0.txt”/>
<book passTitle=“password1” password=“test1” title=“url1” SITE=“url/test1.txt”/>
<book passTitle=“password2” password=“test2” title=“url2” SITE=“url/test2.txt”/>
<book passTitle=“password3” password=“test3” title=“url3” SITE=“url/test3.txt”/>
<book num=“accountnum” value=“4”/>
</books>
ACTION SCRIPT
// LOADS XML VARIABLES
var varsXML = new XML();
varsXML.onLoad = loadVars;
varsXML.load("test.xml");
// THIS ONCE PARSES THE XML INTO USABLE VARIABLES.
// THANKS TO VAGABOND FOR PROVIDING THE FRAME WORK FOR THIS ONE.
function loadVars(success) {
if (success) {
var people = varsXML.firstChild.firstChild;
i = 1;
while (people != null) {
eval(people.attributes.PASSTITLE) = people.attributes.PASSWORD;
eval(people.attributes.TITLE) = people.attributes.SITE;
if (people.attributes.NUM == 'accountnum') {
eval(people.attributes.NUM) = people.attributes.VALUE;
}
people = people.nextSibling;
trace(people);
trace("password = "+people.attributes.password);
trace("URL = "+people.attributes.SITE);
}
} else {
trace("errorLoadingXML");
}
setObj();
}
// TAKES ALL THE LOADED VARIALBES AND TURNS THEM.
// INTO OBJECTS FOR THE VERIFY FUNCTION.
function setObj() {
accounts = new Array();
for (i=0; i<accountnum; i++) {
accounts* = {site:this['site'+i], password:this['password'+i]};
}
}
// HERE ARE THE FUN LOVING FUNCTIONS!!!
// THIS ONE CHECKS TO SEE IF THE USER HAS ENTERED.
// A VALID PASSWORD.
function verify() {
goodpassword = 0;
for (i=0; i<=accounts.length; i++) {
j = 1;
for (password in accounts*) {
if (this['input'+j] == accounts*[password]) {
this['good'+password] = 1;
}
j++;
}
if (goodpassword == 1) {
getURL(accounts*[site]);
trace(yessssss!);
} else {
trace("noooooo");
}
}
}
// THIS ONE STOP'S
stop();
Thanks
halcyon32:)