|
|
@@ -1,3 +1,9 @@ |
|
|
|
#include "./modules/http.mod.hsp" |
|
|
|
|
|
|
|
|
|
|
|
#ifndef __USER__ |
|
|
|
#define __USER__ |
|
|
|
|
|
|
|
#module \ |
|
|
|
User |
|
|
|
|
|
|
@@ -6,59 +12,35 @@ User |
|
|
|
|
|
|
|
#deffunc local \ |
|
|
|
Create \ |
|
|
|
str p_name,\ |
|
|
|
local l_res,\ |
|
|
|
local l_size,\ |
|
|
|
str p_name, |
|
|
|
local l_data |
|
|
|
HTTPLoad CREATE_URL + "?name=" + p_name |
|
|
|
|
|
|
|
If stat = 0 { |
|
|
|
Repeat |
|
|
|
HTTPInfo l_res, HTTPINFO_MODE |
|
|
|
|
|
|
|
Switch l_res |
|
|
|
Case HTTPMODE_READY |
|
|
|
Case HTTPMODE_NONE |
|
|
|
Case HTTPMODE_ERROR |
|
|
|
Break |
|
|
|
SwEnd |
|
|
|
|
|
|
|
Wait 5 |
|
|
|
Loop |
|
|
|
|
|
|
|
If l_res = HTTPMODE_READY { |
|
|
|
HTTPInfo l_size, HTTPINFO_SIZE |
|
|
|
Fetch@Http CREATE_URL + "?name=" + p_name |
|
|
|
|
|
|
|
SDim l_data, l_size |
|
|
|
If status@Http = STATUS_SUCCESS@Http { |
|
|
|
Split data@Http, ",", l_data |
|
|
|
|
|
|
|
HTTPInfo l_data, HTTPINFO_DATA |
|
|
|
Split l_data, ",", l_data |
|
|
|
|
|
|
|
id = l_data.0 |
|
|
|
pass = l_data.1 |
|
|
|
inheritanceCode = l_data.2 |
|
|
|
|
|
|
|
Return |
|
|
|
} |
|
|
|
id = Int (l_data.0) |
|
|
|
pass = l_data.1 |
|
|
|
inheritanceCode = l_data.2 |
|
|
|
} |
|
|
|
Else { |
|
|
|
id = 0 |
|
|
|
pass = "" |
|
|
|
inheritanceCode = "" |
|
|
|
} |
|
|
|
|
|
|
|
id = 0 |
|
|
|
pass = "" |
|
|
|
inheritanceCode = "" |
|
|
|
|
|
|
|
Return -1 |
|
|
|
Return |
|
|
|
|
|
|
|
#deffunc local \ |
|
|
|
Fetch \ |
|
|
|
Auth \ |
|
|
|
int p_id,\ |
|
|
|
local l_data |
|
|
|
id = userId@Setting |
|
|
|
pass = userPasscode@Setting |
|
|
|
|
|
|
|
HTTPLoad StrF ("%s?id=%d&pass=%s", CREATE_URL, id, pass) |
|
|
|
HTTPInfo l_data |
|
|
|
|
|
|
|
Return |
|
|
|
|
|
|
|
#global |
|
|
|
|
|
|
|
#endif ; not __USER__ |
|
|
|
|