PenUltima Online

It is currently Fri Oct 10, 2008 4:30 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Return password & changemail www scripts...
PostPosted: Wed Oct 03, 2007 3:33 am 
Offline

Joined: Sat Mar 18, 2006 1:41 am
Posts: 92
Location: World Earth
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:

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 9:40 am 
Offline

Joined: Sat Aug 05, 2006 11:43 am
Posts: 176
I am not at my code computer right now but try putting this right under when you declare the first variables.

Code:
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 3:28 am 
Offline

Joined: Sat Mar 18, 2006 1:41 am
Posts: 92
Location: World Earth
Check e-mail I have done!

Code:
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:
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!!

Quote:
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!!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 11:06 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 772
Location: Chicago, IL USA
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);


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 2:28 pm 
Offline

Joined: Sat Mar 18, 2006 1:41 am
Posts: 92
Location: World Earth
CWO, thanks, I has got rided this error:

Quote:
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!:
Quote:
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!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 10:48 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 772
Location: Chicago, IL USA
Code:
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:
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 06, 2007 2:46 am 
Offline

Joined: Sat Mar 18, 2006 1:41 am
Posts: 92
Location: World Earth
Thankx CWO, you are realy professional scripter!!! Bigest thank for u!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl