function ad_owners_create_hostid in Advertisement 7
Same name and namespace in other branches
- 6.3 owners/ad_owners.module \ad_owners_create_hostid()
- 6.2 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_query('SELECT hostid FROM {ad_hosts} WHERE uid = %d', $uid)
->fetchField();
if (!$hostid) {
$hostid = md5($uid . time());
db_query("INSERT INTO {ad_hosts} (uid, hostid) VALUES (%d, '%s')", $uid, md5($uid . time()));
}
return $hostid;
}