/[H9]/trunk/tntnet/dynamic/adm_user_list.ecpp
ViewVC logotype

Annotation of /trunk/tntnet/dynamic/adm_user_list.ecpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 126 - (hide annotations) (download)
Sun Dec 2 20:26:43 2007 UTC (16 years, 6 months ago) by torben
File size: 1192 byte(s)
Silenced compiler warnings

1 torben 101 <%pre>
2     #include <tntdb/connect.h>
3     #include <tntdb/connection.h>
4     #include <tntdb/result.h>
5     #include <tntdb/row.h>
6     </%pre>
7    
8     <%config>
9     dburl;
10     </%config>
11    
12     <%session scope="global">
13     std::string userName;
14     bool isAdmin;
15     </%session>
16    
17     <{
18     if (userName.size() == 0)
19     {
20     reply.setHeader("Location", "index");
21     return HTTP_MOVED_TEMPORARILY;
22     }
23     if (!isAdmin)
24     {
25     reply.setHeader("Location", "index");
26     return HTTP_MOVED_TEMPORARILY;
27     }
28     }>
29    
30     <&header title="User administration">
31     </&header>
32     <h2>User administration</h2>
33    
34     <a href="adm_user_edit?id=-1">Create new user</a><br>
35    
36    
37     <{
38     tntdb::Connection conn = tntdb::connect(dburl);
39    
40     std::string query = "SELECT id, realname, username FROM users ORDER BY username ASC";
41    
42     tntdb::Result res = conn.select(query);
43    
44     std::ostream& out = reply.out();
45     if (res.size() > 0)
46     {
47     out << "<ul>";
48 torben 126 for (unsigned i=0; i<res.size(); ++i)
49 torben 101 {
50     int id = res[i].getInt(0);
51     std::string realname = res[i].getString(1);
52     std::string username = res[i].getString(2);
53     out << "<li>";
54     out << "<a href='adm_user_edit?id=" << id << "'>" << username << "</a> - " << realname;
55     out << "</li>";
56     }
57     out << "</ul>";
58     }
59     else
60     {
61     out << "<i>No customers found!</i>";
62     }
63     }>
64    
65     <&footer>
66     </&footer>

  ViewVC Help
Powered by ViewVC 1.1.20