summaryrefslogtreecommitdiffstats
path: root/util/checkmoney.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-07 00:55:18 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-07 00:55:18 +0800
commit80c4c81304e88d93f73efc42147793afbbfa43c5 (patch)
treec7edca692dfd06667fc9581cd305679c459badd6 /util/checkmoney.c
parent64d073d82f1f7e56249a6e20640df55d1c957817 (diff)
downloadpttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar.gz
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar.bz2
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar.lz
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar.xz
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.tar.zst
pttbbs-80c4c81304e88d93f73efc42147793afbbfa43c5.zip
tools for fix money bug
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1712 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/checkmoney.c')
-rw-r--r--util/checkmoney.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/util/checkmoney.c b/util/checkmoney.c
index 22170bdb..0f86420b 100644
--- a/util/checkmoney.c
+++ b/util/checkmoney.c
@@ -5,6 +5,7 @@
int main(int argc, char*argv[]) {
userec_t user;
+ char userhomepwd[256];
char *userid;
int i, money;
@@ -17,10 +18,22 @@ int main(int argc, char*argv[]) {
for(i = 1; i <= MAX_USERS; i++) {
userid=SHM->userid[i-1];
money =SHM->money[i-1];
- if(!userid[0]) continue;
+ if(!userid[0] || money==-1 ) continue;
if(get_record(argv[1], &user, sizeof(user), i) == -1)continue;
- printf("%s %d %s %d\n", userid, money, user.userid, user.money);
-
+ if(money-user.money > 1000000 ||( money<100 && user.money>2000))
+ {
+ sprintf(userhomepwd, BBSHOME "/%c/%s/.passwd", user.userid[0],
+ user.userid);
+ printf("%s %d ", userid, money);
+ money= user.money;
+ SHM->money[i-1] = money;
+ if(get_record(userhomepwd, &user, sizeof(user), 1) == -1)
+ get_record(BBSHOME"/.PASSWD", &user, sizeof(user), i);
+ user.money = money;
+ printf("become %d\n", money);
+ substitute_record(BBSHOME"/.PASSWD", &user, sizeof(user), i);
+ substitute_record(userhomepwd, &user, sizeof(user), 1);
+ }
}
return 0;