- Joined
- Apr 16, 2010
- Messages
- 83
- Reaction score
- 6
Thanks :laugh:oh yeah.. password isYou must be registered to see linksi forgot that onett1:
Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
Join Today!Thanks :laugh:oh yeah.. password isYou must be registered to see linksi forgot that onett1:
You mean: to change password, the user must type the PIN??
такое впечатление, что сдернули с pwi...
ahm... what? xD
Just said
Aren't you somehow connected to pwfrance stuff?)
ahm... what? xD
------------------
Hey hrace, I don't think that's necessary, it's just something more for the player remember... in my opinion, secret question, secret answer, e-mail and birthdate should be enough, especially if the change password must be confirmed in e-mail (wich only the owner will have access).
if it have PIN request i think it will more secure, but it was up to you, i just recomended it :tongue:
Now it haves a PIN, check the first post xD
BEGIN
DECLARE sn_old INTEGER;
DECLARE aid_old INTEGER;
DECLARE point_old INTEGER;
DECLARE cash_old INTEGER;
DECLARE status_old INTEGER;
DECLARE createtime_old DATETIME;
DECLARE time_old INTEGER;
DECLARE need_restore INTEGER;
DECLARE exists1 INTEGER;
DECLARE rowcount INTEGER;
START TRANSACTION;
SET error = 0;
SET need_restore = 0;
SELECT SQL_CALC_FOUND_ROWS sn, aid, point, cash, status, creatime INTO sn_old, aid_old, point_old, cash_old, status_old, createtime_old FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND sn >= 0;
SET rowcount = FOUND_ROWS();
IF rowcount = 1 THEN
SET exists1 = 1;
ELSE
SET exists1 = 0;
END IF;
IF status1 = 0 THEN
IF exists1 = 0 THEN
SELECT aid, point INTO aid1, point1 FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn1;
SET point1 = IFNULL(point1,0);
UPDATE point SET time = time-point1 WHERE uid = userid1 AND aid = aid1 AND time >= point1;
SET rowcount = ROW_COUNT();
IF rowcount = 1 THEN
UPDATE usecashnow SET sn = 0, status = 1 WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn1;
ELSE
SET error = -8;
END IF;
END IF;
ELSE
IF status1 = 1 THEN
IF exists1 = 0 THEN
UPDATE point SET time = time-point1 WHERE uid = userid1 AND aid = aid1 AND time >= point1;
SET rowcount = ROW_COUNT();
IF rowcount = 1 THEN
INSERT INTO usecashnow (userid, zoneid, sn, aid, point, cash, status, creatime) VALUES (userid1, zoneid1, sn1, aid1, point1, cash1, status1, now());
ELSE
INSERT INTO usecashnow SELECT userid1, zoneid1, IFNULL(min(sn),0)-1, aid1, point1, cash1, 0, now() FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND 0 >= sn;
SET error = -8;
END IF;
ELSE
INSERT INTO usecashnow SELECT userid1, zoneid1, IFNULL(min(sn),0)-1, aid1, point1, cash1, 0, now() FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND 0 >= sn;
SET error = -7;
END IF;
ELSE
IF status1 = 2 THEN
IF exists1 = 1 AND status_old = 1 AND sn_old = 0 THEN
UPDATE usecashnow SET sn = sn1, status = status1 WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn_old;
ELSE
SET error = -9;
END IF;
ELSE
IF status1 = 3 THEN
IF exists1 = 1 AND status_old = 2 THEN
UPDATE usecashnow SET status = status1 WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn_old;
ELSE
SET error = -10;
END IF;
ELSE
IF status1 = 4 THEN
IF exists1 = 1 THEN
DELETE FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn_old;
INSERT INTO usecashlog (userid, zoneid, sn, aid, point, cash, status, creatime, fintime) VALUES (userid1, zoneid1, sn_old, aid_old, point_old, cash_old, status1, createtime_old, now());
END IF;
IF NOT (exists1 = 1 AND status_old = 3) THEN
SET error = -11;
END IF;
ELSE
SET error = -12;
END IF;
END IF;
END IF;
END IF;
END IF;
IF need_restore = 1 THEN
UPDATE point SET time = time+point_old WHERE uid = userid1 AND aid = aid_old;
DELETE FROM usecashnow WHERE userid = userid1 AND zoneid = zoneid1 AND sn = sn_old;
INSERT INTO usecashlog (userid, zoneid, sn, aid, point, cash, status, creatime, fintime) VALUES (userid1, zoneid1, sn_old, aid_old, point_old, cash_old, status1, createtime_old, now());
END IF;
COMMIT;
END
$res = $mysqli->multi_query( "CALL usecash( $id , 1, 0, 1, 0, $amount, 1, @error);SELECT @error" );
error:
0. success;
-1: Unknown error;
-2. The account does not exist;
-3: Connection account server failed;
-4: Failed to send data to the account server;
-5: Account server did not return;
-6: The game server does not exist or does not start;
-7: The user has gold ingot being allocated, has been placed in the queue;
-8. charging zone or the allocated amount less than the balance of error, has been placed in the queue;
-9: call sequence error, the current state is not 1;
-10: call sequence error, the current state is not 2;
-11: call sequence error, the current state is not 3;
-12: Call the order of the error, no such records;
-13: to obtain the serial number the game server sends the request failed;
-14: transfer to the game server sends the request failed;
-15: to get the serial number to game server timeout;
-16: game server failed to get the serial number;
-17: game server allocation failed;
-18: game server gold ingot insufficient funds;
something like a queue, yes...
just don't ever think of going around that procedure.. it has many failsafe functions.
you can call it from php via mysqli multi_query
Code:$res = $mysqli->multi_query( "CALL usecash( $id , 1, 0, 1, 0, $amount, 1, @error);SELECT @error" );
you can then use the $res variable to switch-case over different error codes..
didn't work for me this :