3 * This script process the suggestion tracking
5 * Created on Aug 21, 2007
6 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org>
7 * @copyright Corporación Somos más - 2007
9 require_once (dirname(dirname(__FILE__
)) . "/../includes.php");
11 $username = optional_param('username');
12 $type = optional_param('type');
13 $ident = optional_param('ident');
14 $schema = optional_param('schema');
16 if (!empty ($username) && !empty ($type) && !empty ($ident)) {
17 $tracking = get_records_select('suggest_tracking', "type='$type' AND contentid=$ident AND userid = " . $_SESSION['userid']);
18 if (empty ($tracking)) {
19 $tracking = new StdClass
;
20 $tracking->userid
= $_SESSION['userid'];
21 $tracking->contentid
= $ident;
22 $tracking->type
= $type;
24 $insert_id = insert_record('suggest_tracking', $tracking);
26 $tracking = array_pop($tracking);
27 $tracking->visited
= $tracking->visited +
1;
28 update_record('suggest_tracking', $tracking);
32 suggest_clean_cache($_SESSION['userid'] . $type);
35 $url = url
. "{{username}}";
36 if (!empty ($schema)) {
37 $schema = urldecode($schema);
40 $url = str_replace('{{username}}', $username, $url);
41 $url = str_replace('{{type}}', $type, $url);
42 $url = str_replace('{{ident}}', $ident, $url);
43 header("Location: $url");