Кресты / Говнокод #215 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
/* This is bad. Reaaly bad. It's a really, really bad hack. If you're an employee of 
 * Intertrode Communication, then I'm really, really sorry that you have to maintain
 * this. I was honestly planning on removing this tomorrow, but I've been known to 
 * forget things like this. It happens.
 *
 * So here's the thing. I can't seem to figure out why the AccountId variable isn't 
 * set. I've looked and looked, but I gotta leave now. Anyway, I've found that I can
 * just grab the AccountID from the debugging logs.  I suppose that to fix it, you'd
 * have to locate where it's clearing out the ID.
 *
 * Again, I'm sorry.
 */

if ( (AccountId == NULL) || (AccountId == "") ||
     (ServerSesion["AccountId"] == NULL) || (ServerSesion["AccountId"] == "") )
{
  //open session logs
  FileHandle file = f_open(LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log", 1);
  while (file != NULL)
  {
    
    TString line = f_readline(file);

    //look for IP and changereg
    if ( (sfind(line,REMOTE_ADDR) != -1) && (sfind(line,"changereg") != -1) )
    {
      //0000-00-00 00:00 /accountmaint/changereg/?AccountId=123456 255.255.255.255 ...
      //                                                    *
      AccountId = substr(line, 52, 6);
    }

    if (f_EOF(file)) { f_close(file); file = NULL; }
  }

}

У чувака где то перетирается AccountId, так он берет данные из логов IIS'а :) Главное, что он сожалеет об этом.
Отсюда: http://thedailywtf.com/Articles/The_Apologetic_Coder.aspx

Запостил: guest guest, (Updated )

Комментарии (2) RSS

  • Alexander G:
    FileHandle file = f_open(LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log", 1);
      while (file != NULL)


    LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log"


    "\sessionlog-"


    Вот что значит нормальная подсветка синтаксиса. Почему в Студии эскейпы так не подсвечивается ?
    Ответить
  • Developer:
    > Почему в Студии эскейпы так не
    > подсвечивается?
    Только в говностудии!
    Ответить

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8