root/wifidogadmin/wifidog/clickthrough.php
| Revision 479, 4.1 kB (checked in by insultant, 8 months ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
| 5 | |
| 6 | // +-------------------------------------------------------------------+ |
| 7 | // | WiFiDog Authentication Server | |
| 8 | // | ============================= | |
| 9 | // | | |
| 10 | // | The WiFiDog Authentication Server is part of the WiFiDog captive | |
| 11 | // | portal suite. | |
| 12 | // +-------------------------------------------------------------------+ |
| 13 | // | PHP version 5 required. | |
| 14 | // +-------------------------------------------------------------------+ |
| 15 | // | Homepage: http://www.wifidog.org/ | |
| 16 | // | Source Forge: http://sourceforge.net/projects/wifidog/ | |
| 17 | // +-------------------------------------------------------------------+ |
| 18 | // | This program is free software; you can redistribute it and/or | |
| 19 | // | modify it under the terms of the GNU General Public License as | |
| 20 | // | published by the Free Software Foundation; either version 2 of | |
| 21 | // | the License, or (at your option) any later version. | |
| 22 | // | | |
| 23 | // | This program is distributed in the hope that it will be useful, | |
| 24 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 25 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 26 | // | GNU General Public License for more details. | |
| 27 | // | | |
| 28 | // | You should have received a copy of the GNU General Public License | |
| 29 | // | along with this program; if not, contact: | |
| 30 | // | | |
| 31 | // | Free Software Foundation Voice: +1-617-542-5942 | |
| 32 | // | 59 Temple Place - Suite 330 Fax: +1-617-542-2652 | |
| 33 | // | Boston, MA 02111-1307, USA gnu@gnu.org | |
| 34 | // | | |
| 35 | // +-------------------------------------------------------------------+ |
| 36 | |
| 37 | /** |
| 38 | * @package WiFiDogAuthServer |
| 39 | * @author Benoit Grégoire <bock@step.polymtl.ca> |
| 40 | * @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc. |
| 41 | * @version Subversion $Id: validate.php 1031 2006-05-10 18:56:02Z benoitg $ |
| 42 | * @link http://www.wifidog.org/ |
| 43 | */ |
| 44 | |
| 45 | /** |
| 46 | * Load required files |
| 47 | */ |
| 48 | require_once (dirname(__FILE__) . '/include/common.php'); |
| 49 | |
| 50 | $db = AbstractDb::getObject(); |
| 51 | if (!empty ($_REQUEST['destination_url'])) { |
| 52 | |
| 53 | if (!empty ($_REQUEST['content_id']) && !empty ($_REQUEST['node_id']) && !empty ($_REQUEST['user_id']) ) { |
| 54 | $destination_url = $db->escapeString($_REQUEST['destination_url']); |
| 55 | $content_id = $db->escapeString($_REQUEST['content_id']); |
| 56 | $node_id = $db->escapeString($_REQUEST['node_id']); |
| 57 | $user_id = $db->escapeString($_REQUEST['user_id']); |
| 58 | $sql = "SELECT * FROM content_clickthrough_log WHERE content_id='$content_id' AND user_id='$user_id' AND node_id='$node_id' AND destination_url='$destination_url'"; |
| 59 | $db->execSql($sql, $log_rows, false); |
| 60 | if ($log_rows != null) { |
| 61 | $sql = "UPDATE content_clickthrough_log SET num_clickthrough = num_clickthrough +1, last_clickthrough_timestamp = CURRENT_TIMESTAMP WHERE content_id='$content_id' AND user_id='$user_id' AND node_id='$node_id' AND destination_url='$destination_url'"; |
| 62 | } else { |
| 63 | $sql = "INSERT INTO content_clickthrough_log (user_id, content_id, node_id, destination_url) VALUES('$user_id', '$content_id', '$node_id', '$destination_url')\n"; |
| 64 | } |
| 65 | $db->execSqlUpdate($sql, false); |
| 66 | } |
| 67 | header("Location: " . $_REQUEST['destination_url']); |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | echo "<h1>Redirect destination missing</h1>"; |
| 72 | } |
| 73 | /* |
| 74 | * Local variables: |
| 75 | * tab-width: 4 |
| 76 | * c-basic-offset: 4 |
| 77 | * c-hanging-comment-ender-p: nil |
| 78 | * End: |
| 79 | */ |
Note: See TracBrowser for help on using the browser.
