<?php
Database functionality is hard-coded into the class. The class assumes the following database information:
CREATE TABLE `blacklisted` (
`email` varchar(75) NOT NULL default '',
PRIMARY KEY (`email`)
) TYPE=MyISAM;
CREATE TABLE `subscribers` (
`id` bigint(20) NOT NULL auto_increment,
`email` varchar(75) NOT NULL default '',
`name` varchar(75) NOT NULL default '',
`active` smallint(1) NOT NULL default '0',
`blacklisted` smallint(1) NOT NULL default '0',
`timestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `subscriptions` (
`id` bigint(20) NOT NULL auto_increment,
`subscriberid` bigint(20) NOT NULL default '0',
`topicid` bigint(20) NOT NULL default '0',
`active` smallint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `topics` (
`id` bigint(20) NOT NULL auto_increment,
`topic` varchar(50) NOT NULL default '',
`description` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM
Public members
-------------------------------
$name: The subscriber's name. Defaults to NULL
$email: The subscriber's email address. Defaults to NULL
Public methods
-------------------------------
Subscription($subscriberemail,$subscribername)
Subscription is the constructor for this class. It takes two arguments, $subscriberemail,
and $subscribername. Both argument's values are by default NULL. $subscriberemail needs to
be set for the public method getSubscribeID() to return an id. $subscribername only needs to
be set when running public method addSubscriber().
printNewSubscriptionForm()
prints out a form for new subscriptions
printUnsubscribeForm()
prints the form for unsubscribing to topics
addSubscriber($topics)
adds a new subscriber to the database and subscribes it to the topics contain in the argument $topics (array)
addSubscription($topicid)
subscribes the subscriber to the topic matching the argument $topicid
removeSubscription($topicid)
removes the topic matching the argument $topicid from the subscribers list of subscriptions
getSubscriberID()
returns the subscriber's id. $this->email must be set before this will return a true value
activate()
activates a subscriber's account as well as all inactive subscriptions
unsubscribe($blacklist=0)
removes a subscriber's email and subscriptions from the system. If the argument $blacklist is set, the user's
email address will be added to the blacklist. $blacklist's value is 0 by default
printSubscriptionForm()
prints the form for updating subscriptions
?>
|
|