· 7 years ago · Dec 05, 2018, 10:28 PM
1prontera,168,190,3 script Painel de Controle#1-1 902,{
2
3 //Cooldown bruteforce prevent for password - in seconds
4 set .@pin_cooldown, 60;
5
6 //Max input for password
7 set .@max_pin, 9999;
8 set .@min_pin, 1000;
9
10 //Ask for password again if already were auth? 0 = Yes. 1 = No.
11 set .@cp_authrc, 0;
12
13 //Max attempts to auth
14 set .@cp_maxattp, 4;
15
16 query_sql("SELECT `user_pass` FROM `login` WHERE `account_id`="+getcharid(3)+" LIMIT 1",@acc_pin);
17
18 mes "[Painel de Controle]";
19 mes "Olá, ^FF0000"+strcharinfo(0)+"^000000";
20 mes "Deseja acessar seu painel de controle?";
21 next;
22 if(select("^00B2EE[ • ]^000000 Sim.:^CD0000[ • ]^000000 Não.")==2) close;
23
24 //Cooldown output
25 if( #CP_pindelay > gettimetick(2) )
26 {
27 mes "[Painel de Controle]";
28 mes "Você errou sua senha mais de ^FF0000"+.@cp_maxattp+"^000000 vezes.";
29 mes "Tempo restante para poder acessar o painel novamente: ^FF0000"+callfunc("Time2Str",#CP_pindelay)+"^000000";
30 close;
31 }
32
33 //PIN detected, ask for check
34 //if( @acc_pin && !@cp_canpass )
35 //{
36 // mes "[Painel de Controle]";
37 // mes "Insira sua senha.";
38 // mes "Máximo número de tentativas: ^FF0000"+.@cp_maxattp+"^000000";
39 // mes "Tentativas falhas: ^FF0000"+#CP_trycount+"^000000";
40 // next;
41 // input @try_pid;
42 //
43 // //Wrong PIN
44 // if(@try_pid !=@acc_pin)
45 // {
46 // set #CP_trycount, #CP_trycount+1;
47 // mes "[Painel de Controle]";
48 // mes "Senha incorreta.";
49 // mes "Tentativas falhas: ^FF0000"+#CP_trycount+"^000000";
50 //
51 // //Over attempted
52 // if(#CP_trycount >= .@cp_maxattp)
53 // {
54 // set #CP_trycount, 0;
55 // set #CP_pindelay, gettimetick(2) + .@pin_cooldown;
56 // mes "Seu acesso ao painel foi bloqueado por ^FF0000"+(.@pin_cooldown/60)+" minuto(s).^000000";
57 // }
58 // close;
59 // }
60 //
61 // //PIN matches
62 // else
63 // {
64 // set #CP_trycount, 0;
65 // mes "[Painel de Controle]";
66 // mes "Senha correta.";
67 // mes "^0000FFVocê agora está autenticado^000000.";
68 // next;
69 // }
70 //}
71
72 //Auth is OK, you are allowed to access CP
73 set @cp_canpass, .@cp_authrc;
74
75 //Fill account data
76 query_sql("SELECT `userid`,`email` FROM `login` WHERE `account_id`="+getcharid(3)+"", @userid$, @email$);
77
78 mes "[^3240C0Painel de Controle^000000]";
79 mes "Login: ^FF0000"+@userid$+"^000000";
80 mes "E-mail: ^FF0000"+@email$+"^000000";
81 mes "";
82
83 if( !getgroupid() )
84 {
85 mes "^FF0000Você não é um usuário VIP^000000.";
86 }
87
88 else if(getgroupid() == 1)
89 {
90 mes "^FF0000Você é um usuário VIP^000000.";
91 }
92
93 mes "";
94 mes "Oque deseja fazer?";
95 next;
96
97
98 switch(select("^00B2EE[ • ]^000000 Trocar Senha","^00B2EE[ • ]^000000 Trocar E-mail",""))
99 {
100
101 mes "[^3240C0Painel de Controle^000000]";
102
103 //Pass change
104 case 1:
105 mes "Senha atual: ^FF0000"+@user_pass$+"^000000";
106 mes "Insira nova senha.";
107 mes "^FF0000Nova senha deve ter no mÃnimo 4 digitos e no máximo 20.^000000.";
108 next;
109 input @try_pass$;
110 mes "[^3240C0Painel de Controle^000000]";
111 if(getstrlen(@try_pass$) < 4 || getstrlen(@try_pass$) > 20 || callfunc("strcheck_spell",@try_pass$) )
112 {
113 mes "Senha inválida.";
114 close;
115 }
116 mes "Senha escolhida: ^0000FF"+@try_pass$+"^000000";
117 mes "Você deseja realmente trocá-la?";
118 next;
119 if(select("^CD0000[ • ]^000000 Não.:^00B2EE[ • ]^000000 Sim.")==1) close;
120 query_sql("UPDATE `login` SET `user_pass`='"+escape_sql(@try_pass$)+"' WHERE `account_id`="+getcharid(3)+" LIMIT 1");
121 mes "[^3240C0Painel de Controle^000000]";
122 mes "Senha trocada com sucesso.";
123 mes "Nova senha: ^0000FF"+@try_pass$+"^000000";
124 break;
125
126 //Mail change
127 case 2:
128 mes "Email atual: ^FF0000"+@email$+"^000000";
129 mes "Insira novo email.";
130 mes "^FF0000Sem o servidor do email, no caso se o email for usuario@servidor.com.br você deve digitar apenas o usuario^000000";
131 next;
132 input @try_email$;
133 mes "[^3240C0Painel de Controle^000000]";
134 mes "Qual o servidor do email? Escolha um da lista ou a opção para digitar o servidor de seu email.";
135 next;
136 switch(select("^00B2EE[ • ]^000000 @hotmail.com","^00B2EE[ • ]^000000 @gmail.com","^00B2EE[ • ]^000000 Digitar Servidor"))
137 {
138 case 1: set @at_mail$, "@hotmail.com"; break;
139 case 2: set @at_mail$, "@gmail.com"; break;
140
141 default:
142 mes "Digite seu servidor de email, no caso se o email for usuario@servidor.com.br você deve digitar apenas o @servidor.com.br correspondente ao seu. (Ex: @uol.com.br, @yahoo.com, etc)";
143 input @try_at$;
144 if( !compare(@try_at$,"@") )
145 {
146 mes "[^3240C0Painel de Controle^000000]";
147 mes "Email inválido.";
148 mes "Você deve utilizar @servidor.com.br (Ex: @uol.com.br, @yahoo.com, etc). Não esqueça do @";
149 close;
150 }
151 set @at_mail$, @try_at$;
152 break;
153 }
154 set @try_email$, @try_email$ + @at_mail$;
155 next;
156 mes "Email escolhido: ^0000FF"+@try_email$+"^000000";
157 mes "Você deseja realmente trocá-lo?";
158 next;
159 if(select("^CD0000[ • ]^000000 Não.:^00B2EE[ • ]^000000 Sim.")==1) close;
160 query_sql("UPDATE `login` SET `email`='"+escape_sql(@try_email$)+"' WHERE `account_id` ="+getcharid(3)+" LIMIT 1");
161 mes "[^3240C0Painel de Controle^000000]";
162 mes "Email trocado.";
163 mes "Novo email: ^0000FF"+@try_email$+"^000000";
164 break;
165
166 }
167close;
168OnInit:
169 setarray .message$,
170 "[Painel de Controle]",
171 "[Trocar Senha]",
172 "[Trocar E-mail]";
173 set .message_size,getarraysize( .message$ );
174 while( .message_size ){
175 delwaitingroom;
176 waitingroom ""+.message$[ rand( .message_size ) ],0;
177 sleep 500;
178 end;
179}
180}
181
182//Function works in order to prevent special character strings on email, pass, whatever
183//Returns:
184//1 = Contains manned character
185//0 = Passed by, its clean
186
187function script strcheck_spell {
188
189 if( compare("%",getarg(0)) )
190 {
191 return 1;
192 }
193
194 return 0;
195}
196
197
198//Convert position login screen to array alocated position
199//Return:
200//-1: fail, isn't on the array
201//X: position in login screen
202
203function script index2alocpos {
204
205 for(set @j,0; @j < getarraysize(@cid_handle); set @j, @j+1)
206 {
207 if(getarg(0) == @pos_handle[@j])
208 {
209 //Return array pos
210 return @j;
211 }
212 }
213
214 //No matches found
215 return -1;
216
217}