You are here

function ad_host_id_create in Advertisement 5

Same name and namespace in other branches
  1. 6 owners/ad_owners.module \ad_host_id_create()

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

3 calls to ad_host_id_create()
ad_nodeapi in ./ad.module
Drupal _nodeapi hook.
ad_operations_callback in ./ad.module
Callback function for admin mass approving ads. TODO: Update activated and expired when appropriate. TODO: Publish/unpublish nodes when appropriate.
ad_remote_form_submit in remote/ad_remote.module
Prepare quantity and group.

File

./ad.module, line 1646
An advertising system for Drupal powered websites.

Code

function ad_host_id_create($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;
}