Full source code website bán hàng thương mại điện tử gần giống shopee
467.203 lượt xem;
1 <?php
2 session_start();
3 $lang= isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'vn';
4 $_SESSION['lang']=$lang;
5 ?>
6 <?
7
8 if(isset($_SESSION['kiemtra']) && $_SESSION['kiemtra']=='ON')
9 {
10 setcookie("user", $_SESSION['log'], time()+180);
11 setcookie("pass", $_SESSION['pass'], time()+180);
12 }
13 ?>
14 <?require("system/model/config.php") ?>
15 <? require("system/model/common_start.php") ?>
16 <? require("system/model/function.php") ?>
17 <? require("system/model/tiengviet.php") ?>
18 <?php
19 //META and FACEBOOK
20 $sql_config=mysql_query("SELECT * FROM config ");
21 $row_config=mysql_fetch_assoc($sql_config);
22 if($_REQUEST['home']=='products' && $_REQUEST['views'] != "")
23 {
24 $sql_rv=mysql_query("SELECT a.*,b.code as currency_code,c.name as cat_name FROM products a left join currency b on a.currency = b.id left join cat c on c.id=a.cat where a.id='".$_REQUEST['views']."'");
25 $row_rv=mysql_fetch_assoc($sql_rv);
26
27 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['name']),30)));
28 if($title_fb == "") {$title_fb = $home['fb_title'];}
29 if($row_rv['price'] > 0) {$title_fb = $title_fb ." - ".$home['giaban']." ". number_format($row_rv['price']).$row_rv['currency_code'];}
30 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['content']),30)));
31 if($description_fb == "") {$description_fb = $home['fb_description'];}
32 if(file_exists($row_rv['img1'])){$image_fb = $row_rv['img1'];}else{$image_fb = "images/banner/logo_home.png";}
33 list($width, $height) = getimagesize($image_fb);
34 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_product.png"; }
35
36 $title_mt = $row_rv['cat_name']." | ".$row_config['title_pro'];
37 $description_mt = $row_rv['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['short']),30))).", ".$row_config['description_pro'];
38 $keyword_mt = $row_rv['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_rv['name']." ".$row_rv['cat_name'])))).", ".$row_config['keyword_pro'];
39
40 }elseif($_REQUEST['home']=='adv'&& $_REQUEST['id'] != "")
41 {
42 $sql_ng=mysql_query("SELECT a.*,b.code as currency_code,c.name as cat_name FROM avd a left join currency b on a.currency = b.id left join adv_cat c on c.id = a.adv_cat where a.id='".$_REQUEST['id']."'");
43 $row_ng=mysql_fetch_assoc($sql_ng);
44
45 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['name']),30)));
46 if($title_fb == "") {$title_fb = $home['fb_title'];}
47 if($row_ng['price'] != "") {$title_fb = $title_fb ." - ".$home['giaban']." ". number_format($row_ng['price']).$row_ng['currency_code'];}
48 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['content']),30)));
49 if($description_fb == "") {$description_fb = $home['fb_description'];}
50 if(file_exists($row_ng['image'])){$image_fb = $row_ng['image'];}else{$image_fb = "images/banner/logo_home.png";}
51 list($width, $height) = getimagesize($image_fb);
52 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_adv.png"; }
53
54 $title_mt = $row_ng['cat_name']." | ".$row_config['title_adv'];
55 $description_mt = $row_ng['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['content']),30))).", ".$row_config['description_adv'];
56 $keyword_mt = $row_ng['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_ng['name']." ".$row_ng['cat_name'])))).", ".$row_config['keyword_adv'];
57
58 }elseif($_REQUEST['home']=='job'&& $_REQUEST['id'] != "")
59 {
60 $sql_jb=mysql_query("SELECT a.*,b.name as cat_name FROM job a left join job_cat b on b.id = a.job_cat where a.id='".$_REQUEST['id']."'");
61 $row_jb=mysql_fetch_assoc($sql_jb);
62
63 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['name']),30)));
64 $title_fb = $title_fb." - ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['congty']),30)));
65 if($title_fb == "") {$title_fb = $home['fb_title'];}
66 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['content']),30)));
67 if($description_fb == "") {$description_fb = $home['fb_description'];}
68 if(file_exists($row_jb['image'])){$image_fb = $row_jb['image'];}else{$image_fb = "images/banner/logo_home.png";}
69 list($width, $height) = getimagesize($image_fb);
70 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_job.png"; }
71
72 $title_mt = $row_jb['cat_name']." | ".$row_config['title_job'];
73 $description_mt = $row_jb['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['congty']),30))).", ".$row_config['description_job'];
74 $keyword_mt = $row_jb['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_jb['name']." ".$row_jb['cat_name']. " ".$row_jb['congty'])))).", ".$row_config['keyword_job'];
75
76 }elseif($_REQUEST['home']=='company'&& $_REQUEST['id'] != "")
77 {
78 $sql_cp=mysql_query("SELECT a.*,b.name as cat_name FROM company a left join company_cat b on a.company_cat = b.id where a.id='".$_REQUEST['id']."'");
79 $row_cp=mysql_fetch_assoc($sql_cp);
80
81 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['name']),30)));
82 $title_fb = $title_fb." - ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['cat_name']),30)));
83 if($title_fb == "") {$title_fb = $home['fb_title'];}
84 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['content']),30)));
85 if($description_fb == "") {$description_fb = $home['fb_description'];}
86 if(file_exists($row_cp['image'])){$image_fb = $row_cp['image'];}else{$image_fb = "upload/default/fb_company.png";}
87 list($width, $height) = getimagesize($image_fb);
88 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_company.png"; }
89
90 $title_mt = $row_cp['cat_name']." | ".$row_config['title_com'];
91 $description_mt = $row_cp['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['content']),30))).", ".$row_config['description_com'];
92 $keyword_mt = $row_cp['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_cp['name']." ".$row_cp['cat_name'])))).", ".$row_config['keyword_com'];
93
94 }elseif($_REQUEST['home']=='news' && $_REQUEST['id'] != "")
95 {
96 $sql_nw=mysql_query("SELECT a.*,b.name as cat_name FROM news a left join news_cat b on a.cat_id = b.id where a.id='".$_REQUEST['id']."'");
97 $row_nw=mysql_fetch_assoc($sql_nw);
98
99 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['name']),30)));
100 if($title_fb == "") {$title_fb = $home['fb_title'];}
101 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['short']),30)));
102 if($description_fb == "") {$description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['content']),30)));}
103 if($description_fb == "") {$description_fb = $home['fb_description'];}
104 if(file_exists($row_nw['image'])){$image_fb = $row_nw['image'];}else{$image_fb = "images/banner/logo_home.png";}
105 list($width, $height) = getimagesize($image_fb);
106 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_news.png"; }
107
108 $title_mt = $row_nw['cat_name']." | ".$row_config['title_news'];
109 $description_mt = $row_nw['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['short']),30))).", ".$row_config['description_news'];
110 $keyword_mt = str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_nw['name']." ".$row_nw['cat_name'])))).", ".$row_config['keyword_news'];
111
112 }elseif($_REQUEST['home']=='help'&& $_REQUEST['views'] != "")
113 {
114
115 $sql_hl=mysql_query("SELECT a.*,b.name as cat_name FROM help a left join help_cat b on b.id = a.cat_id where a.id='".$_REQUEST['views']."'");
116 $row_hl=mysql_fetch_assoc($sql_hl);
117
118 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['name']),30)));
119 if($title_fb == "") {$title_fb = $home['fb_title'];}
120 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['short']),30)));
121 if($description_fb == "") {$description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['content']),30)));}
122 if($description_fb == "") {$description_fb = $home['fb_description'];}
123 if(file_exists($row_hl['image'])){$image_fb = $row_hl['image'];}else{$image_fb = "images/banner/logo_home.png";}
124 list($width, $height) = getimagesize($image_fb);
125 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_help.png"; }
126
127 $title_mt = $row_hl['cat_name']." | ".$row_config['title_help'];
128 $description_mt = $row_hl['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['short']),30))).", ".$row_config['description_help'];
129 $keyword_mt = str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_hl['name']." ".$row_hl['cat_name'])))).", ".$row_config['keyword_help'];
130
131 }elseif($_REQUEST['home']=='category' && $_REQUEST['cat'] != "")
132 {
133 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from cat a left join cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
134 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
135
136 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
137 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_pro'];} else{$title_mt = $row_config['title_pro'];}
138
139 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
140 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_pro'];} else {$description_mt=$row_config['description_pro'];}
141
142 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
143 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_pro'];
144
145 $title_fb= $row_cat_pro['name']."| ".$title_mt;
146 $description_fb=$description_mt;
147 $image_fb="images/banner/logo_home.png";
148 }elseif($_REQUEST['home']=='adv' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
149 {
150 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from adv_cat a left join adv_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
151 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
152
153 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
154 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_adv'];} else{$title_mt = $row_config['title_adv'];}
155
156 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
157 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_adv'];} else {$description_mt=$row_config['description_adv'];}
158
159 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
160 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_adv'];
161
162 $title_fb= $row_cat_pro['name']."| ".$title_mt;
163 $description_fb=$description_mt;
164 $image_fb="images/banner/logo_home.png";
165 }elseif($_REQUEST['home']=='job' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
166 {
167 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from job_cat a left join job_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
168 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
169
170 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
171 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_job'];} else{$title_mt = $row_config['title_job'];}
172
173 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
174 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_job'];} else {$description_mt=$row_config['description_job'];}
175
176 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
177 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_job'];
178
179 $title_fb= $row_cat_pro['name']."| ".$title_mt;
180 $description_fb=$description_mt;
181 $image_fb="images/banner/logo_home.png";
182 }elseif($_REQUEST['home']=='company' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
183 {
184 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from company_cat a left join company_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
185 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
186
187 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
188 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_com'];} else{$title_mt = $row_config['title_com'];}
189
190 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
191 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_com'];} else {$description_mt=$row_config['description_com'];}
192
193 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
194 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_com'];
195
196 $title_fb= $row_cat_pro['name']."| ".$title_mt;
197 $description_fb=$description_mt;
198 $image_fb="upload/default/fb_company.png";
199 }elseif($_REQUEST['home']=='news' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
200 {
201 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from news_cat a left join news_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
202 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
203
204 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
205 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_news'];} else{$title_mt = $row_config['title_news'];}
206
207 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
208 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_news'];} else {$description_mt=$row_config['description_news'];}
209
210 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
211 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_news'];
212
213 $title_fb= $row_cat_pro['name']."| ".$title_mt;
214 $description_fb=$description_mt;
215 $image_fb="images/banner/logo_home.png";
216 }elseif($_REQUEST['home']=='help' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
217 {
218 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from help_cat a left join help_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
219 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
220
221 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
222 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_help'];} else{$title_mt = $row_config['title_help'];}
223
224 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
225 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_help'];} else {$description_mt=$row_config['description_help'];}
226
227 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
228 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_help'];
229
230 $title_fb= $row_cat_pro['name']."| ".$title_mt;
231 $description_fb=$description_mt;
232 $image_fb="images/banner/logo_home.png";
233 }
234 else
235 {
236 $title_fb = $home['fb_title'];
237 $description_fb = $home['fb_description'];
238 $image_fb="images/banner/logo_home.png";
239
240 $title_mt = $row_config['title'];
241 $description_mt = $row_config['description'];
242 $keyword_mt=$row_config['keyword'];
243 }
244 ?>
245 <?php
246 $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $_SERVER['QUERYSTRING'];
247 $urlParts = explode('.', $_SERVER['HTTP_HOST']);
248 if(strpos($url, 'www'))
249 {
250 $subdomain_value = $urlParts[1]; // có “www”
251 }
252 else
253 {
254 $subdomain_value = $urlParts[0]; // không có “www”
255 }
256 if($subdomain_value == 'dev' || $subdomain_value == 'DEV')
257 {
258 // viết hàm thực thi riêng cho subdomain gianhang.shopcantho.vn
259 }
260 else
261 {
262 // viết hàm thực thi riêng cho domain chính shopcantho.vn
263 } ?>
264 <?php
265 $ok1=array("www.");
266 $ok2=array("");
267 ?>
268 <?php
269 if($_SERVER['SERVER_NAME']=='localhost')
270 {?>
271 <?
272 $sql=mysql_query("SELECT * FROM user_shop where domain='".str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"])."' ");
273 $row=mysql_fetch_assoc($sql);
274 $sql7=mysql_query("SELECT * FROM template where id='".$row['template']."'");
275 $row7=mysql_fetch_assoc($sql7);
276 $tem=$row7['folder'];
277 $user=$row['user'];
278 $domain=$row['domain'];
279 $sql_mobile=mysql_query("SELECT mobile FROM config_mem where user='".$user."' ");
280 $row_mobile=mysql_fetch_assoc($sql_mobile);
281 ?>
282 <?}else{?>
283 <?
284 $sql=mysql_query("SELECT * FROM user_shop where user='".$subdomain_value."' or domain='".str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"])."'");
285 $row=mysql_fetch_assoc($sql);
286 $sql7=mysql_query("SELECT * FROM template where id='".$row['template']."'");
287 $row7=mysql_fetch_assoc($sql7);
288 $tem=$row7['folder'];
289 $user=$row['user'];
290 $domain=$row['domain'];
291 $sql_mobile=mysql_query("SELECT mobile FROM config_mem where user='".$user."' ");
292 $row_mobile=mysql_fetch_assoc($sql_mobile);
293 ?>
294 <?}?>
295 <?
296 if($row['domain']==str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"]))
297 {?>
298 <!--kiem tra khi co ten mien-->
299 <?if($tem=='')
300 {?>
301 <?include("template/mobile/index.php");?>
302 <?}else{?>
303 <?php if($row_mobile['mobile']=='0')
304 {?>
305 <?include($tem);?>
306 <?}else{?>
307 <?include("system/model/mobile.php");?>
308 <?}?>
309 <?}?>
310 <!--end kiem tra khi co ten mien-->
311 <?}elseif($subdomain_value==$user){?>
312 <!--kiem tra khi co subdomain-->
313 <?if($tem=='')
314 {?>
315 <?include("template/mobile/index.php");?>
316 <?}else{?>
317 <?php if($row_mobile['mobile']=='0')
318 {?>
319 <?include($tem);?>
320 <?}else{?>
321 <?include("system/model/mobile.php");?>
322 <?}?>
323 <?}?>
324 <!--end kiem tra subdomain-->
325
326 <?}else{?>
327 <?php include("system/model/mobile_home.php");?>
328 <?}?>
329 <?require("system/model/common_end.php") ?>
2 session_start();
3 $lang= isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'vn';
4 $_SESSION['lang']=$lang;
5 ?>
6 <?
7
8 if(isset($_SESSION['kiemtra']) && $_SESSION['kiemtra']=='ON')
9 {
10 setcookie("user", $_SESSION['log'], time()+180);
11 setcookie("pass", $_SESSION['pass'], time()+180);
12 }
13 ?>
14 <?require("system/model/config.php") ?>
15 <? require("system/model/common_start.php") ?>
16 <? require("system/model/function.php") ?>
17 <? require("system/model/tiengviet.php") ?>
18 <?php
19 //META and FACEBOOK
20 $sql_config=mysql_query("SELECT * FROM config ");
21 $row_config=mysql_fetch_assoc($sql_config);
22 if($_REQUEST['home']=='products' && $_REQUEST['views'] != "")
23 {
24 $sql_rv=mysql_query("SELECT a.*,b.code as currency_code,c.name as cat_name FROM products a left join currency b on a.currency = b.id left join cat c on c.id=a.cat where a.id='".$_REQUEST['views']."'");
25 $row_rv=mysql_fetch_assoc($sql_rv);
26
27 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['name']),30)));
28 if($title_fb == "") {$title_fb = $home['fb_title'];}
29 if($row_rv['price'] > 0) {$title_fb = $title_fb ." - ".$home['giaban']." ". number_format($row_rv['price']).$row_rv['currency_code'];}
30 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['content']),30)));
31 if($description_fb == "") {$description_fb = $home['fb_description'];}
32 if(file_exists($row_rv['img1'])){$image_fb = $row_rv['img1'];}else{$image_fb = "images/banner/logo_home.png";}
33 list($width, $height) = getimagesize($image_fb);
34 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_product.png"; }
35
36 $title_mt = $row_rv['cat_name']." | ".$row_config['title_pro'];
37 $description_mt = $row_rv['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_rv['short']),30))).", ".$row_config['description_pro'];
38 $keyword_mt = $row_rv['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_rv['name']." ".$row_rv['cat_name'])))).", ".$row_config['keyword_pro'];
39
40 }elseif($_REQUEST['home']=='adv'&& $_REQUEST['id'] != "")
41 {
42 $sql_ng=mysql_query("SELECT a.*,b.code as currency_code,c.name as cat_name FROM avd a left join currency b on a.currency = b.id left join adv_cat c on c.id = a.adv_cat where a.id='".$_REQUEST['id']."'");
43 $row_ng=mysql_fetch_assoc($sql_ng);
44
45 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['name']),30)));
46 if($title_fb == "") {$title_fb = $home['fb_title'];}
47 if($row_ng['price'] != "") {$title_fb = $title_fb ." - ".$home['giaban']." ". number_format($row_ng['price']).$row_ng['currency_code'];}
48 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['content']),30)));
49 if($description_fb == "") {$description_fb = $home['fb_description'];}
50 if(file_exists($row_ng['image'])){$image_fb = $row_ng['image'];}else{$image_fb = "images/banner/logo_home.png";}
51 list($width, $height) = getimagesize($image_fb);
52 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_adv.png"; }
53
54 $title_mt = $row_ng['cat_name']." | ".$row_config['title_adv'];
55 $description_mt = $row_ng['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_ng['content']),30))).", ".$row_config['description_adv'];
56 $keyword_mt = $row_ng['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_ng['name']." ".$row_ng['cat_name'])))).", ".$row_config['keyword_adv'];
57
58 }elseif($_REQUEST['home']=='job'&& $_REQUEST['id'] != "")
59 {
60 $sql_jb=mysql_query("SELECT a.*,b.name as cat_name FROM job a left join job_cat b on b.id = a.job_cat where a.id='".$_REQUEST['id']."'");
61 $row_jb=mysql_fetch_assoc($sql_jb);
62
63 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['name']),30)));
64 $title_fb = $title_fb." - ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['congty']),30)));
65 if($title_fb == "") {$title_fb = $home['fb_title'];}
66 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['content']),30)));
67 if($description_fb == "") {$description_fb = $home['fb_description'];}
68 if(file_exists($row_jb['image'])){$image_fb = $row_jb['image'];}else{$image_fb = "images/banner/logo_home.png";}
69 list($width, $height) = getimagesize($image_fb);
70 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_job.png"; }
71
72 $title_mt = $row_jb['cat_name']." | ".$row_config['title_job'];
73 $description_mt = $row_jb['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_jb['congty']),30))).", ".$row_config['description_job'];
74 $keyword_mt = $row_jb['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_jb['name']." ".$row_jb['cat_name']. " ".$row_jb['congty'])))).", ".$row_config['keyword_job'];
75
76 }elseif($_REQUEST['home']=='company'&& $_REQUEST['id'] != "")
77 {
78 $sql_cp=mysql_query("SELECT a.*,b.name as cat_name FROM company a left join company_cat b on a.company_cat = b.id where a.id='".$_REQUEST['id']."'");
79 $row_cp=mysql_fetch_assoc($sql_cp);
80
81 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['name']),30)));
82 $title_fb = $title_fb." - ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['cat_name']),30)));
83 if($title_fb == "") {$title_fb = $home['fb_title'];}
84 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['content']),30)));
85 if($description_fb == "") {$description_fb = $home['fb_description'];}
86 if(file_exists($row_cp['image'])){$image_fb = $row_cp['image'];}else{$image_fb = "upload/default/fb_company.png";}
87 list($width, $height) = getimagesize($image_fb);
88 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_company.png"; }
89
90 $title_mt = $row_cp['cat_name']." | ".$row_config['title_com'];
91 $description_mt = $row_cp['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_cp['content']),30))).", ".$row_config['description_com'];
92 $keyword_mt = $row_cp['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_cp['name']." ".$row_cp['cat_name'])))).", ".$row_config['keyword_com'];
93
94 }elseif($_REQUEST['home']=='news' && $_REQUEST['id'] != "")
95 {
96 $sql_nw=mysql_query("SELECT a.*,b.name as cat_name FROM news a left join news_cat b on a.cat_id = b.id where a.id='".$_REQUEST['id']."'");
97 $row_nw=mysql_fetch_assoc($sql_nw);
98
99 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['name']),30)));
100 if($title_fb == "") {$title_fb = $home['fb_title'];}
101 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['short']),30)));
102 if($description_fb == "") {$description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['content']),30)));}
103 if($description_fb == "") {$description_fb = $home['fb_description'];}
104 if(file_exists($row_nw['image'])){$image_fb = $row_nw['image'];}else{$image_fb = "images/banner/logo_home.png";}
105 list($width, $height) = getimagesize($image_fb);
106 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_news.png"; }
107
108 $title_mt = $row_nw['cat_name']." | ".$row_config['title_news'];
109 $description_mt = $row_nw['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_nw['short']),30))).", ".$row_config['description_news'];
110 $keyword_mt = str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_nw['name']." ".$row_nw['cat_name'])))).", ".$row_config['keyword_news'];
111
112 }elseif($_REQUEST['home']=='help'&& $_REQUEST['views'] != "")
113 {
114
115 $sql_hl=mysql_query("SELECT a.*,b.name as cat_name FROM help a left join help_cat b on b.id = a.cat_id where a.id='".$_REQUEST['views']."'");
116 $row_hl=mysql_fetch_assoc($sql_hl);
117
118 $title_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['name']),30)));
119 if($title_fb == "") {$title_fb = $home['fb_title'];}
120 $description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['short']),30)));
121 if($description_fb == "") {$description_fb = preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['content']),30)));}
122 if($description_fb == "") {$description_fb = $home['fb_description'];}
123 if(file_exists($row_hl['image'])){$image_fb = $row_hl['image'];}else{$image_fb = "images/banner/logo_home.png";}
124 list($width, $height) = getimagesize($image_fb);
125 //if($width < 100 || $height < 100) {$image_fb = "upload/default/fb_help.png"; }
126
127 $title_mt = $row_hl['cat_name']." | ".$row_config['title_help'];
128 $description_mt = $row_hl['cat_name'].", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['name']),30))).", ".preg_replace('/\s\s+/', ' ', trim(dwebvn(strip_tags($row_hl['short']),30))).", ".$row_config['description_help'];
129 $keyword_mt = str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$row_hl['name']." ".$row_hl['cat_name'])))).", ".$row_config['keyword_help'];
130
131 }elseif($_REQUEST['home']=='category' && $_REQUEST['cat'] != "")
132 {
133 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from cat a left join cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
134 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
135
136 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
137 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_pro'];} else{$title_mt = $row_config['title_pro'];}
138
139 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
140 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_pro'];} else {$description_mt=$row_config['description_pro'];}
141
142 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
143 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_pro'];
144
145 $title_fb= $row_cat_pro['name']."| ".$title_mt;
146 $description_fb=$description_mt;
147 $image_fb="images/banner/logo_home.png";
148 }elseif($_REQUEST['home']=='adv' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
149 {
150 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from adv_cat a left join adv_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
151 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
152
153 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
154 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_adv'];} else{$title_mt = $row_config['title_adv'];}
155
156 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
157 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_adv'];} else {$description_mt=$row_config['description_adv'];}
158
159 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
160 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_adv'];
161
162 $title_fb= $row_cat_pro['name']."| ".$title_mt;
163 $description_fb=$description_mt;
164 $image_fb="images/banner/logo_home.png";
165 }elseif($_REQUEST['home']=='job' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
166 {
167 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from job_cat a left join job_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
168 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
169
170 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
171 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_job'];} else{$title_mt = $row_config['title_job'];}
172
173 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
174 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_job'];} else {$description_mt=$row_config['description_job'];}
175
176 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
177 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_job'];
178
179 $title_fb= $row_cat_pro['name']."| ".$title_mt;
180 $description_fb=$description_mt;
181 $image_fb="images/banner/logo_home.png";
182 }elseif($_REQUEST['home']=='company' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
183 {
184 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from company_cat a left join company_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
185 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
186
187 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
188 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_com'];} else{$title_mt = $row_config['title_com'];}
189
190 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
191 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_com'];} else {$description_mt=$row_config['description_com'];}
192
193 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
194 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_com'];
195
196 $title_fb= $row_cat_pro['name']."| ".$title_mt;
197 $description_fb=$description_mt;
198 $image_fb="upload/default/fb_company.png";
199 }elseif($_REQUEST['home']=='news' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
200 {
201 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from news_cat a left join news_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
202 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
203
204 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
205 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_news'];} else{$title_mt = $row_config['title_news'];}
206
207 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
208 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_news'];} else {$description_mt=$row_config['description_news'];}
209
210 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
211 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_news'];
212
213 $title_fb= $row_cat_pro['name']."| ".$title_mt;
214 $description_fb=$description_mt;
215 $image_fb="images/banner/logo_home.png";
216 }elseif($_REQUEST['home']=='help' && $_REQUEST['cat'] != "" && $_REQUEST['act']=='cat' )
217 {
218 $sql_cat_pro=mysql_query("SELECT a.*,b.name as cat_name from help_cat a left join help_cat b on a.parent = b.id where a.id='".$_REQUEST['cat']."'");
219 $row_cat_pro=mysql_fetch_assoc($sql_cat_pro);
220
221 if($row_cat_pro['cat_name']!="") {$title_mt = $row_cat_pro['cat_name'];}
222 if($title_mt !="") {$title_mt=$title_mt."| ".$row_config['title_help'];} else{$title_mt = $row_config['title_help'];}
223
224 if($row_cat_pro['cat_name']!="") {$description_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$description_mt = $row_cat_pro['name'];}
225 if($description_mt !=""){$description_mt=$description_mt.", ".$row_config['description_help'];} else {$description_mt=$row_config['description_help'];}
226
227 if($row_cat_pro['cat_name']!="") {$keyword_mt = $row_cat_pro['cat_name'].", ".$row_cat_pro['name'];}else {$keyword_mt = $row_cat_pro['name'];}
228 $keyword_mt = $row_cat_pro['name'].", ".str_replace(" ",", ",preg_replace('/\s\s+/', ' ', trim(str_replace(array('.', ',', '(', ')', '{','}','[',']')," ",$keyword_mt)))).", ".$row_config['keyword_help'];
229
230 $title_fb= $row_cat_pro['name']."| ".$title_mt;
231 $description_fb=$description_mt;
232 $image_fb="images/banner/logo_home.png";
233 }
234 else
235 {
236 $title_fb = $home['fb_title'];
237 $description_fb = $home['fb_description'];
238 $image_fb="images/banner/logo_home.png";
239
240 $title_mt = $row_config['title'];
241 $description_mt = $row_config['description'];
242 $keyword_mt=$row_config['keyword'];
243 }
244 ?>
245 <?php
246 $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $_SERVER['QUERYSTRING'];
247 $urlParts = explode('.', $_SERVER['HTTP_HOST']);
248 if(strpos($url, 'www'))
249 {
250 $subdomain_value = $urlParts[1]; // có “www”
251 }
252 else
253 {
254 $subdomain_value = $urlParts[0]; // không có “www”
255 }
256 if($subdomain_value == 'dev' || $subdomain_value == 'DEV')
257 {
258 // viết hàm thực thi riêng cho subdomain gianhang.shopcantho.vn
259 }
260 else
261 {
262 // viết hàm thực thi riêng cho domain chính shopcantho.vn
263 } ?>
264 <?php
265 $ok1=array("www.");
266 $ok2=array("");
267 ?>
268 <?php
269 if($_SERVER['SERVER_NAME']=='localhost')
270 {?>
271 <?
272 $sql=mysql_query("SELECT * FROM user_shop where domain='".str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"])."' ");
273 $row=mysql_fetch_assoc($sql);
274 $sql7=mysql_query("SELECT * FROM template where id='".$row['template']."'");
275 $row7=mysql_fetch_assoc($sql7);
276 $tem=$row7['folder'];
277 $user=$row['user'];
278 $domain=$row['domain'];
279 $sql_mobile=mysql_query("SELECT mobile FROM config_mem where user='".$user."' ");
280 $row_mobile=mysql_fetch_assoc($sql_mobile);
281 ?>
282 <?}else{?>
283 <?
284 $sql=mysql_query("SELECT * FROM user_shop where user='".$subdomain_value."' or domain='".str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"])."'");
285 $row=mysql_fetch_assoc($sql);
286 $sql7=mysql_query("SELECT * FROM template where id='".$row['template']."'");
287 $row7=mysql_fetch_assoc($sql7);
288 $tem=$row7['folder'];
289 $user=$row['user'];
290 $domain=$row['domain'];
291 $sql_mobile=mysql_query("SELECT mobile FROM config_mem where user='".$user."' ");
292 $row_mobile=mysql_fetch_assoc($sql_mobile);
293 ?>
294 <?}?>
295 <?
296 if($row['domain']==str_replace($ok1,$ok2,$_SERVER["SERVER_NAME"]))
297 {?>
298 <!--kiem tra khi co ten mien-->
299 <?if($tem=='')
300 {?>
301 <?include("template/mobile/index.php");?>
302 <?}else{?>
303 <?php if($row_mobile['mobile']=='0')
304 {?>
305 <?include($tem);?>
306 <?}else{?>
307 <?include("system/model/mobile.php");?>
308 <?}?>
309 <?}?>
310 <!--end kiem tra khi co ten mien-->
311 <?}elseif($subdomain_value==$user){?>
312 <!--kiem tra khi co subdomain-->
313 <?if($tem=='')
314 {?>
315 <?include("template/mobile/index.php");?>
316 <?}else{?>
317 <?php if($row_mobile['mobile']=='0')
318 {?>
319 <?include($tem);?>
320 <?}else{?>
321 <?include("system/model/mobile.php");?>
322 <?}?>
323 <?}?>
324 <!--end kiem tra subdomain-->
325
326 <?}else{?>
327 <?php include("system/model/mobile_home.php");?>
328 <?}?>
329 <?require("system/model/common_end.php") ?>