Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ////////////////////////////////////////////////////////////////
- //
- // Warning: Editing the following without instruction or
- // knowledge of how it works may lead to errors in its
- // execution, always consult me before editing any of this
- //
- // ~David A Perez
- //
- ////////////////////////////////////////////////////////////////
- require_once'utility_lib.php';
- class dpEmailer_manager extends utility {
- public $dpe_connect;
- ////////////////////////////////////////////////////////////////
- // Build Class object
- ////////////////////////////////////////////////////////////////
- function __construct(){
- parent::__construct();
- $db_host = "xxx";
- $db_username = "xxx";
- $db_password = "xxx";
- $db_dbname = "xxx";
- $this->dpe_connect = $this->open_dpe_connect($db_host,$db_username,$db_password,$db_dbname);
- echo "<pre>\n";
- print_r($this);
- echo "</pre>\n";
- }
- ////////////////////////////////////////////////////////////////
- // Destructor
- ////////////////////////////////////////////////////////////////
- function __destruct(){
- $this->dpe_db_connect = $this->close_dpe_connect();
- }
- ////////////////////////////////////////////////////////////////
- // test
- ////////////////////////////////////////////////////////////////
- function test(){
- $query = "SELECT * FROM auth_codes";
- $results = mysql_query($query,$this->dpe_connect);
- if(!$results){
- $message = __METHOD__."() > Error fetching MySQL results: ".mysql_error()."<br />\n".$query;
- die($message);
- }
- $count = mysql_num_rows($results);
- echo "This many results: ".$count;
- }
- ////////////////////////////////////////////////////////////////
- // Open DP Emailer DB connection
- ////////////////////////////////////////////////////////////////
- function open_dpe_connect($dbhost,$dbusername,$dbpassword,$dbname){
- $this->dpe_connect = mysql_connect($dbhost,$dbusername,$dbpassword);
- if(!$this->dpe_connect){
- die('Error connecting to MySQL: '.mysql_error());
- }
- mysql_select_db($dbname,$this->dpe_connect);
- }
- ////////////////////////////////////////////////////////////////
- // Close DP Emailer DB connection
- ////////////////////////////////////////////////////////////////
- function close_dpe_connect(){
- mysql_close($this->dpe_connect);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment