Return password & changemail www scripts...

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am

Return password & changemail www scripts...

Post by Harley »

Hello everybody! I can't build this 2 scripts because when I use return password, my script doesn't search(not check, control) email. Look please and help me, maybe u got thoose scripts and give me it? Please, help!

Code: Select all


use util;
use polsys;
use http;
use uo;

program forgot_password()

var name := QueryParam( "account" );
var email := QueryParam( "email" );
var account := FindAccount( name );
var rightemail := account.getprop("CreatedEmail");

var ipaddr := QueryIP();

if ( !name || !email)
  writehtml("Account Name or Email was empty or invalid. Please Press Back and try again");
  return 0;
endif 

if ( !account)
WriteHtml("<br><b>Hm... are u realy wrote your account?!</b></br>");
return 0;
endif
if ( !rightemail)
WriteHtml("<br><b>Hm... is that your e-mail?!</b></br>");
return 0;
endif

account.SetPassword(part1());
WriteHtml("<html>");
WriteHtml(" <body>");
WriteHtml("<br><b>Your account : " +  name + "</b></br>");
WriteHtml("<br><b>Your new password : " +  part1() + "</b></br>");
WriteHtml("</body>");
WriteHtml("</html>");
endprogram

function part1()
var a, b, c, d, e, f, g, h, i, j;
var letters:={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
var letters2:={"1","2","3","4","5","6","7","8","9"};
a := letters[randomint(20)];
b := letters2[randomint(10)];
c := letters[randomint(20)];
d := letters2[randomint(10)];
e := letters[randomint(20)];
f := letters2[randomint(10)];
g := letters[randomint(20)];
h := letters2[randomint(10)];
i := letters[randomint(20)];
j := letters2[randomint(10)];
return a + b + c + d + e + f + g + h + i + j;
endfunction
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

I am not at my code computer right now but try putting this right under when you declare the first variables.

Code: Select all

function part1()
var a, b, c, d, e, f, g, h, i, j;
var letters:={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
var letters2:={"1","2","3","4","5","6","7","8","9"};
a := letters[randomint(20)];
b := letters2[randomint(10)];
c := letters[randomint(20)];
d := letters2[randomint(10)];
e := letters[randomint(20)];
f := letters2[randomint(10)];
g := letters[randomint(20)];
h := letters2[randomint(10)];
i := letters[randomint(20)];
j := letters2[randomint(10)];
return a + b + c + d + e + f + g + h + i + j;
endfunction
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am

Post by Harley »

Check e-mail I have done!

Code: Select all

if ( email != rightemail)
WriteHtml("<br><b>E-mail doesn't exists account!</b></br>");
return 0;
endif
But, when I get my password with this function:

Code: Select all

account.SetPassword(part1()); 
WriteHtml("<html>"); 
WriteHtml(" <body>"); 
WriteHtml("<br><b>Your account : " +  name + "</b></br>"); 
WriteHtml("<br><b>Your new password : " +  part1() + "</b></br>"); 
WriteHtml("</body>"); 
WriteHtml("</html>"); 
endprogram

.........

function part1() 
var a, b, c, d, e, f, g, h, i, j; 
var letters:={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; 
var letters2:={"1","2","3","4","5","6","7","8","9"}; 
a := letters[randomint(20)]; 
b := letters2[randomint(10)]; 
c := letters[randomint(20)]; 
d := letters2[randomint(10)]; 
e := letters[randomint(20)]; 
f := letters2[randomint(10)]; 
g := letters[randomint(20)]; 
h := letters2[randomint(10)]; 
i := letters[randomint(20)]; 
j := letters2[randomint(10)]; 
return a + b + c + d + e + f + g + h + i + j; 
endfunction

I have error!!
Your account : newacc

Your new password : lerror{ errortext = "Array index out of bounds" }p4oerror{ errortext = "Array index out of bounds" }nerror{ errortext = "Array index out of bounds" }serror{ errortext = "Array index out of bounds" }
I have error WITH password! :o please, if anyone can help me, please help!!!
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

You need to put +1 after every RandomInt otherwise it can pick 0 which causes those errors.
Example: letters[RandomInt(26)+1];

I also changed the 20 to 26 becuase theres 26 letters

Also, there's no need for the letters2 array if its all numbers. Just do something like

var b := CStr(RandomInt(9)+1);
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am

Post by Harley »

CWO, thanks, I has got rided this error:
error{ errortext = "Array index out of bounds" }
But! I have new error!

When at browser I gate one password, at /data/accounts.txt - a have other password!!!

Look please!:
This is at HTM
Your account : newacc

Your new password : p9h9s4t5k2

This is at accounts.txt
Account
{
Name newacc
Password m4m8o3o9v6
...........................................
}
please, help, thank u!
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Code: Select all

account.SetPassword(part1());
WriteHtml("<html>");
WriteHtml(" <body>");
WriteHtml("<br><b>Your account : " +  name + "</b></br>");
WriteHtml("<br><b>Your new password : " +  part1() + "</b></br>");
WriteHtml("</body>");
WriteHtml("</html>");
endprogram 
In this block of code, you're running part1() twice. The first time it generates a password and sets it to the account, the second time it generates another password and displays it to you. Change that block of code to this...

Code: Select all

var newpass := part1();
account.SetPassword(newpass);
WriteHtml("<html>");
WriteHtml(" <body>");
WriteHtml("<br><b>Your account : " +  name + "</b></br>");
WriteHtml("<br><b>Your new password : " +  newpass + "</b></br>");
WriteHtml("</body>");
WriteHtml("</html>");
endprogram 
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am

Post by Harley »

Thankx CWO, you are realy professional scripter!!! Bigest thank for u!!!
Post Reply