-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbconfig.php
More file actions
109 lines (75 loc) · 3.88 KB
/
dbconfig.php
File metadata and controls
109 lines (75 loc) · 3.88 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
//The following two lines of code should be changed to the appropriate onepage and global ID's
$onepage_ID = 1;
$global_ID = 1;
//The following two lines of code should be changed to the appropriate database username and passowrd
DEFINE("DB_USER", "database_admin");
DEFINE("DB_PASS", "DamsCommerce12");
//DO NET EDIT ANYTHING BELOW THIS LINE!
//----------------------------------------------------------------------------------------------------------------------------------------------------//
try {
$db = new PDO("mysql:host=localhost:3306;dbname=onepage_template",DB_USER,DB_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}
//Get Text
try {
$sql = "SELECT * FROM `text` WHERE id = :onepage_ID";
$stmt = $db->prepare($sql);
$stmt->execute(array(':onepage_ID' => $onepage_ID));
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$title = $result['title'];
$desc_text = $result['desc_text'];
$refer_button = $result['refer_button'];
$order_button = $result['order_button'];
$order_button_link = $result['order_button_link'];
$small_title_1 = $result['small_title_1'];
$large_desc_1 = $result['large_desc_1'];
$large_desc_2 = $result['large_desc_2'];
$large_desc_3 = $result['large_desc_3'];
$small_title_2 = $result['small_title_2'];
$small_desc_1 = $result['small_desc_1'];
$small_desc_2 = $result['small_desc_2'];
$small_desc_3 = $result['small_desc_3'];
$small_desc_4 = $result['small_desc_4'];
} catch(PDOException $e) {
echo $e->GetMessage();
}
//get Images
try {
$sql = "SELECT * FROM `images` WHERE id = :onepage_ID";
$stmt = $db->prepare($sql);
$stmt->execute(array(':onepage_ID' => $onepage_ID));
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$header_image = "data:image/jpg;base64," . base64_encode($result['header_image']);
$feature_image_1 = "data:image/jpg;base64," . base64_encode($result['feature_image_1']);
$feature_image_2 = "data:image/jpg;base64," . base64_encode($result['feature_image_2']);
$feature_image_3 = "data:image/jpg;base64," . base64_encode($result['feature_image_3']);
$misc_image_1 = "data:image/jpg;base64," . base64_encode($result['misc_image_1']);
$misc_image_2 = "data:image/jpg;base64," . base64_encode($result['misc_image_2']);
$misc_image_3 = "data:image/jpg;base64," . base64_encode($result['misc_image_3']);
$misc_image_4 = "data:image/jpg;base64," . base64_encode($result['misc_image_4']);
} catch(PDOException $e) {
echo $e->GetMessage();
}
//get global onepage social info and images
try {
$sql = "SELECT * FROM `global` WHERE id = :global_ID";
$stmt = $db->prepare($sql);
$stmt->execute(array(':global_ID' => $global_ID));
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$more_products_link = $result['more_products_link'];
$about_us_link = $result['about_us_link'];
$contact_link = $result['contact_link'];
$faqs_link = $result['faqs_link'];
$social_image_1 = "data:image/jpg;base64," . base64_encode($result['social_image_1']);
$social_image_2 = "data:image/jpg;base64," . base64_encode($result['social_image_2']);
$social_image_3 = "data:image/jpg;base64," . base64_encode($result['social_image_3']);
$social_link_1 = $result['social_link_1'];
$social_link_2 = $result['social_link_2'];
$social_link_3 = $result['social_link_3'];
} catch(PDOException $e) {
echo $e->GetMessage();
}
?>