-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
175 lines (130 loc) · 4.69 KB
/
index.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!-- welcome to crafira website -->
<?php
// php code using for load web content without refreshing the webpage
if (
isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
) {
$ssl = 'https';
} else {
$ssl = 'http';
}
$app_url = ($ssl)
. "://" . $_SERVER['HTTP_HOST']
. (dirname($_SERVER["SCRIPT_NAME"]) == DIRECTORY_SEPARATOR ? "" : "/")
. trim(str_replace("\\", "/", dirname($_SERVER["SCRIPT_NAME"])), "/");
include 'assets/functions.php';
// this for hide undeclared error
error_reporting(E_ALL);
ini_set("display_errors", NULL);
//This keep user loged in until they signed out
if ($_SESSION["ID"]) {
echo '<style>#signout{display:block !important;}</style>';
echo '<style>#signin{display:none !important;}</style>';
} else {
echo '<style>#signout{display:none !important;}</style>';
echo '<style>#signin{display:block !important;}</style>';
}
//cart status update
if (!empty($_SESSION["cart"])) {
echo '<style>#badge{display:block !important;}</style> ';
}
?>
<!-- HTML CODE START -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Crafira</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<link href="css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection" />
<link rel="stylesheet" href="css/index.css" />
<!-- this use for use jquery in our website -->
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<!-- this use for use sweet alert in our website -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.4.24/sweetalert2.all.js"></script>
<!-- // script for load web content without refreshing the webpage -->
<script type="text/javascript">
//load LANDING PAGE
$(function() {
$("#post-placeholder").load("pages/landingPage.php");
});
$(document).ready(function($) {
var page_url = '<?php echo $app_url ?>/';
$(document).on('click', '.btn_load_screen', function(event) {
event.preventDefault();
var call_type = $(this).attr('call_type');
if (call_type == 'product') {
var p_id = $(this).attr('p_atr');
// GENERATE COOKIE FOR LOAD PARTICULAR PRODUCT
$(document).ready(function() {
var cookies = document.cookie.split(";")
var cookiePair = cookies[0].split("=");
var cookie_user = cookiePair[1]; // remove ending parenthesis here
createCookie("product_id", p_id, "10");
});
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = escape(name) + "=" +
escape(value) + expires + "; path=/";
}
}
// GET THE PAGES DATA
$.getJSON(page_url + 'assets/pageinfo.php', {
call_type: call_type
}, function(data, textStatus, xhr) {
$(document).attr("title", data.title);
$('#post-placeholder').load(data.url);
});
});
});
</script>
</head>
<body>
<!-- Error handelling alert box -->
<script type="text/javascript">
var e_message = '<?php echo $e_message ?>';
var e_icon = '<?php echo $e_icon ?>';
var e_text = '<?php echo $e_text ?>';
if (e_message) {
$(document).ready(function func() {
Swal.fire({
title: e_message,
text: e_text,
icon: e_icon,
button: "Ok",
timer: 3300,
confirmButtonColor: "#437C90"
});
});
}
</script>
<!--Navigation bar-->
<div id="nav-placeholder" class="scrollspy"></div>
<!--Search Result-->
<div id="searchresult"></div>
<!-- Content load here -->
<div class='content' id="post-placeholder"></div>
<!--Footer placeholder-->
<div id="footer-placeholder"></div>
<!-- General Scripts-->
<script src="js/materialize.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/main.js"></script>
<script src="js/nav.js"></script>
<script src="../js/hbspt.js"></script>
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js-na1.hs-scripts.com/23220584.js"></script>
<!-- End of HubSpot Embed Code -->
</body>
</html>