1 |
<%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 |
reply.setHeader("Refresh", "0; url=login"); |
27 |
else |
28 |
{ |
29 |
tntdb::Connection conn = tntdb::connect(dburl); |
30 |
|
31 |
std::stringstream query; |
32 |
query << "DELETE FROM customer WHERE id = " << id; |
33 |
conn.execute(query.str()); |
34 |
|
35 |
reply.setHeader("Refresh", "0; url=adm_customer_list"); |
36 |
} |
37 |
|
38 |
}> |