You are here

function simplenews_statistics_view in Simplenews Statistics 6

Same name and namespace in other branches
  1. 6.3 simplenews_statistics.module \simplenews_statistics_view()
  2. 6.2 simplenews_statistics.module \simplenews_statistics_view()

simplenews_statistics_view.

Gathers the opens

1 string reference to 'simplenews_statistics_view'
simplenews_statistics_menu in ./simplenews_statistics.module
Implementation of hook_menu().

File

./simplenews_statistics.module, line 58
Gathers newsletter statistics.

Code

function simplenews_statistics_view() {
  if ($_GET['mail'] && $_GET['nid']) {
    if (!db_fetch_array(db_query("SELECT * FROM {simplenews_statistics_opens} WHERE email = '%s' AND nid = %d", $_GET['mail'], $_GET['nid']))) {
      db_query("INSERT INTO {simplenews_statistics_opens} (email, nid, opens, timestamp) VALUES ('%s', %d, %d, %d)", $_GET['mail'], $_GET['nid'], 1, time());
    }
    else {
      db_query("UPDATE {simplenews_statistics_opens} SET opens = opens+1 WHERE email = '%s' AND nid = %d", $_GET['mail'], $_GET['nid']);
    }
  }
}