You are here

function ad_owners_create_hostid in Advertisement 6.3

Same name and namespace in other branches
  1. 6.2 owners/ad_owners.module \ad_owners_create_hostid()
  2. 7 owners/ad_owners.module \ad_owners_create_hostid()

Create a unique host id for each ad owner, used when displaying ads remotely.

2 calls to ad_owners_create_hostid()
ad_owners_nodeapi in owners/ad_owners.module
Implementation of hook_nodeapi().
ad_remote_form in remote/ad_remote.module
A simple page providing source snippets for displaying ads on remote websites. When form is being submitted, it rebuilds with needed code snippet.

File

owners/ad_owners.module, line 409
Enhances the ad module to support ad owners.

Code

function ad_owners_create_hostid($uid) {
  $hostid = db_result(db_query('SELECT hostid FROM {ad_hosts} WHERE uid = %d', $uid));
  if (!$hostid) {
    $hostid = md5($uid . time());
    db_query("INSERT INTO {ad_hosts} (uid, hostid) VALUES (%d, '%s')", $uid, md5($uid . time()));
  }
  return $hostid;
}