1 | <?php |
---|
2 | |
---|
3 | require_once 'locale.php'; |
---|
4 | require_once 'dbconst.php'; |
---|
5 | require_once 'cmn_frame.php'; |
---|
6 | |
---|
7 | function _wu($text) { |
---|
8 | return iconv("cp1250", "utf-8", $text); |
---|
9 | } |
---|
10 | |
---|
11 | function save_user() { |
---|
12 | $firstname = isset($_POST['_firstname']) ? _wu($_POST['_firstname']) : 'NULL'; |
---|
13 | $name = isset($_POST['_name']) ? _wu($_POST['_name']) : 'NULL'; |
---|
14 | $organization = isset($_POST['_organization']) ? _wu($_POST['_organization']) : 'NULL'; |
---|
15 | $country = isset($_POST['_country']) ? _wu($_POST['_country']) : 'NULL'; |
---|
16 | $email = isset($_POST['_email']) ? _wu($_POST['_email']) : 'NULL'; |
---|
17 | $ip = $_SERVER['REMOTE_ADDR']; |
---|
18 | $filename = _wu($_POST['_filename']); |
---|
19 | $now = date("Y-m-d H:i:s"); |
---|
20 | |
---|
21 | $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWD) |
---|
22 | or die (DB_ERROR.': '.mysql_error().' ('.mysql_errno().')'); |
---|
23 | |
---|
24 | mysql_select_db (DB_NAME) |
---|
25 | or die (DB_ERROR.': '.mysql_error().' ('.mysql_errno().')'); |
---|
26 | |
---|
27 | /* Ustawiamy kodowanie */ |
---|
28 | mysql_query("SET NAMES '".DB_CHARSET."'") |
---|
29 | or die (DB_ERROR.': '.mysql_error().' ('.mysql_errno().')'); |
---|
30 | |
---|
31 | $sql = "INSERT INTO `utt_downloaders`(`firstname`, `name`, ". |
---|
32 | "`organization`, `country`, `email`, ". |
---|
33 | "`ip`, `filename`, `date`) ". |
---|
34 | "VALUES('$firstname', '$name', ". |
---|
35 | "'$organization', '$country', '$email', ". |
---|
36 | "'$ip', '$filename', '$now')"; |
---|
37 | //echo "Execute query: $sql<br />\n"; |
---|
38 | mysql_query($sql) |
---|
39 | or die(DB_ERROR.': '.mysql_error().' ('.mysql_errno().')'); |
---|
40 | |
---|
41 | mysql_close($link); |
---|
42 | } |
---|
43 | |
---|
44 | |
---|
45 | // main part |
---|
46 | // print_r($_SERVER); |
---|
47 | // print_r($_POST); |
---|
48 | if(isset($_POST['_filename'])) { |
---|
49 | save_user(); |
---|
50 | $head = '<title>UAM Text Tools - '.DOWNLOAD_THANKS_PAGE_TITLE."</title>\n"; |
---|
51 | $head .= "<meta HTTP-EQUIV=\"REFRESH\" content=\"5; url=files/".$_POST['_filename']."\">\n"; |
---|
52 | $content = DOWNLOAD_THANKS_CAPTION."<br />\n". |
---|
53 | "<br />".DOWNLOAD_THANKS_EXTRA_LINK. |
---|
54 | " <a href=\"files/".$_POST['_filename']."\">".$_POST['_filename']."</a>.<br />\n". |
---|
55 | "<a href=index.php>".DOWNLOAD_THANKS_MAINPAGE_LINK."</a>\n"; |
---|
56 | |
---|
57 | getMainPage($head, $content); |
---|
58 | } |
---|
59 | else { |
---|
60 | header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/down.php'); |
---|
61 | } |
---|
62 | |
---|
63 | ?> |
---|