PDA

View Full Version : Get folder on the net if email and username = true.


Ham
06-06-2006, 10:51 AM
Hello All

Am stuck with this script.

i got 2 input objects and 1 button.

input1: email
input2: password
btn: Go

On click (btn go)
-- Retrieve Username and Password
sEmail = Input.GetText("Input_Email");
sPassword = Input.GetText("Input_Password");

-- Convert user/pass combo to MD5 digests
sUsernameMD5 = Crypto.MD5DigestFromString(sUsername);
sPasswordMD5 = Crypto.MD5DigestFromString(sPassword);

-- Initialize variables for submit action
sCheckScriptURL = "http://www.yordomein.com/check_user.php";
tValuesToPass = {email_md5 = sEmailMD5, password_md5 = sPasswordMD5};
nSubmitMethod = SUBMITWEB_POST;
nTimeout = 20;
nPort = 80;
tAuthData = nil;
tProxyData = nil;

-- Submit to the web
sResult = HTTP.Submit(sCheckScriptURL, tValuesToPass, nSubmitMethod, nTimeout, nPort, tAuthData, tProxyData);

-- Check the result ('1' is success)
if sResult == "1" then

end

So far so good, don't look at the if and then results.

I want to on the
-- Check the result ('1' is success)
if sResult == "1" then

to get the folder of the email,

Example: http://yordomein.com/emailfolder
In this folder there are ini files that get value's for the next page.

I hope you can help am really stuck int his one.
Many thanks:yes

TJS
06-06-2006, 01:36 PM
Do your INI files share a common name (i.e. config.ini)?

Regardless, your script will need to know the name of the target file or be able to dynamically generate it based on a known naming convention. Assuming that this is acceptable to you, I think the only piece left is to download the file from the appropriate directory.


-- Retrieve Username and Password
sEmail = Input.GetText("Input_Email");
sPassword = Input.GetText("Input_Password");

-- Convert user/pass combo to MD5 digests
sUsernameMD5 = Crypto.MD5DigestFromString(sEmail);
sPasswordMD5 = Crypto.MD5DigestFromString(sPassword);

-- Initialize variables for submit action
sCheckScriptURL = "http://www.yordomein.com/check_user.php";
tValuesToPass = {email_md5 = sEmailMD5, password_md5 = sPasswordMD5};
nSubmitMethod = SUBMITWEB_POST;
nTimeout = 20;
nPort = 80;
tAuthData = nil;
tProxyData = nil;
sDownloadURL = "http://www.yordomein.com/";
sINIFileName = "config.ini";

-- Submit to the web
sResult = HTTP.Submit(sCheckScriptURL, tValuesToPass, nSubmitMethod, nTimeout, nPort, tAuthData, tProxyData);

-- Check the result ('1' is success)
if sResult == "1" then
StatusDlg.Show();
HTTP.Download(sDownloadURL .. sEmail, sINIFileName, MODE_BINARY, nTimeout, nPort, tAuthData, tProxyData);
StatusDlg.Hide()
end


Hope this helps....

Ham
06-06-2006, 05:10 PM
Yes very nice, this is what am looking for. Still 1 Q i want to save it to the _SourceFolder.."\\AutoPlay\\Docs\\config.ini. But this aint work now, any idea?

Many Thanks TJS:yes

TJS
06-06-2006, 06:00 PM
That should have worked. AMS will also allow you to describe a folder on the local machine like this:

"autoplay\\docs\\config.ini"

When AMS sees this, it appends the above to the source folder automatically.

Your new code should look like this with a couple corrections I just noticed:

-- Retrieve Username and Password
sEmail = Input.GetText("Input_Email");
sPassword = Input.GetText("Input_Password");

-- Convert user/pass combo to MD5 digests
sUsernameMD5 = Crypto.MD5DigestFromString(sEmail);
sPasswordMD5 = Crypto.MD5DigestFromString(sPassword);

-- Initialize variables for submit action
sCheckScriptURL = "http://www.yordomein.com/check_user.php";
tValuesToPass = {email_md5 = sEmailMD5, password_md5 = sPasswordMD5};
nSubmitMethod = SUBMITWEB_POST;
nTimeout = 20;
nPort = 80;
tAuthData = nil;
tProxyData = nil;
sDownloadURL = "http://www.yordomein.com/";
sINIFileName = "config.ini";
sINIDestinationFolder = "AutoPlay\\Docs\\";

-- Submit to the web
sResult = HTTP.Submit(sCheckScriptURL, tValuesToPass, nSubmitMethod, nTimeout, nPort, tAuthData, tProxyData);

-- Check the result ('1' is success)
if sResult == "1" thenStatusDlg.Show();
HTTP.Download(sDownloadURL .. sEmail .. "/" .. sINIFileName, sINIDestinationFolder .. INIFileName, MODE_BINARY, nTimeout, nPort, tAuthData, tProxyData);
StatusDlg.Hide()end

Ham
06-06-2006, 06:21 PM
Many thanks TJS.

But it comes back with a error: On click, Line 26: attempt to concatenate global 'iNIfileName' (a nil value)

I tryed: HTTP.Download(sDownloadURL .. sEmail .. sINIDestinationFolder, sINIFileName, MODE_BINARY, nTimeout, nPort, tAuthData, tProxyData);

But the inifile don't show up.

Many Thanks:yes

TJS
06-06-2006, 10:03 PM
You should see the issue on line 26. The variable we are using should be exactly sINIFileName. AMS is case sensitive when it comes to variable names.

It might be easier if you repost a larger section of the script you have so far.

It can also be helpful to use the action properties dialog to fill in the arguments. Try double clicking on HTTP.Download() in the script editor and see how everything looks from there.

Ham
06-08-2006, 09:07 PM
Thanks for your replay TJS.
Before i post it i want to say that i am trying to create some kind of messenger. Not the messenger that was posted before but a messenger with server site function. something like MSN. The script you helped me with is the loggin script. Something like verify your email and pass then load up your contacts etc.

This is the first page:

Email:Input_Email
Pass: Input_Password


Loggin btn:
-- Retrieve Username and Password
sEmail = Input.GetText("Input_Email");
sPassword = Input.GetText("Input_Password");

-- Convert user/pass combo to MD5 digests
sUsernameMD5 = Crypto.MD5DigestFromString(sUsername);
sPasswordMD5 = Crypto.MD5DigestFromString(sPassword);

-- Initialize variables for submit action
sCheckScriptURL = "http://www.yordomein.com/check_user.php";
tValuesToPass = {email_md5 = sEmailMD5, password_md5 = sPasswordMD5};
nSubmitMethod = SUBMITWEB_POST;
nTimeout = 20;
nPort = 80;
tAuthData = nil;
tProxyData = nil;
sDownloadURL = "http://www.yordomein.com";
sINIFileName = "config.ini";
sINIDestinationFolder = "AutoPlay\\Docs\\";

-- Submit to the web
sResult = HTTP.Submit(sCheckScriptURL, tValuesToPass, nSubmitMethod, nTimeout, nPort, tAuthData, tProxyData);

-- Check the result ('1' is success)
if sResult == "1" then
StatusDlg.Show();
HTTP.Download(sDownloadURL .. sEmail .. sINIDestinationFolder, sINIFileName, MODE_BINARY, nTimeout, nPort, tAuthData, tProxyData);
StatusDlg.Hide()

Page.Jump("Page1");
else

end


On the second page it loads the config.ini, and set all your contacts etc.

If you want the .apz let me know.

Many thanks:yes