Retrieving an accountId in the log
-37 Votes
Posted 2 years, 9 months ago
1: /* This is bad. Reaaly bad. It's a really, really bad hack. If you're an employee of 2: * Intertrode Communication, then I'm really, really sorry that you have to maintain 3: * this. I was honestly planning on removing this tomorrow, but I've been known to 4: * forget things like this. It happens. 5: * 6: * So here's the thing. I can't seem to figure out why the AccountId variable isn't 7: * set. I've looked and looked, but I gotta leave now. Anyway, I've found that I can 8: * just grab the AccountID from the debugging logs. I suppose that to fix it, you'd 9: * have to locate where it's clearing out the ID. 10: * 11: * Again, I'm sorry. 12: */ 13: 14: if ( (AccountId == NULL) || (AccountId == "") || 15: (ServerSesion["AccountId"] == NULL) || (ServerSesion["AccountId"] == "") ) 16: { 17: //open session logs 18: FileHandle file = f_open(LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log", 1); 19: while (file != NULL) 20: { 21: 22: TString line = f_readline(file); 23: 24: //look for IP and changereg 25: if ( (sfind(line,REMOTE_ADDR) != -1) && (sfind(line,"changereg") != -1) ) 26: { 27: //0000-00-00 00:00 /accountmaint/changereg/?AccountId=123456 255.255.255.255 ... 28: // * 29: AccountId = substr(line, 52, 6); 30: } 31: 32: if (f_EOF(file)) { f_close(file); file = NULL; } 33: } 34: 35: }
From Anonymous
Posted 1 year, 4 months ago
no comments...
From Anonymous
Posted 1 year, 8 months ago
Excellent !
From Anonymous
Posted 1 year, 9 months ago
The author apologizes himself !
From Hugo
Posted 1 year, 11 months ago
This is just brillant !
From Steve
Posted 2 years, 4 months ago
That's really not the right think to do ! It is definitely better to check the api and correct the code, even if you have to pass a long time. This way is the better way to introduce a future bug, not now, but soon...
