-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.php
80 lines (66 loc) · 1.94 KB
/
classes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
class db{
public $results;
public function mysqlconnect($server, $user, $password){
$connection = mysql_connect($server, $user, $password);
if(!connection){
die("Error Connecting to Server");
}
}
public function mysqlselectdb($database){
$db = mysql_select_db($database);
if(!$db){
die("Error Connecting to Database");
}
}
public function mysqlquery($query){
$this->results = mysql_query($query);
if(!$this->results){
die("Error With Query");
}
}
public function mssqlconnect($server, $user, $password){
$connection = mssql_connect($server, $user, $password);
if(!$connection){
die("Error Connecting to Server");
}
}
public function mssqlselectdb($database){
$db = mssql_select_db($database);
if(!$db){
die("Error Connecting to Database");
}
}
public function mssqlquery($query){
$this->results = mssql_query($query);
if(!$this->results){
die("Error With Query");
}
}
}
class email{
function mail_attachment($to, $from, $subject, $message, $file, $cc = '', $bcc = ''){
$file_name = basename($file);
$content = chunk_split(base64_encode(file_get_contents($file)));
$uid = md5(uniqid(time()));
$from = str_replace(array("\r", "\n"), '', $from); // to prevent email injection
$header = "From: ".$from."\r\n"
."Cc: ".$cc."\r\n"
."Bcc: ".$bcc."\r\n"
."MIME-Version: 1.0\r\n"
."Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"
."This is a multi-part message in MIME format.\r\n"
."--".$uid."\r\n"
."Content-type:text/plain; charset=iso-8859-1\r\n"
."Content-Transfer-Encoding: 7bit\r\n\r\n"
.$message."\r\n\r\n"
."--".$uid."\r\n"
."Content-Type: application/octet-stream; name=\"".$file_name."\"\r\n"
."Content-Transfer-Encoding: base64\r\n"
."Content-Disposition: attachment; filename=\"".$file_name."\"\r\n\r\n"
.$content."\r\n\r\n"
."--".$uid."--";
return mail($to, $subject, "", $header);
}
}
?>