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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (hide annotations) (download)
Thu Nov 29 13:59:21 2007 UTC (16 years, 6 months ago) by torben
File size: 707 byte(s)
Finished administration module (?)

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     #include <sstream>
7     </%pre>
8    
9     <%config>
10     dburl;
11     </%config>
12    
13     <%session scope="global">
14     std::string userName;
15     bool isAdmin;
16     </%session>
17    
18    
19     <%args>
20     int id;
21     </%args>
22    
23     <{
24    
25     if (userName.size() == 0)
26     {
27     reply.setHeader("Location", "index");
28     return HTTP_MOVED_TEMPORARILY;
29     }
30    
31     if (!isAdmin)
32     {
33     reply.setHeader("Location", "index");
34     return HTTP_MOVED_TEMPORARILY;
35     }
36    
37     tntdb::Connection conn = tntdb::connect(dburl);
38    
39     std::stringstream query;
40     query << "DELETE FROM users WHERE id = " << id;
41    
42     conn.execute(query.str());
43     reply.setHeader("Location", "adm_user_list");
44     return HTTP_MOVED_TEMPORARILY;
45    
46    
47     }>

  ViewVC Help
Powered by ViewVC 1.1.20