http redirect loop ,multilangual website - php

I'm trying to make my site in two language, in English (en) and in Azerbaijani (az)
I store the language in the $_SESSION variable, the default language is English and I keep the language files in web root and Azerbaijani in an az folder.
My problem is when the language is changed for example to az I redirect the user to http://thephotofilm/az/...... and I dont want the users go to http://thephotofilm.com/...... because the current language is az so I tried some ways but sometimes I have redirect loops and I can't figure it out
$request_uri = $_SERVER['REQUEST_URI'];
if( isset($_SESSION['lang']) ) {
$lang=$_SESSION['lang'];
}
if( isset($_COOKIE['lang']) ) {
$lang=$_COOKIE['lang'];
}
if( $lang == "az" && strpos($request_uri,"/az/", 0) !== 0 ) {
header("Location: /az".$request_uri);
}
if( $lang=="en" && strpos($request_uri,"/az/", 0) === 0 ) {
header("Location: ".substr($request_uri, 3));
}

You can just set the path in a variable for selected version.
For eg:
if(english)
$base_url="http://thephotofilm.com/" // for English
else
$base_url="http://thephotofilm.com/az" // for Azerbaijani
Then start each link with variable $base_url

Related

How to automatically reflect changes when adding PHP cookie?

My website by default is in English
But I can change the language, when a visitor visits our website with a url of a news item in Spanish:
example.com/es/news/718/url-title-article/
The url given as an example is a news in Spanish since the first folder or directory is named "es" example.com/es/news/718/url-title-article/ -> es
And, that's where the trick comes, since I have a function that allows me to obtain the name of the first folder or directory and if it matches with the given parameters, it should set a cookie with the language of that url, in this case Spanish -> "es".
if($FOLDER_LANG === "es" || $SUBDOMAIN_LANG === "es") {
setcookie ('language', 'es', time()+60*60*24*365, '/', 'example.com');
}
if(isset($_COOKIE['language'])){
if($_COOKIE['language']==='en'){
$WEBSITE_TITLE = " | WebSIte EN";
$LANG = 'en';
$language = "en";
}elseif($_COOKIE['language']==='es'){
$WEBSITE_TITLE = " | WebSite ES";
$LANG = 'es';
$language = "es";
}
} else {
$WEBSITE_TITLE = " | WebSite DEFAULT EN";
$LANG = 'en';
$language = "en";
}
But the problem, is that I have to reload the page to see the changes of the new language added to the site.
So how can you solve it without having to reload the site.
You need to write the logic which determines the language so it doesn't depend on the cookie.
So, before, where you might have had something like:
$language_data = get_i18n_data( $_COOKIES['language'] );
You would instead have something like:
function get_language() {
if($FOLDER_LANG === "es" || $SUBDOMAIN_LANG === "es") {
setcookie ('language', 'es', time()+60*60*24*365, '/', 'example.com');
return 'es'
}
return $_COOKIES['language'];
}
$language_data = get_i18n_data( get_language() );
The reason for refresh being needed is that $LANG and $language is set by an existing cookie and not the new one.
Analysing your code:
if($FOLDER_LANG === "es" || $SUBDOMAIN_LANG === "es") {
setcookie ('language', 'es', time()+60*60*24*365, '/', 'example.com');
}
Here, it's setting the cookie only in the header. It is not accessible until the page is reloaded.
One option is to add the following in the if condition:
$LANG = 'es';
$language = "es";
The rest of your code then reads existing cookies so this is what will load on the same page even if the cookie is set just before it:
A better way in my opinion is to keep it simple and expandable by using variable $language to drive the data:
$language = 'en'; //this is default
if(isset($_COOKIE['language'])){
$language = $_COOKIE['language'];
}
//now check if current $language is different to folder
if($FOLDER_LANG != $language || $SUBDOMAIN_LANG != $language) {
//this is condition depends on your variables. You might need && if both conditions should be met or modify as required
//set the language for this page (so no need for refresh and also set the cookie
$language = $FOLDER_LANG ? $FOLDER_LANG : $SUBDOMAIN_LANG; //sets to folder or sudomain language code if $FOLDER_LANG is empty. You can switch the two folders to priotorise the latter.
//now set the cookie
setcookie ('language', $language, time()+60*60*24*365, '/', 'example.com');
}
//now set the the title and the extra variable $LANG (you probably should choose one variable to use)
$WEBSITE_TITLE = " | WebSite . strtoupper($language)";
$LANG = $language;
Now you can support more languages and also won't need to refresh

PHP how to do elseif final else statement to cover all other posibilities

I have a georedirect code for cloudflare which goes as follows
<?php
$URI = $_SERVER['REQUEST_URI'];
$activepage = $_SERVER['SERVER_NAME'];
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
if ($activepage=="www.example.co.uk" & $country_code=="CA") {
$link = 'http://www.example.us' . $URI;
header("location:$link");
exit;
}
elseif ($activepage=="www.example.co.uk" & $country_code=="US") {
$link = 'http://www.example.us' . $URI;
header("location:$link");
exit;
}
elseif ($activepage=="www.example.us" & $country_code=="GB") {
$link = 'http://www.example.co.uk' . $URI;
header("location:$link");
exit;
}
elseif ($activepage=="www.example.us" & $country_code=="UK") {
$link = 'http://www.example.co.uk' . $URI;
header("location:$link");
exit;
}
?>
effectively redirects UK/GB users from the US site back to the UK site, and US & Canadian users on the UK site over to the USD$ site (.us)
I want to add a final else statement so that all traffic which is not US or CA on the US site is redirected to the UK site (so for the rest of the world).
How am I best going about this?
Also this seems to be taking a long time to run (on a good server) how can I streamline this so it only runs as far as it needs to? E.g. the other elseif are not run in the background after the correct one is met? I thought the exit(); would do the trick but apparently not.
Thanks
So you need to add a new elseif that identifies when "site is US, and traffic is not US, and traffic is not CA" and is redirected to the UK site.
Here is an idea of how to do that - I've tidied up the code a bit, married the conditions which had the same outcome, and tidied the logic (without changing it). It's not tested, but use it how you want:
$URI = $_SERVER['REQUEST_URI'];
$activePage = $_SERVER['SERVER_NAME'];
$countryCode = $_SERVER["HTTP_CF_IPCOUNTRY"];
$redirectTld = '';
if (
$activePage == 'www.example.co.uk'
&& ($countryCode == 'CA' || $countryCode == 'US')
) {
$redirectTld = 'us';
} elseif (
$activePage == 'www.example.us'
&& ($countryCode == 'GB' || $countryCode == 'UK')
) {
$redirectTld = 'co.uk';
} elseif (
$activePage == 'www.example.us'
&& $countryCode != 'US'
&& $countryCode != 'CA'
) {
$redirectTld = 'co.uk';
}
if ($redirectTld) {
header('location: http://www.example.' . $redirectTld . $URI);
exit;
}
Note that this won't be a catch all as the conditions need to be met still, if you want a true catch all you'll need to just have an } else { with no conditions (but that didn't seem to be what your question asked for :) )
You could tidy it up even further by getting the page's TLD instead of full URL for $activePage and just checking the url (but I don't know how all your data/info works).
Also this seems to be taking a long time to run (on a good server) how
can I streamline this so it only runs as far as it needs to? E.g. the
other elseif are not run in the background after the correct one is
met? I thought the exit();
This tiny block of conditions shouldn't be a bottle neck, it could be the redirect time (redirecting and connecting to another URL or even server?), or something else.
PHP will stop evaluating a condition as soon as it cannot be met, and once one is met wont evaluate the others because they are "else".
https://stackoverflow.com/a/2535578/2632129

.htaccess Handle uri with php

I have a codebase that uses the logic,
if($_SERVER['HTTP_HOST'] == 'fr.example.com')
{
$_SESSION["lang"] = "fr";
}
elseif($_SERVER['HTTP_HOST'] == 'en.example.com')
{
$_SESSION["lang"] = "en";
}
I want:
www.example.com should serve english
www.example.com/fr should serve french.
All the text is served from the database.
How can I use same index.php to serve english and french content based on what language is there in the URI?
Since you want to handle this in PHP anyway, there is no need for an .htaccess file. Just use $_SERVER['REQUEST_URI'], e.g.
$uri = $_SERVER['REQUEST_URI'];
if (stripos($uri, "/fr/") === 0) {
// handle french
} elseif (stripos($uri, "/de/") === 0) {
// handle german
} else {
// handle english
}

Language redirect works on desktop but not mobile browser

I've put together a small script in PHP that checks for the browser's language settings and redirect them to a language version of the site (WP multisite),
function redirect() {
$language = substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 );
switch( $language ) {
case 'sv':
header( 'Location: http://www.example.com/sv/' );
break;
case 'no':
header( 'Location: http://www.example.com/no/' );
break;
case 'da':
header( 'Location: http://www.example.com/da/' );
break;
default:
header( 'Location: http://www.example.com/' );
break;
}
}
if ( strlen($url) < 4 ) {
session_start();
if ( empty($_SESSION[ 'language' ]) ) {
$_SESSION[ 'language' ] = true;
redirect();
}
}
When testing with Mobile Safari or Mobile Chrome the redirect doesn't appear to work. Is there any special output for the accept language for mobile browsers that I need to consider?
Update: After some more debugging I found out this:
Mobile Safari displays the correct language when echoing HTTP_ACCEPT_LANGUAGE but does not redirect.
Mobile Chrome (iOS only, works on Android) doesn't display the correct language (defaults to "en").
iOS parses the http header data in a different order, compare iOS Chrome (en-US,en;q=0.8,sv;q=0.6) and OSX Chrome (sv,en-US;q=0.8,en;q=0.6).
Try this and let us know the output please
function redirect() {
$language = substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 );
switch( $language ) {
case 'sv':
header( 'Location: http://www.example.com/sv/' );
break;
case 'no':
header( 'Location: http://www.example.com/no/' );
break;
case 'da':
header( 'Location: http://www.example.com/da/' );
break;
default:
die('Default location');
/* if you get this message on mobile devices, then this line
$language = substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 );
is faulty. Perhaps as #chris85 mentioned, HTTP_ACCEPT_LANGUAGE is
not populated so mobile behaves as a default by not redirecting to
other languages. If this is the case, fix that line
and remove the die();*/
header( 'Location: http://www.example.com/' );
break;
}
die(); // leave this one in. It forces the server to flush data to the browser
}
UPDATE to my previous answer
The HTTP_ACCEPT_LANGUAGE is set via headers and will give different values for everyone.
In my case I am in south america on an computer setup in english so my lang headers have english and spanish
settings with a bias towards english.
session_start();
function redirectToLang($langCode){
// use if's instead of switch so that you can
// check exact matches and presence of a substring
if ($langCode == 'sv'){
$langPath = 'sv';
}else if (strpos($langCode, 'en') !== false){ // this would match en, en-CA, en-US
$langPath = 'en';
}else if ($langCode == 'no'){
$langPath = 'no';
}else{
$langPath = 'en';
}
// you should have no output from the server before this line!
// that is no echoes, print_r, var_dumps, headers, etc
header( 'Location: http://www.example.com/' . $langPath .'/' );
die();
}
function parseLang(){
// echo $_SERVER['HTTP_ACCEPT_LANGUAGE']; in my case
// Chrome Mac OS: en,es;q=0.8
// Chrome Android 5.1: en-US;en;q=0.8,es;q=0.6
// IE Windows Phone 8.1: en-US,en;q=0.5
// Safari iOS: en-US
// Chrome iOS: en-US,en;q=0.8
// get the lang and set a default
$lang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en';
// parse the lang code. This can be as simple or as complex as you want
// Simple
$langCode = substr($lang, 0, 2); // in my case 'en'
// Semi Complex (credits to http://www.thefutureoftheweb.com/blog/use-accept-language-header)
$languages = array();
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $lang, $parsed);
if (count($parsed[1])) {
$languages = array_combine($parsed[1], $parsed[4]);
foreach ($languages as $lang => $val) {
if ($val === '') $languages[$lang] = 1;
}
arsort($languages, SORT_NUMERIC);
}
// var_dump($languages); in my case
// array (size=2)
// 'en' => int 1
// 'es' => string '0.8'
$langCode = key($languages); // in my case 'en'
return $langCode;
}
if (!isset($_SESSION['lang'])){
$langCode = parseLang();
$_SESSION['lang'] = $langCode;
redirectToLang($langCode);
}else{
// we already know the language and it is in $_SESSION
// no need to parseLang nor redirect
}
In my case, all devices redirect correctly. My guess is that there is something happening on the logic that calls redirect()
// this part
if ( strlen($url) < 4 ) {
session_start();
if ( empty($_SESSION[ 'language' ]) ) {
$_SESSION[ 'language' ] = true;
redirect();
}
}
and the session var
is bypassing the redirect logic. Try the code above and clear all cookies and sessions from all devices so that the $_SESSION['language'] var you have
set during testing wont mess up the results. Let us know what happens on your end.
I'm quoting..
"A more contemporary method would be to use http_negotiate_language():"
Did you check this one?
Using the PHP HTTP_ACCEPT_LANGUAGE server variable
This works fine on my desktop browsers, and mobile devices. I too was experiencing session problems on devices only and most often, I was relying on a session variable being empty to fulfill the requirements of my condition when in fact the variable was still in existence, or there simply was no session_id() instantiated.
?reset will clear the session.
It also will run the redirect if the language has changed.
<?php
session_start();
if (isset($_REQUEST['reset'])) {
unset($_SESSION);
$_SESSION['PREVIOUS_SESSION'] = '&cleared=1';
}
function redirect($loc) {
$_SESSION[ 'language' ] = true;
$_SESSION['last_language'] = $language;
header( 'Location: ?r='.$loc.$_SESSION['PREVIOUS_SESSION']);
}
$language = substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 );
if (( empty($_SESSION[ 'language' ]) ) || ($_SESSION['last_language'] != $language)) {
redirect($language);
}
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
if (!empty($_SESSION['PREVIOUS_SESSION'])) {
unset($_SESSION['PREVIOUS_SESSION']);
}
?>
You should really give us examples of what is the value of $_SERVER["HTTP_ACCEPT_LANGUAGE"] for the three cases.
Anyway, please note that according to the RFC2616 of HTTP/1.1, the choice of a language is much more complicated than just taking the two first chars of the header.
Each language-range MAY be given an associated quality value which
represents an estimate of the user's preference for the languages
specified by that range. The quality value defaults to "q=1". For
example,
Accept-Language: da, en-gb;q=0.8, en;q=0.7
would mean: "I prefer Danish, but will accept British English and
other types of English."
Nothing says that those headers are sorted, nor that the preffered language of the user is the first one in the list. And the language configuration could also not be configured in the browser or OS.
Ideally, to select the best language, you have to parse this header this way:
Split the string on commas
Split every substring found on the semicolon character
When a numeric value is not given, use the default value of 1.0
Sort the result using this numeric value
Compare this list to the list of languages that are available on your website and find the best one.
You really shouldn't rely on getting first two characters. You really need to rely on inspecting the whole string and understanding what the best language selection should be. Those string values have specific meaning, and for example in one of your cases of the "problem" strings, you would actually be doing most appropriate behavior to show en instead of sv. You can obviously write logic to break apart the accept language, investigate the constituent parts, and take appropriate action, but you also might consider using something like:
http_negotiate_language
to do this for you. There are probably dozens of other scripts available from quick google search to really work with this header in a more appropriate fashion than just looking at the two first characters.
Also, you can check out similar question here: Using the PHP HTTP_ACCEPT_LANGUAGE server variable

Including of files does not work as it should - url routing

My redirect process is showing some crazy stuff. The first part of the whole loop works just fine (if only the first element is typed in).
Possible url's look like:
www.site.com/category
www.site.com/category/product
But also:
www.site.com/cart
Using site.com/jeans works just fine. But when you click on a product, something strange happens.
The categorie.php file (used to display categories) is STILL included and after that one, the product.php file is included.
Same story with the cart page (http://www.site.com/winkelwagen/).
So my includes are wrong at some point. Winkelwagen is a folder on my site which has an index file. It should include http://www.site.com/winkelwagen/index.php and not categorie.php as well.
The route code :
<?php
$mult = Array();
if( ! empty( $_SERVER[ 'REQUEST_URI' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'REQUEST_URI' ], 1 ) );
} else if( ! empty( $_SERVER[ 'ORIG_PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'ORIG_PATH_INFO' ], 1 ) );
} else if( ! empty( $_SERVER[ 'PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'PATH_INFO' ], 1 ) );
}
if(empty($mult[0]))
{
include("comingsoon/index.html");
}
if(!empty($mult[0]) && empty($mult[1]))
{
$file = "$mult[0].php";
if($mult[0] == "index2")
{
include("index2.php");
die;
}
// if file exists include file
if(file_exists($file))
{
include($file);
}
else
{
$file2 = "/$mult[0]/index.php";
// if folder index file exists include that file
if(file_exists($file2))
{
include($file2);
}
else {
// if folder index file doesn't exist, send to category page
$_GET['q'] = $mult[0];
include("categorie.php");
}
}
}
if(!empty($mult[0]) && !empty($mult[1]))
{
if($mult[0] == "add")
{
$_GET['addid'] = $mult[1];
include("addtocart.php");
}
elseif($mult[0] == "remove")
{
$_GET['removeid'] = $mult[1];
include("deletefromcart.php");
}
// check if folder exists (first part of the url)
elseif(is_dir($mult[0]))
{
// check if file .php (second part of the url) exists
$filenew = "$mult[0]/$mult[1].php";
if(file_exists($filenew))
{
// include that file
include("$mult[0]/$mult[1].php");
}
else
{
// second file does not exist, do something
}
}
else
{
// folder does not exist so redirect to product page
$_GET['c'] = $mult[0];
$_GET['p'] = $mult[1];
include("product.php");
}
}
?>
I tried removing the categorie.php file but it still shows up (like, how on earth ?!)
I'm excited for the answer - I have absolutely no idea what I'm doing wrong.
Also nice to know: when I comment out the include(categorie.php) part in the route code, the file is STILL included...
Ok... Welcome to Stack Overflow. I'll start by saying you are allowed to post links, trying to disrupt links by using "dot" actually feels more like spam, to me at least.
I'll continue by advising you to not go with your site and that code public. It has various security vulnerabilities, to which I am not going to go into detail. But, let's just say I'm curious why your user is called d284h1 and why your site/home is on a mount point /mnt/home/d284h1...
Heed my words. You just posted your routing logic and your site on a very public site.
Regarding your code. I really hope that's SO destroying your indentation and not your actual source code.
You are missing some control logic. Some of them might have been leading to the file inclusions you were experiencing. I also noticed a possible bug, where you were testing and including a file from the root directory, instead of relatively to your site path.
Update: Actually looking back at your original code, absolutely referencing the file $file2 = "/$mult[0]/index.php"; was causing categorie.php to load. And not having proper control logic, was causing multiple inclusions to occur in the file.
Took the liberty of revising your code, mildly. The below code, should not continue to include any random files. Unless included files themselves do it.
$mult = array();
if( ! empty( $_SERVER[ 'REQUEST_URI' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'REQUEST_URI' ], 1 ) );
} else if( ! empty( $_SERVER[ 'ORIG_PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'ORIG_PATH_INFO' ], 1 ) );
} else if( ! empty( $_SERVER[ 'PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'PATH_INFO' ], 1 ) );
}
if (empty($mult[0])) {
include("comingsoon/index.html");
die; #missing
}
# no need to test for !empty($mult[0]), if it were empty, the above die would fire
if (empty($mult[1])) {
$file = "$mult[0].php";
if($mult[0] == "index2") {
include("index2.php");
die;
}
// if file exists include file
if (file_exists($file)) {
include($file);
die; # missing die
} # no need for else, you just die'd
# renamed $file2 to $file, don't use temporary variable names in global scope. It clutters your application
$file = "$mult[0]/index.php";# are you sure you meant to include from the root level?
// if folder index file exists include that file
if (file_exists($file)) {
include($file);
die;# missing die
} # no need for else, you just die'd
// if folder index file doesn't exist, send to category page
$_GET['q'] = $mult[0];
include("categorie.php");
die;# missing die
}
# don't do succesive if/elseif on the same variable, use a switch!
switch($mult[0]) {
case'add':
$_GET['addid'] = $mult[1];
include('addtocart.php');
break;
case'remove':
$_GET['removeid'] = $mult[1];
include('deletefromcart.php');
break;
}
if (is_dir($mult[0])) {
// check if file .php (second part of the url) exists
$filenew = "$mult[0]/$mult[1].php";
if(file_exists($filenew)) {
// include that file
include("$mult[0]/$mult[1].php");
die; # missing die
}
} else {
// folder does not exist so redirect to product page
$_GET['c'] = $mult[0];
$_GET['p'] = $mult[1];
include("product.php");
}
My updates are commented with # and this is in no way the final form it should look like. Take a look at PSR1 for a mild idea, on what coding standards are. They are meant to help and make you more proficient in your quest for the ultimate code, despite initially feeling cumbersome.
Other things I'd continue on doing are:
swapping !empty($var) with isset($var[0]), if $var is a string
swapping include($file);die; with return include $file;, if you're in the main scope
swapping if/elseif blocks with ternary operators
Actually regarding #3, here's an example:
$mult = isset($_SERVER['REQUEST_URI'][0])
? $_SERVER['REQUEST_URI']
: isset($_SERVER['ORIG_PATH_INFO'][0])
? $_SERVER['ORIG_PATH_INFO']
: isset($_SERVER['PATH_INFO'][0])
? $_SERVER['PATH_INFO']
: false
;
$mult = $mult
? explode('/', substr($mult, 1))
: array();
P.S. I did not fix the security issues you were having, as I believe the code you are using should not be used. Consider using a framework or at least learning from one. Routing is the corner stone of good MVC, you're on the right path, go one step beyond.
Can you please test this also and send your feedback, I just re-structured the code (I made the conditions more strict using if elseif else)
<?php
$mult = Array();
if( ! empty( $_SERVER[ 'REQUEST_URI' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'REQUEST_URI' ], 1 ) );
} else if( ! empty( $_SERVER[ 'ORIG_PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'ORIG_PATH_INFO' ], 1 ) );
} else if( ! empty( $_SERVER[ 'PATH_INFO' ] ) ) {
$mult = explode ( '/', substr ( $_SERVER[ 'PATH_INFO' ], 1 ) );
}
if(empty($mult[0]))
{
include("comingsoon/index.html");
}
elseif(!empty($mult[0]) && empty($mult[1]))
{
$file = "$mult[0].php";
if($mult[0] == "index2")
{
include("index2.php");
die;
}
else{
// if file exists include file
if(file_exists($file))
{
include($file);
}
else
{
$file2 = "/$mult[0]/index.php";
// if folder index file exists include that file
if(file_exists($file2))
{
include($file2);
}
else {
// if folder index file doesn't exist, send to category page
$_GET['q'] = $mult[0];
include("categorie.php");
}
}
}
}
elseif(!empty($mult[0]) && !empty($mult[1]))
{
if($mult[0] == "add")
{
$_GET['addid'] = $mult[1];
include("addtocart.php");
}
elseif($mult[0] == "remove")
{
$_GET['removeid'] = $mult[1];
include("deletefromcart.php");
}
// check if folder exists (first part of the url)
elseif(is_dir($mult[0]))
{
// check if file .php (second part of the url) exists
$filenew = "$mult[0]/$mult[1].php";
if(file_exists($filenew))
{
// include that file
include("$mult[0]/$mult[1].php");
}
else
{
// second file does not exist, do something
}
}
else
{
// folder does not exist so redirect to product page
$_GET['c'] = $mult[0];
$_GET['p'] = $mult[1];
include("product.php");
}
}
?>

Categories