UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UU code



Actually, the "no record test" is better to do not as:

if (!user_id)

but as (right after query_open()):

if (query.eof())

2007/3/15, Alexey Parshin < alexeyp@gmail.com>:
int user_id = 0;
string user_name;
try {
   Query query(&db,"select si_person, si_person_name from session_info");
   query.open();
   user_id = query[0];
   user_name = query[1];
   query.close ();
   if (!user_id)
      throw CException("User not logged in");
}
catch (exception& e) {
   cout << "OOPS, " << e.what() << endl;
}

2007/3/15, sergey@total-knowledge.com < sergey@total-knowledge.com>:
In order to perform authentication on each application page I need to find
out if user with certain ID exist in session_info table.
I want to make sure that I understand how it will work, so the question is:

1. If session_info table exist.
AND
2. There is a one entry there (doesn't matter what the value is).

it means that current user is logged in.

Is it true?






--

Alexey Parshin,
http://www.sptk.net



--
Alexey Parshin,
http://www.sptk.net

Authoright © Total Knowledge: 2001-2008