$web="NUMEX";
ini_set('display_errors',1);
error_reporting (E_ALL ^ E_NOTICE);
// phpinfo();
header("Cache-Control: no-cache");
session_start();
/**
* make coolurl from text
* @param string $text
* @return string coolurl
*/
function CoolURL($s, $charlist = NULL, $lower = TRUE)
{
$s = strtr($s, '`\'"^~', '-----');
if (ICONV_IMPL === 'glibc') {
$s = @iconv('UTF-8', 'WINDOWS-1250//TRANSLIT', $s); // intentionally @
$s = strtr($s, "\xa5\xa3\xbc\x8c\xa7\x8a\xaa\x8d\x8f\x8e\xaf\xb9\xb3\xbe\x9c\x9a\xba\x9d\x9f\x9e\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2"
."\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe",
"ALLSSSSTZZZallssstzzzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTsraaaalccceeeeiiddnnooooruuuuyt");
} else {
$s = @iconv('UTF-8', 'ASCII//TRANSLIT', $s); // intentionally @
}
$s = str_replace(array('`', "'", '"', '^', '~'), '', $s);
if ($lower) $s = strtolower($s);
$s = preg_replace('#[^a-z0-9' . preg_quote($charlist, '#') . ']+#i', '-', $s);
$s = trim($s, '-');
return $s;
}
/* *************** diskuse.jakpsatweb.cz *** PHP FAQ ********************** */
function autoUTF($s)
{
// detect UTF-8
if (preg_match('#[\x80-\x{1FF}\x{2000}-\x{3FFF}]#u', $s))
return $s;
// detect WINDOWS-1250
if (preg_match('#[\x7F-\x9F\xBC]#', $s))
return iconv('WINDOWS-1250', 'UTF-8', $s);
// assume ISO-8859-2
return iconv('ISO-8859-2', 'UTF-8', $s);
}
function cs_mail ($to, $predmet, $zprava, $head = "", $email)
{
$predmet = "=?utf-8?B?".base64_encode(autoUTF ($predmet))."?=";
$shopname="Numex";
// $head .= "From: \"".$name."\" <".$email.">".PHP_EOL;
$head .= "MIME-Version: 1.0".PHP_EOL;
$head .= "Content-Type: text/html; charset=\"utf-8\"".PHP_EOL;
$head .= "Content-Transfer-Encoding: base64".PHP_EOL;
$head .= "From: =?UTF-8?B?".base64_encode(autoUTF($shopname))."?=<".$email.">".PHP_EOL;
$zprava = chunk_split(base64_encode (autoUTF ($zprava)));
$stav = mail ($to, $predmet, $zprava, $head);
return $stav ? TRUE : FALSE; }
/* ********************************************************************** ** */
function checkRemoteFile($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
// don't download content
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
if(curl_exec($ch)!==FALSE)
{
return true;
}
else
{
return false;
}
}
/*
# automatické doplneni koncoveho lomitka
if ( !ereg("/$", $_SERVER['REQUEST_URI']) && !strpos($_SERVER['REQUEST_URI'], "?") && !strpos($_SERVER['REQUEST_URI'], ".") ) {
header("Location: ".$_SERVER['REQUEST_URI']."/", 301);
return true;
}
*/
function najdiParent($parent){
list($id, $rodic) = DBFetchRow("SELECT `id`, parent FROM `eshop_categories` WHERE `id`=$parent");
if($rodic!=0){
return najdiParent($rodic);
}
else{
return $id;
}
}
function sestav_url($id){
//prichazi id posledni kategorie [nejvic vpravo v adrese]
global $cela_url,$names;
list($id,$name,$url,$parent)=DBFetchRow("SELECT `id`,`name`,`coolurl`,`parent` FROM `eshop_categories` WHERE `id`='".$id."'");
$cela_url[]=$url;
//echo $url." ";
$names[]=$name;
//echo $url;
if($parent) return sestav_url($parent);
else {
foreach($cela_url as $val){
//echo $val." ";
}
$cela_urlx=$cela_url;unset($cela_url);return $cela_urlx;}
}
function safe($value){
return mysql_real_escape_string($value);
}
function osetri($text){
return htmlspecialchars(stripslashes($text), ENT_QUOTES);
}
include 'conf.inc';
//include("svatky.php");
//include("svatky_psi.php");
//include("svatky_kocky.php");
list($product_count_home) = DBFetchRow("SELECT `value` FROM other WHERE `id`='product_count_home'");
if(!$_SESSION['pocet']){$_SESSION['pocet']=$product_count_home;}
if($_GET["page"]=="import"){ // import
include ("import.php");
}
$idecko=$_COOKIE["mws_id"];
$heslicko=$_COOKIE["mws_auth"];
if($idecko!=""){
$data = DBFetchRow("SELECT * FROM eshop_customers WHERE login='".$idecko."' AND password='".$heslicko."' ");
if(is_array($data)){
$prihlasen="ano";
$vo=$data[vo];
$id=$uid=$data["id"];
// prodlouzeni prihlaseni
setcookie("mws_id", $idecko, time()+60*60*24, "/");
setcookie("mws_auth", $heslicko, time()+60*60*24, "/");
}
}
$act=$_REQUEST['page'];
$id=$sekce=$_REQUEST['sekce'];
$usek=$_REQUEST['usek'];
$page=$_REQUEST['stranka'];
$adresa=$_SERVER['REQUEST_URI'];
$_REQUEST["kw"]=stripslashes(mysql_real_escape_string($_REQUEST["kw"]));
$kw=$_REQUEST['kw'];
if($prihlasen=="ano"){$obj = DBFetchRow ("SELECT * FROM eshop_customers WHERE login='".$idecko."' ");}
else{
$obj["name"]=$_POST["name"];$obj["surname"]=$_POST["surname"];$obj["street"]=$_POST["street"];$obj["town"]=$_POST["town"];
$obj["psc"]=$_POST["psc"];$obj["phone"]=$_POST["phone"];$obj["email"]=$_POST["email"];
$obj["d_name"]=$_POST["d_name"];$obj["d_surname"]=$_POST["d_surname"];$obj["d_street"]=$_POST["d_street"];$obj["d_town"]=$_POST["d_town"];
$obj["d_psc"]=$_POST["d_psc"];
}
$ttmode=$_REQUEST['ttmode']; //doprava
$ucomm=$_REQUEST['ucomm']; // poznamka
if($act=="objednavka2"){
$ucomm=str_replace("\n","",$ucomm);
$paymentinfo=str_replace("\n","",$paymentinfo);
$ucomm=str_replace("\r","",$ucomm);
$paymentinfo=str_replace("\r","",$paymentinfo);
$objednavka="ne";
if($obj["name"]!="" && $obj["surname"]!="" && $obj["street"]!="" && $obj["town"]!="" && $obj["psc"]!="" && $obj["phone"]!="" && $obj["email"]!=""){$objednavka="ano";}
if($_POST["da"]!=1){ // kdyz je je jina dorucovaci adresa
if($obj["d_name"]!="" && $obj["d_surname"]!="" && $obj["d_street"]!="" && $obj["d_town"]!="" && $obj["d_psc"]!=""){$objednavka="ano";}else{$objednavka="ne";}
}
if(!preg_match( "/[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}/", $obj["email"] )){$objednavka="ne";}
if($ttmode==""){$doprava="ne";}
if($objednavka=="ano" && $doprava!="ne")
{
if($_COOKIE["mws_cart"]=="objednano" || $_COOKIE["mws_cart"]==""){
if($_COOKIE["mws_cart"]=="objednano"){setcookie ("mws_cart", "", time() - 3600 , "/");}
}
else{setcookie ("mws_cart", "objednano", time() + 60*60*24*365, "/");}
}
}
//Start timer
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
include "cfunc.php";
require_once('Pager.class.php');
//VIEW CATS------------------------------------------------------------------------
//------------------------------------------------------------------------
if($act=="clanky" || $act==""){
include "modules/clanky.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="aktuality" || $act==""){
include "modules/aktuality.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="search"){
include "modules/search.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="mail"){
include "modules/mail.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="psi-kalendar"){
include "modules/psi-kalendar.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="kocici-kalendar"){
include "modules/kocici-kalendar.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="registrace"){
include "modules/registrace.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="login"){
include "modules/login.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="kosik"){
include "modules/viewcart.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act=="objednavka"){
include "modules/order_form.php";$test="ano";
}
//------------------------------------------------------------------------
else if($act!="" && $act!="objednavka2"){
include "modules/viewcategory.php";
}
//------------------------------------------------------------------------
else if($test!="ano" && $objednavka=="ano" && $doprava!="ne"){
include "modules/order_sender.php";$test="ano";
}
//------------------------------------------------------------------------
else if($test!="ano" && ($objednavka=="ne" || $doprava=="ne")){
if($objednavka=="ne"){$vypis.= "Nebyla vyplněna všechna povinná pole, nebo je e-mail ve špatném formátu.";}
if($doprava=="ne"){$vypis.= "
Nevybrali jste způsob dopravy.";}
include "modules/order_form.php";$test="ano";
}
//HEADER FILE
include "template/header.php";
if($act==""){
list($news_title) = DBFetchRow("SELECT `value` FROM other WHERE `id`='news_title'");
$databaze=$dbtables2["res"];
$data = "SELECT * FROM ".$databaze." WHERE `img`<>'' ORDER BY RAND()";
show_array($data,$query,$dbtables4,"");
}
else {if($nadpis){echo "