You are here

function ad_permission_create_hostid in Advertisement 5.2

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

3 calls to ad_permission_create_hostid()
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_permission_nodeapi in permission/ad_permission.module
Drupal _nodeapi hook.
ad_remote_form_submit in remote/ad_remote.module
Prepare quantity and group.

File

permission/ad_permission.module, line 423
Provide granular permissions for advertisements.

Code

function ad_permission_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;
}