Host = $Db_Prefs['DB_Host']; $this->Database = $Db_Prefs['DB_Name']; $this->User = $Db_Prefs['DB_User']; $this->Passwd = $Db_Prefs['DB_Passwd']; $this->debug = $Db_Prefs['DB_debug']; $this->connect(); } function halt ($msg) { printf("Database error: %s
\n", $msg); printf("MYSQL Error: %s (%s)

\n", $this->Errno, $this->Error); } function connect () { if ($this->Link_ID == 0) { $this->Link_ID = @mysqli_connect($this->Host, $this->User, $this->Passwd, $this->Database); $this->Link_ID->set_charset("utf8"); } if (! $this->Link_ID) { $this->Halt("Link_ID == false, connect failed"); } } function query ($Query_String) { global $counter; if ($this->debug) { printf("
Debug: query = %s
\n", $Query_String); } $this->Query_ID = mysqli_query($this->Link_ID,$Query_String); $this->Row = 0; $this->Errno = 0; $this->Error = mysqli_error($this->Link_ID); $this->Insert_ID = mysqli_insert_id($this->Link_ID); if (! $this->Query_ID) { $this->halt("Invalid SQL: " . $Query_String); } $counter ++; if ($this->debug) { echo "Counter: " . $counter . "
"; } return $this->Insert_ID; } function next_record () { $this->Record = @mysqli_fetch_array($this->Query_ID); $this->Row += 1; $this->Errno = mysqli_errno($this->Link_ID); $this->Error = mysqli_error($this->Link_ID); $stat = is_array($this->Record); if (! $stat) { @mysql_free_result($this->Query_ID); $this->Query_ID = 0; } return $stat; } function seek ($pos) { $status = @mysqli_data_seek($this->Query_ID, $pos); if ($status) $this->$Row = $pos; return; } function num_rows () { return @mysqli_num_rows($this->Query_ID); } function num_fields () { return @mysqli_num_fields($this->Query_ID); } function f ($Name) { $this->Record = mysqli_fetch_array($this->Query_ID); return $this->Record[$Name]; } function p ($Name) { print $this->Record[$name]; } function affected_rows () { return @mysqli_affected_rows($this->Link_ID); } function total_queries () { global $counter; return $counter; } function last_inserted_id(){ return mysqli_insert_id ( $this->Link_ID ); } function escape($str) { return mysqli_real_escape_string($this->Link_ID,$str); } } $modules['mysql_db'] = "1"; ?> sender = $senderName . " <$senderEmail>"; $this->replyTo = $replyTo; $this->subject = $subject; $this->message = $message; if ( is_array($toList) ) { $this->to = join( $toList, "," ); } else { $this->to = $toList; } if ( is_array($ccList) && sizeof($ccList) ) { $this->cc = join( $ccList, "," ); } elseif ( $ccList ) { $this->cc = $ccList; } if ( is_array($bccList) && sizeof($bccList) ) { $this->bcc = join( $bccList, "," ); } elseif ( $bccList ) { $this->bcc = $bccList; } } function send () { $this->headers = "From: " . $this->sender . "\n"; if ( $this->replyTo ) { $this->headers .= "Reply-To: " . $this->replyTo . "\n"; } if ( $this->cc ) { $this->headers .= "Cc: " . $this->cc . "\n"; } if ( $this->bcc ) { $this->headers .= "Bcc: " . $this->bcc . "\n"; } return mail ($this->to, $this->subject, $this->message, $this->headers); } } class htmlemail { function htmlemail ($subject, $message, $htmlmessage, $senderName, $senderEmail, $toList, $ccList=0, $bccList, $replyTo=0) { $this->sender = $senderName . " <$senderEmail>"; $this->replyTo = $replyTo; $this->subject = $subject; $this->message = $message; $this->htmlmessage = $htmlmessage; if ( is_array($toList) ) { $this->to = join( $toList, "," ); } else { $this->to = $toList; } if ( is_array($ccList) && sizeof($ccList) ) { $this->cc = join( $ccList, "," ); } elseif ( $ccList ) { $this->cc = $ccList; } else { $this->cc = false; } if ( is_array($bccList) && sizeof($bccList) ) { $this->bcc = join( $bccList, "," ); } elseif ( $bccList ) { $this->bcc = $bccList; } } function htmlsend () { $this->headers = "From: " . $this->sender . "\n"; if ( $this->replyTo ) { $this->headers .= "Reply-To: " . $this->replyTo . "\n"; } if ( $this->cc ) { $this->headers .= "Cc: " . $this->cc . "\n"; } if ( $this->bcc ) { $this->headers .= "Bcc: " . $this->bcc . "\n"; } $this->headers .= "MIME-Version: 1.0\n"; $this->boundary = "_--EMAKNL".md5(uniqid(time())); $this->headers .= "Content-Type: multipart/alternative; boundary =\"$this->boundary\"\n\n"; $this->headers .= "This is a multi-part message in MIME format.\n\n"; $this->headers .= "--$this->boundary\n"; $this->headers .= "Content-Type: text/plain; charset=\"utf-8\";format=\"fixed\"\n"; $this->headers .= "Content-Transfer-Encoding: quoted-printable\n\n"; $this->headers .= $this->quoted_printable_enc($this->message); // $this->headers .= chunk_split(base64_encode($this->message)); $this->headers .= "\n--$this->boundary\n"; $this->headers .= "Content-Type: text/html; charset=\"utf-8\";format=\"fixed\"\n"; $this->headers .= "Content-Transfer-Encoding: quoted-printable\n\n"; $this->headers .= $this->quoted_printable_enc($this->htmlmessage); $this->headers .= "\n--$this->boundary--\n"; return mail ($this->to, $this->subject, "", $this->headers); } function quoted_printable_encode_character ( $matches ) { $character = end ( $matches ); return sprintf ( '=%02x', ord ( $character ) ); } // based on http://www.freesoft.org/CIE/RFC/1521/6.htm function quoted_printable_enc( $string ) { $string = preg_replace("/\t/","",$string); // rule #2, #3 (leaves space and tab characters in tact) $string = preg_replace_callback ('/[^\x21-\x3C\x3E-\x7E\x09\x20]/', array(&$this,'quoted_printable_encode_character'),$string); $newline = "=\n"; // '=' + CRLF (rule #4) // make sure the splitting of lines does not interfere with escaped characters // (chunk_split fails here) preg_match_all ( '/.{1,70}([^=]{0,3})/', $string, $match ); // Rule #1 $imp = implode ( $newline, $match[0] ); return $imp; } } $modules['email'] = "1"; ?>