summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/commands/ucp.txt11
-rw-r--r--npc/functions/util.txt16
2 files changed, 16 insertions, 11 deletions
diff --git a/npc/commands/ucp.txt b/npc/commands/ucp.txt
index aeaf805a0..7bda91a7b 100644
--- a/npc/commands/ucp.txt
+++ b/npc/commands/ucp.txt
@@ -20,7 +20,7 @@ function script UserCtrlPanel {
select
l("Rules"),
l("Game News"),
- rif(is_admin(), l("Create PIN Number")),
+ rif(#FIRST_TIME == 1, l("Create PIN Number")),
l("Account Information"),
rif(getcharid(2) > 0, l("Guild Information")),
l("Change Language"),
@@ -34,9 +34,10 @@ function script UserCtrlPanel {
case 2: GameNews(); break;
case 3:
// Account age check
- if (#REG_DATE < gettimetick(2)+86400*15) {
+ if (gettimetick(2) < #REG_DATE+86400*15) {
mesc l("Your account is too young."), 1;
mesc l("The accounts need 15 days to set Pin Codes."), 1;
+ next;
break;
}
mes l(".:: Create PIN Code ::.");
@@ -56,8 +57,12 @@ function script UserCtrlPanel {
mes "";
.@msg$=json_encode("date", gettimetick(2),
"accid", getcharid(3),
- "pin", rand2(1000));
+ "pin", rand2(10000));
+ debugmes .@msg$;
api_send(302, .@msg$);
+ #FIRST_TIME=2;
+ mesc l("PinCode created, an email should arrive within 15 minutes."), 3;
+ next;
break;
case 4:
if (!validatepin())
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index a46f9b3ba..99dc2045f 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -1019,7 +1019,7 @@ function script json_encode {
if (getargcount() < 2 || getargcount() % 2 != 0)
return Exception("json_encode arguments must be paired");
- .@json="{";
+ .@json$="{";
.@tab=true;
// For arguments
@@ -1028,24 +1028,24 @@ function script json_encode {
if (.@tab)
.@tab=false;
else
- .@json+=",";
+ .@json$+=",";
// Input variable name
- .@json+="\""+getarg(.@i)+"\": ";
+ .@json$+="\""+getarg(.@i)+"\": ";
// Input variable value
if (isstr(getarg(.@i+1)))
- .@json+="\""+getarg(.@i+1)+"\"";
+ .@json$+="\""+getarg(.@i+1)+"\"";
else
- .@json+=getarg(.@i+1);
+ .@json$+=getarg(.@i+1);
// Advance
.@i++;
}
// Close the JSON
- .@json+="}";
- return .@json;
+ .@json$+="}";
+ return .@json$;
}
@@ -1053,7 +1053,7 @@ function script json_encode {
// sends to API
function script api_send {
.@cde=getarg(0);
- .@fm$=getarg(1);
+ .@fm$=escape_sql(getarg(1));
query_sql("INSERT INTO `api_export` (`type`, `data`) VALUES ('"+.@cde+"', \""+.@fm$+"\")");
return;
}