LoginWrenchPromoAccount
This commit is contained in:
@@ -2480,8 +2480,73 @@ long WrenchTestWalletCapability(CVars in, CVars &out){
|
|||||||
long LoginWrenchPromoAccount( CVars in, CVars &out ){
|
long LoginWrenchPromoAccount( CVars in, CVars &out ){
|
||||||
long ret = PHP_API_BAD_PARAM;
|
long ret = PHP_API_BAD_PARAM;
|
||||||
logfmt(logINFO, "LoginWrenchPromoAccount()");
|
logfmt(logINFO, "LoginWrenchPromoAccount()");
|
||||||
|
CVars x;
|
||||||
|
CVars y;
|
||||||
|
CVars p;
|
||||||
|
CVars inx;
|
||||||
|
|
||||||
return 0;
|
try {
|
||||||
|
REQ_STRING(in, "promo_owner", 2, 149, "(.*)");
|
||||||
|
REQ_STRING(in, "promo", 2, 49, "(.*)");
|
||||||
|
REQ_STRING(in, "password", 8, 25, "(.*)");
|
||||||
|
const char * loc = getenv("REMOTE_ADDR");
|
||||||
|
|
||||||
|
load_db_record( p, "SELECT md5('%s') AS password_md5, 'NG' AS country ", in["password"].c_str());
|
||||||
|
|
||||||
|
if ( load_db_record(y, "SELECT firstname , lastname , middlename , status,email FROM market_import WHERE uid::text ='%s' AND status = 1", y["promo_owner"].c_str())> 0){
|
||||||
|
if ( load_db_record(out, "SELECT id FROM members WHERE LOWER(username) = LOWER('%s')", x["username"].c_str())> 0){
|
||||||
|
out["status_message"] = "INVALID_LINK";
|
||||||
|
return PHP_API_BAD_PARAM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out["status_message"] = "VALID_LINK_FOUND";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
out["status_message"] = "VALID_LINK_NOT_FOUND";
|
||||||
|
return PHP_API_BAD_PARAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
x["username"] = y["email"];
|
||||||
|
x["username"].set_valid(true);
|
||||||
|
x["firstname"] = y["firstname"];
|
||||||
|
x["firstname"].set_valid(true);
|
||||||
|
x["lastname"] = y["lastname"];
|
||||||
|
x["lastname"].set_valid(true);
|
||||||
|
x["email"] = y["email"];
|
||||||
|
x["email"].set_valid(true);
|
||||||
|
x["phone"] = y["phone"];
|
||||||
|
x["phone"].set_valid(true);
|
||||||
|
x["loc"] = loc;
|
||||||
|
x["loc"].set_valid(true);
|
||||||
|
x["country"] = p["country"];
|
||||||
|
x["country"].set_valid(true);
|
||||||
|
x["password"] = p["password_md5"];
|
||||||
|
x["password"].set_valid(true);
|
||||||
|
ret = insert_db_record(DBS_VALID, "members", "members_id_seq", x);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if ( load_db_record(out, "SELECT * FROM market_promo WHERE promo::text ='%s' ", in["promo"].c_str())> 0){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ( ret > 0 ){
|
||||||
|
inx["username"] = x["username"]; inx["username"].set_valid( true );
|
||||||
|
inx["password"] = x["password"]; inx["password"].set_valid( true );
|
||||||
|
inx["sessionid"] = "THIS-IS-DUMMY-INSURANCE"; inx["sessionid"].set_valid( true );
|
||||||
|
inx["loc"] = loc; inx["loc"].set_valid( true );
|
||||||
|
return LoginWrenchBoardAccount(inx, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ret = PHP_API_OK;
|
||||||
|
out["status"] = "OK";
|
||||||
|
} catch (bad_parameter) {
|
||||||
|
logfmt(logINFO, "ERROR CALL long LoginWrenchPromoAccount(CVars in, CVars &out)");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
long LoginWrenchBoardAccount(CVars in, CVars &out) {
|
long LoginWrenchBoardAccount(CVars in, CVars &out) {
|
||||||
|
|||||||
Reference in New Issue
Block a user