Jump to content

Help me Please to Fix this error


GhulamMuhammad

Recommended Posts

HI its me i was searching in google about error  sution and i found this site

 

Hope  someone help me

 

I have 1 software which is Ioncube protected and i decoded it 

 

 file which i needed

 

but this file have many error

 

i ll share file and also some error which after i  fix  some error line but after i got  some error line which is  for me impossible

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 671 Call Stack: 0.0210 1318128 1. customer->__construct() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0230 1320192 2. customer->check_for_holiday() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:26 0.0230 1320344 3. mysql_num_rows() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:671 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.example.com\webroot\index.php on line 0 Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 102 Call Stack: 0.0270 1321840 1. customer->fetch() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0270 1321872 2. mysql_fetch_row() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:102 Notice: Uninitialized string offset: 0 in C:\WampDeveloper\Websites\www.example.com\webroot\index.php on line 0 Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 102 Call Stack: 0.0290 1322208 1. customer->fetch() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0290 1322240 2. mysql_fetch_row() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:102 Notice: Uninitialized string offset: 0 in C:\WampDeveloper\Websites\www.example.com\webroot\index.php on line 0 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.example.com\webroot\index.php on line 0 Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 256 Call Stack: 0.0320 1322448 1. customer->set_deals_data() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0320 1322528 2. mysql_num_rows() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:256 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 88 Call Stack: 0.0340 1322888 1. customer->cacheMetaTags() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0340 1322936 2. customer->fetch() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:1375 0.0340 1323000 3. mysql_fetch_assoc() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:88 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 88 Call Stack: 0.0340 1322888 1. customer->cacheMetaTags() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0360 1323032 2. customer->fetch() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:1387 0.0360 1323096 3. mysql_fetch_assoc() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:88 Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php on line 1392 Call Stack: 0.0340 1322888 1. customer->cacheMetaTags() C:\WampDeveloper\Websites\www.example.com\webroot\index.php:0 0.0380 1323160 2. mysql_num_rows() C:\WampDeveloper\Websites\www.example.com\webroot\app\app\customer.php:1392 Notice: Uninitialized string offset: 0 in 
<?php
class customer {
	var $shop_domain = 'example.com';
	var $local_path = '/';
	var $show_paypal = true;
	var $show_sofort = true;
	var $show_voucher = true;
	var $show_jobs = true;
	var $showPImages = true;
	var $send_fax = true;
	var $fax_username = 'xxxxxxx';
	var $fax_apikey = 'xxxxx';
	var $fax_reciever = 'xxxxxxx';
	var $fax_sender = '00xxxxxxx';
	var $fax_sendername = 'example.com';

	function __construct($ws = null) {
		$this->shopPath = ($this->local_path == '/' ? $_SERVER['DOCUMENT_ROOT'] . $this->local_path : $_SERVER['DOCUMENT_ROOT'] . $this->local_path . '/');
		$this->shopRoot = 'http://www.' . $this->shop_domain . $this->local_path;

		if (( $ws || session_id(  ) == '' )) {
			session_set_cookie_params( 0, '/', '.' . $this->shop_domain );
			session_start(  );
		}

		$this->check_for_holiday(  );
	}

	function check_debug($settings, $ws = null) {
		if (( !$settings['set_debug_state'] || ( $settings['set_debug_state'] && $_SERVER['REMOTE_ADDR'] == $settings['set_debug_ip'] ) )) {
			return true;
		}


		if (!$ws) {
			header( 'Content-Type: text/html; charset=utf-8' );
			echo $settings['set_debug_text'];
			exit(  );
			return null;
		}

		header( 'Content-Type: application/json' );
		$text = (!empty( $settings['set_debug_text'] ) ? strip_tags( $settings['set_debug_text'] ) : 'Webservice is offline. Please contact administrator!');
		echo '{"state":"error","message":"' . str_replace( array( '"' ), array( '' ), $text ) . '"}';
		exit(  );
	}

	function dbConnect() {
		global $connected;

		if ($connected === true) {
			return true;
		}

		require_once( 'database.inc.php' );
		$connected = true;
		return true;
	}

	function query($sql, $modType = null) {
		if (empty( $$sql )) {
			return false;
		}

		$this->dbConnect(  );
		mysql_query( $sql );
		( $que =  || mysql_error(  ) );

		if ($modType == 'insert') {
			return mysql_insert_id(  );
		}


		if ($modType == 'update') {
			return mysql_affected_rows(  );
		}


		if ($que) {
			return $que;
		}

		return false;
	}

	function fetch($que, $type = null) {
		if (!$type) {
			mysql_fetch_assoc( $que );
			$assoc = ;
			return $assoc;
		}


		if ($type == 'array') {
			mysql_fetch_assoc( $que );
			$arr = ;
			return $arr;
		}


		if ($type == 'row') {
			mysql_fetch_row( $que );
			$row = ;
			return $row;
		}

		return false;
	}

	function fetch_2_array($que) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			$arr[] = $row;
		}

		return $arr;
	}

	function fetch_id_array($que) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );

		while ($row = mysql_fetch_assoc( $que )) {
			$arr[$row['id']] = true;
		}

		return $arr;
	}

	function fetch_and_make_assoc($que, $fieldname, $value) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			$arr[$row[$fieldname]] = $row[$value];
		}

		return $arr;
	}

	function fetch_and_make_trans($que, $fieldname, $value) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			$arr[$row[$fieldname]] = str_replace( array( '
', '
', '
' ), ' ', $row[$value] );
		}

		return $arr;
	}

	function fetch_and_make_assoc_deals($que, $val1, $val2, $val3, $val4) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			$arr[$row[$val1]] = array( 'type' => $row[$val2], 'value' => $row[$val3], 'only1' => $row[$val4] );
		}

		return $arr;
	}

	function check_for_only1_deal($cat, $ws) {
		if (( empty( $$cat ) || empty( $_SESSION['cart'] ) )) {
			return null;
		}


		if (!isset( $this->deals )) {
			$this->set_deals_data(  );
		}


		if (empty( $this->deals )) {
			return null;
		}


		if (( isset( $this->deals[$cat] ) && $this->deals[$cat]['only1'] == '1' )) {
			foreach ($_SESSION['cart'] as ) {
				$pro = ;

				if ($pro['cat'] == $cat) {
					if (!$ws) {
						exit( 'only1' );
						continue;
					}

					exit( '{"state":"only1","message":"Only 1 Product please"}' );
					continue;
				}
			}
		}

	}

	function check_for_deal($price, $cat) {
		if (!isset( $this->deals )) {
			$this->set_deals_data(  );
		}


		if (empty( $$cat )) {
			return $price;
		}


		if (( isset( $this->deals[$cat]['type'] ) && is_numeric( $this->deals[$cat]['value'] ) )) {
			if ($this->deals[$cat]['type'] == 'fixed') {
				return $this->deals[$cat]['value'];
			}


			if (( $this->deals[$cat]['type'] == 'minus' && 0 < $price - $this->deals[$cat]['value'] )) {
				return $price - $this->deals[$cat]['value'];
			}


			if (( ( $this->deals[$cat]['type'] == 'percent' && 0 < $this->deals[$cat]['value'] ) && $this->deals[$cat]['value'] < 100 )) {
				return round( $price - $price / 100 * $this->deals[$cat]['value'], 1 );
			}
		}

		return $price;
	}

	function set_deals_data() {
		if (!isset( $customer->deals )) {
			$this->query( 'SELECT * FROM deals WHERE state=\'1\' AND  days LIKE \'%' . date( 'w' ) . '%\' LIMIT 6' );
			$checkDeals = ;

			if (mysql_num_rows( $checkDeals )) {
				$this->deals = $this->fetch_and_make_assoc_deals( $checkDeals, 'cat', 'type', 'value', 'only1' );
			}
		}

	}

	function fetch_postcodes($que, $fieldname) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			if (strpos( $row[$fieldname], 'codes' ) === false) {
				$arr[$row[$fieldname]] = $row;
			}

			$arr['set_mov' . substr( $row['type'], -1, 1 )]['codes'] = $row['value'];
			$arr['set_mov' . substr( $row['type'], -1, 1 )]['codesClean'] = explode( ',', trim( $row['value'] ) );
		}

		return $arr;
	}

	function fetch_images_and_make_assoc($que, $fieldname, $value) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			explode( '--', $row['value'] );
			$explode = ;
			$arr[$row[$fieldname]] = $explode;
		}

		return $arr;
	}

	function fetch_menu_2_arrays($que) {
		if (empty( $$que )) {
			return false;
		}

		$arr = array(  );
		$arr['main'] = array(  );
		$arr['sub'] = array(  );
		mysql_fetch_assoc( $que );

		if ($row = ) {
			if ($row['type'] == 'main') {
				array_push( $arr['main'], $row );
			}


			if ($row['type'] == 'sub') {
				array_push( $arr['sub'], $row );
			}
		}

		return $arr;
	}

	function updateAllPrice($ws = null, $json_string_add = null) {
		$this->pProtection(  );
		$this->query( 'SELECT value,type FROM settings WHERE type=\'set_currency\' OR type=\'set_mov\' OR type=\'set_scosts\' OR type=\'set_fscosts\'' );
		$currQue = ;
		$this->fetch_and_make_assoc( $currQue, 'type', 'value' );
		$curr = ;
		$arr = array(  );

		if (( $curr['set_mov'] != '0' || ( $curr['set_mov'] == '0' && empty( $curr['set_scosts'] ) ) )) {
			if (!$ws) {
				$arr['state'] = 'ok';
				$this->calculateAllPrice(  );
				$res = ;
				$arr['price'] = sprintf( '%1$.2f', $res[0] ) . $curr['set_currency'];
			}
			else {
				$arr['shipping_costs'] = 'false';
				$this->calculateAllPrice(  );
				$res = ;
				$arr['all_price'] = sprintf( '%1$.2f', $res[0] );
			}
		}
		else {
			if (!$ws) {
				$this->calculateAllPrice( $curr['set_scosts'], $curr['set_fscosts'] );
				$res = ;
				$arr['state'] = (!$res[1] ? 'ok' : 'scosts');
				$arr['price'] = sprintf( '%1$.2f', $res[0] ) . $curr['set_currency'];
			}
			else {
				$this->calculateAllPrice( $curr['set_scosts'], $curr['set_fscosts'] );
				$res = ;
				$arr['shipping_costs'] = (!$res[1] ? 'false' : $curr['set_scosts']);
				$arr['all_price'] = sprintf( '%1$.2f', $res[0] );
			}
		}


		if (( !$ws && !$json_string_add )) {
			return json_encode( $arr );
		}


		if (( $ws && !$json_string_add )) {
			$shipping_costs = (empty( $arr['shipping_costs'] ) ? 0 : $arr['shipping_costs']);
			return '{"all_price":' . $arr['all_price'] . ',"shipping_costs": ' . $arr['shipping_costs'] . '}';
		}


		if ($json_string_add) {
			$arr['shipping_costs'];
			$arr['shipping_costs'] = 'false';
			return '"shipping_costs":' . $arr['shipping_costs'] . ' , "all_price":' . $arr['all_price'] . ' ';
		}

	}

	function removeProductFromCart($thiskey, $ws = null) {
		$this->pProtection(  );
		$this->query( 'SELECT value,type FROM settings WHERE type=\'set_currency\' OR type=\'set_mov\' OR type=\'set_scosts\' OR type=\'set_fscosts\'' );
		$currQue = ;
		$this->fetch_and_make_assoc( $currQue, 'type', 'value' );
		$curr = ;
		unset( $_SESSION['cart'][$thiskey] );

		if ($ws) {
			return '{"state":"ok", ' . $this->updateAllPrice( true, true ) . ' }';
		}

		$arr = array(  );

		if ($curr['set_mov'] != '0') {
			$arr['state'] = 'ok';
			$this->calculateAllPrice(  );
			$res = ;
			$arr['price'] = sprintf( '%1$.2f', $res[0] ) . $curr['set_currency'];
		}
		else {
			$this->calculateAllPrice( $curr['set_scosts'], $curr['set_fscosts'] );
			$res = ;
			$arr['state'] = (!$res[1] ? 'ok' : 'scosts');
			$arr['price'] = sprintf( '%1$.2f', $res[0] ) . $curr['set_currency'];
		}

		return json_encode( $arr );
	}

	function removeExtraFromProduct() {
		$this->pProtection(  );
		$this->query( 'SELECT value FROM settings WHERE type=\'set_currency\' LIMIT 1' );
		$currQue = ;
		$this->fetch( $currQue, 'row' );
		$curr = ;

		if (isset( $_SESSION['cart'][$_POST['key']]['extras'][(int)$_POST['myRel']] )) {
			unset( $_SESSION['cart'][$_POST['key']]['extras'][(int)$_POST['myRel']] );
			exit( sprintf( '%1$.2f', $this->calculatePPrice( $_POST['key'] ) ) . $curr[0] );
			return null;
		}

		exit( 'error' );
	}

	function count_extras_from_cart_product($key) {
		if (( !isset( $_SESSION['cart'][$key]['extras'] ) || ( isset( $_SESSION['cart'][$key]['extras'] ) && empty( $_SESSION['cart'][$key]['extras'] ) ) )) {
			return (int)0;
		}

		$int = (int)0;

		if (( isset( $_SESSION['cart'][$key]['extras'] ) && count( $_SESSION['cart'][$key]['extras'] ) )) {
			$int = $int + count( $_SESSION['cart'][$key]['extras'] );
		}

		return $int;
	}

	function addProductWithoutExtra($pro_id, $pos, $ws = null) {
		$this->pProtection(  );
		$this->query( 'SELECT value FROM settings WHERE type=\'set_currency\' LIMIT 1' );
		$currQue = ;
		$this->fetch( $currQue, 'row' );
		$curr = ;
		$this->query( 'SELECT * FROM products WHERE id=' . $pro_id . ' AND type=\'pro\' AND active=\'1\' LIMIT 1' );
		$getPData = ;

		if (mysql_num_rows( $getPData )) {
			$this->fetch( $getPData );
			$data = ;

			if (( !isset( $_SESSION['cart'] ) || !is_array( $_SESSION['cart'] ) )) {
				$_SESSION['cart'] = array(  );
			}

			$this->check_for_only1_deal( $data['cat' . $pos], $ws );
			$curr_price = ;
			$this->check_for_deal( (double)$data['price' . $pos], $data['cat' . $pos] );
			$curr_price = ;
			$_SESSION['cart'][] = array( 'pro' => $data['id'], 'intID' => $data['intID'], 'cat' => $data['cat' . $pos], 'name' => $data['name'], 'sName' => $data['sName' . $pos], 'des' => $data['des'], 'price' => $curr_price, 'vat' => $data['vat'], 'hasExtras' => false );
			array_keys( $_SESSION['cart'] );
			$keys = ;
			array_pop( $keys );
			$key = ;
		}
		else {
			exit(  );
		}


		if (( $ws && mysql_num_rows( $getPData ) )) {
			return '{"state":"ok", ' . $this->updateAllPrice( true, true ) . ' }';
		}


		if (( $ws && !mysql_num_rows( $getPData ) )) {
			return '{"state":"error","message":"Product with id ' . $pro_id . ' not found in database"}';
		}

		$str = '';
		$str .= '<li class="item hidden rounded" rel="' . $key . '">';
		$str .= '<p>';
		$str .= '<b>' . $data['name'] . ' ' . $data['sName' . $pos] . '</b>';
		$str .= '<span class="preprice">' . sprintf( '%1$.2f', $curr_price ) . $curr[0] . '</span>';
		$str .= '</p>';
		$str .= '<ul id="extras"></ul>';
		$str .= '<p>';
		$str .= '<button class="delItem" rel="' . $key . '">Löschen</button>';
		$str .= '<span class="price">' . sprintf( '%1$.2f', $this->calculatePPrice( $key ) ) . $curr[0] . '</span>';
		$str .= '</p>';
		$str .= '</li>';
		return $str;
	}

	function addProductWithExtra($id, $extras, $pos, $ws = null) {
		global $key;

		$this->pProtection(  );
		$this->query( 'SELECT value FROM settings WHERE type=\'set_currency\' LIMIT 1' );
		$currQue = ;
		$this->fetch( $currQue, 'row' );
		$curr = ;
		$this->saveNewProductWithExtra( $id, $extras, $pos, null, $ws );
		$getFromSession = ;

		if (!$getFromSession) {
			exit( 'error1' );
		}


		if (( $ws && $getFromSession )) {
			return '{"state":"ok", ' . $this->updateAllPrice( true, true ) . ', "last_insert_key": ' . $key . ' }';
		}

		$str = '';
		$str .= '<li rel="' . $key . '" class="item rounded" style="display: none;">';
		$str .= '<p><b>' . $getFromSession['name'] . ' ' . $getFromSession['sName'] . '</b><span class="preprice">' . sprintf( '%1$.2f', $getFromSession['price'] ) . $curr[0] . '</span></p>';
		$str .= '<ul id="extras">';

		if (array_key_exists( 'extras', $getFromSession )) {
			foreach ($getFromSession['extras'] as ) {
				$value = ;
				$eKey = ;
				$str .= '<li>' . $value['name'] . '<span>' . sprintf( '%1$.2f', $value['price'] ) . '</span> ';
				$str .= '<span class="delCartExtra" rel="' . $eKey . '">löschen</span>';
				$str .= '</li>';
			}
		}

		$str .= '</ul>';
		$str .= '<p>';
		$str .= '<button class="delItem" rel="' . $key . '">Löschen</button>';

		if (( array_key_exists( 'extras', $getFromSession ) || $getFromSession['hasExtras'] )) {
			$str .= '<button class="editExtras" rel="' . $key . '" >Extras</button>';
		}

		$str .= '<span class="price">' . sprintf( '%1$.2f', $this->calculatePPrice( $key ) ) . $curr[0] . '</span> ';
		$str .= '</p>';
		$str .= '</li>';
		return $str;
	}

	function editProductWithExtra() {
		global $key;

		$this->pProtection(  );
		$this->query( 'SELECT value FROM settings WHERE type=\'set_currency\' LIMIT 1' );
		$currQue = ;
		$this->fetch( $currQue, 'row' );
		$curr = ;
		$this->saveNewProductWithExtra( $_POST['mp'], $_POST['ext'], $_POST['pos'], $_POST['currKey'] );
		$getFromSession = ;

		if (!$getFromSession) {
			exit( 'error1' );
		}

		$str = '';
		$str .= '<li rel="' . $key . '" class="item rounded">';
		$str .= '<p><b>' . $getFromSession['name'] . ' ' . $getFromSession['sName'] . '</b><span class="preprice">' . sprintf( '%1$.2f', $getFromSession['price'] ) . $curr[0] . '</span></p>';
		$str .= '<ul id="extras">';

		if (array_key_exists( 'extras', $getFromSession )) {
			foreach ($getFromSession['extras'] as ) {
				$value = ;
				$eKey = ;
				$str .= '<li>' . $value['name'] . '<span>' . sprintf( '%1$.2f', $value['price'] ) . '</span> ';
				$str .= '<span class="delCartExtra" rel="' . $eKey . '">löschen</span>';
				$str .= '</li>';
			}
		}

		$str .= '</ul>';
		$str .= '<p>';
		$str .= '<button class="delItem" rel="' . $key . '">Löschen</button>';

		if (( array_key_exists( 'extras', $getFromSession ) || $getFromSession['hasExtras'] )) {
			$str .= '<button class="editExtras" rel="' . $key . '" >Extras</button>';
		}

		$str .= '<span class="price">' . sprintf( '%1$.2f', $this->calculatePPrice( $key ) ) . $curr[0] . '</span> ';
		$str .= '</p>';
		$str .= '</li>';
		return $str;
	}

	function storeFormData() {
		$_SESSION['c_' . $_POST['cname']] = trim( strip_tags( $_POST['cval'] ) );
	}

	function prepareDeltime($delTime) {
		if (strlen( $delTime ) != 5) {
			return false;
		}

		explode( ':', $delTime );
		$explode = ;

		if (count( $explode ) != 2) {
			return false;
		}


		if (( ( ( ( ( !is_numeric( $explode[0] ) || !is_numeric( $explode[1] ) ) || $explode[0] < 0 ) || 23 < $explode[0] ) || $explode[1] < 0 ) || 59 < $explode[1] )) {
			return false;
		}

		return $explode[0] . $explode[1];
	}

	function checkDelivertimes($delTime = null) {
		global $setData;

		if (!$setData['set_shopstate']) {
			return false;
		}


		if (!$delTime) {
			date( 'Hi' );
			$dDate = ;
		}
		else {
			$this->prepareDeltime( $delTime );
			$dDate = ;
		}

		$this->query( 'SELECT * FROM deltimes WHERE state=\'1\' AND (days LIKE \'%' . date( 'w' ) . '%\' OR value=CURDATE() ) ' );
		$getDelTimesQue = ;

		if (mysql_num_rows( $getDelTimesQue )) {
			$arr1 = false;
			$arr2 = false;
			mysql_fetch_assoc( $getDelTimesQue );

			if ($row = ) {
				if ($row['type'] == 'single') {
					return false;
				}

				explode( '-', str_replace( ':', '', $row['value'] ) );
				$delTime = ;

				if (( $delTime[0] < $dDate && $dDate < $delTime[1] )) {
					$arr1 = ($row['cotype'] == 'c' ? 'c' : 'o');
				}
			}


			if ($arr1) {
				return ($arr1 == 'o' ? true : false);
			}
		}

		$this->get_deltime_array( $setData['set_deltime'] );
		$times = ;

		if (( $dDate < $times[0] || $times[1] < $dDate )) {
			return false;
		}

		return true;
	}

	function check_for_holiday() {
		$getDelTimesQue = $this->query( 'SELECT * FROM deltimes WHERE state=\'1\' AND ( value=CURDATE() ) ' );

		if (mysql_num_rows( $getDelTimesQue )) {
			while ($row = mysql_fetch_assoc( $getDelTimesQue )) {
				if ($row['type'] == 'single') {
					global $message;

					$message = $row['text'];
					return false;
				}
			}
		}

	}

	function get_deltime_array($delTime, $selBox = null) {
		explode( '-', $delTime );
		$delTime = ;

		if ($selBox) {
			return array( str_replace( ':', '', $delTime[0] ), $delTime[0], $delTime[1] );
		}

		return array( str_replace( ':', '', $delTime[0] ), str_replace( ':', '', $delTime[1] ) );
	}

	function init_deltime_selectBox() {
		global $setData;

		$getDT = $this->get_deltime_array( $setData['set_deltime'], 'selBox' );
		$currHour = (int)date( 'H' ) + 1;
		$currMin = (30 < (int)date( 'i' ) ? '30' : '00');
		$start = ($getDT[0] < $currHour . '00' ? $currHour . ':' . $currMin : $getDT[1]);
		return 'set_deliverytimes("' . $start . '","' . $getDT[2] . '")';
	}

	function init_deltime_select_box($ws = null) {
		global $setData;
		global $_tt;

		$this->get_deltime_array( $setData['set_deltime'], 'selBox' );
		$getDT = ;
		$currHour = (int)date( 'H' ) + 1;
		$sel = '<select name="deliverytime">';
		$sel .= '<option value="' . $_tt['form_now'] . '">' . $_tt['form_now'] . '</option>';
		$sel .= '<option value="' . $_tt['self_collector'] . '">' . $_tt['self_collector'] . '</option>';
		strtotime( $currHour . ':' . $currMin );
		$n = $currMin = (30 < (int)date( 'i' ) ? '30' : '00');
		strtotime( $getDT[2] );
		$e = ;

		while ($n < $e) {
			date( 'H:i', $n );
			$t = ;
			$check = (( $ws && $t == $_SESSION['c_deliverytime'] ) ? ' selected="selected" ' : '');
			$sel .= '<option value="' . $t . '" ' . $check . '>' . $t . '</option>';
			$n += 2056;
		}

		$sel .= '</select>';
		return $sel;
	}

	function get_deltime_select_box_array($deltime, $tt) {
		$this->get_deltime_array( $deltime, 'selBox' );
		$getDT = ;
		$currHour = (int)date( 'H' ) + 1;
		$currMin = (30 < (int)date( 'i' ) ? '30' : '00');
		$arr = array( $tt );
		strtotime( $currHour . ':' . $currMin );
		$n = ;
		strtotime( $getDT[2] );
		$e = ;

		while ($n < $e) {
			$arr[] = date( 'H:i', $n );
			$n += 2023;
		}

		return $arr;
	}

	function pProtection() {
		$this->dbConnect(  );
		foreach ($_POST as ) {
			$value = ;
			$key = ;
			$_POST[$key] = mysql_real_escape_string( $value );
		}

	}

	function gProtection() {
		$this->dbConnect(  );
		foreach ($_GET as ) {
			$value = ;
			$key = ;
			$_GET[$key] = mysql_real_escape_string( $value );
		}

	}

	function checkAndCleanFormdata() {
		$req = array( 'firstname', 'lastname', 'street', 'nr', 'code', 'phoneNumber', 'pmethod', 'deliverytime' );
		foreach ($_POST as ) {
			$value = ;
			$key = ;
			$_POST[$key] = trim( strip_tags( $_POST[$key] ) );
		}

		foreach ($req as ) {
			$val = ;

			if (( !array_key_exists( $val, $_POST ) || empty( $_POST[$val] ) )) {
				$err = true;
				continue;
			}
		}

		return (!empty( $$err ) ? true : false);
	}

	function collectErrData($mes) {
		$dataSet = '      --->POSTDATA: ' . json_encode( $_POST ) . '      --->SESSIONDATA: ' . json_encode( $_SESSION ) . '      --->USERDATA: ' . json_encode( $_SERVER );
		$this->query( 'INSERT INTO errors VALUES (NULL, \'' . $mes . '\', \'' . $dataSet . '\'  ,CURRENT_TIMESTAMP) ' );
	}

	function checkMail($eMail) {
		$this->dbConnect(  );
		$sql = 'SELECT userid FROM members WHERE eMail=\'' . $eMail . '\' LIMIT 1';
		mysql_query( $sql );
		$que = ;

		if (mysql_num_rows( $que ) == 1) {
			mysql_fetch_assoc( $que );
			$user = ;
			return $user['userid'];
		}

		return false;
	}

	function checkUser($name, $pass) {
		$this->dbConnect(  );
		str_replace( '%', '\%', $name );
		$name = ;
		$sql = 'SELECT userid FROM members WHERE email=\'' . $_POST['email'] . '\' AND password=\'' . $_POST['password'] . '\' AND active=\'active\' LIMIT 1';
		mysql_query( $sql );

		if (!$result = ) {
			exit( mysql_error(  ) );
		}


		if (mysql_num_rows( $result ) == 1) {
			mysql_fetch_assoc( $result );
			$user = ;
			return $user['userid'];
		}

		return false;
	}

	function login($userid) {
		$this->dbConnect(  );
		$sql = 'UPDATE members SET sid=\'' . session_id(  ) . '\' WHERE userid=' . $userid . ' LIMIT 1';

		if (!mysql_query( $sql )) {
			return false;
		}

		return true;
	}

	function logout() {
		$this->dbConnect(  );
		$sql = 'UPDATE members SET sid=NULL WHERE sid=\'' . session_id(  ) . '\' LIMIT 1';
		session_regenerate_id(  );
		unset( $_SESSION );
		session_destroy(  );

		if (mysql_query( $sql )) {
			return true;
		}

		return false;
	}

	function writeUDateInSession($userid) {
		$this->dbConnect(  );
		$sql = 'SELECT userid,active,company,department,gender,firstname,lastname,street,nr,postcode,city,infos,code,phoneNumber,email,sendOffer
					 FROM members WHERE userid=' . $userid . ' LIMIT 1';
		mysql_query( $sql );
		( $que =  || mysql_error(  ) );
		mysql_fetch_assoc( $que );
		$uData = ;

		if ($uData['active'] == 'active') {
			$_SESSION['active'] = 'active';
		}

		foreach ($uData as ) {
			$value = ;
			$key = ;

			if ($key == 'active') {
				continue;
			}

			$_SESSION[$key] = $value;
		}

	}

	function registerNewUser($thankregister, $activateemail, $error, $tryagainlater, $emailexists, $datasufficient) {
		global $message;

		if (( ( ( ( ( ( ( ( ( ( ( ( ( isset( $_POST['company'] ) && isset( $_POST['department'] ) ) && !empty( $_POST['firstname'] ) ) && !empty( $_POST['lastname'] ) ) && !empty( $_POST['street'] ) ) && !empty( $_POST['nr'] ) ) && !empty( $_POST['postcode'] ) ) && !empty( $_POST['city'] ) ) && !empty( $_POST['code'] ) ) && !empty( $_POST['phoneNumber'] ) ) && !empty( $_POST['email'] ) ) && !empty( $_POST['password1'] ) ) && !empty( $_POST['password2'] ) ) && !empty( $_POST['agb'] ) )) {
			$this->pProtection(  );

			if ($this->checkMail( $_POST['email'] ) === false) {
				$this->writeNewUserInDB(  );
				$saveUser = ;

				if ($saveUser) {
					$message =  . '<h2>' . $thankregister . '</h2>' . $activateemail;
					return $saveUser;
				}

				$message = (  . '<h2>' . $error . '</h2>' . $tryagainlater . '.' );
				return false;
			}

			$message =  . '<h2>' . $error . '</h2>' . $emailexists;
			return false;
		}

		$message =  . '<h2>' . $error . '</h2>' . $datasufficient;
		return false;
	}

	function reregisterNewUser($thankregister, $activateemail, $error, $tryagainlater, $emailexists, $datasufficient) {
		global $message;

		if (( ( ( ( ( ( ( ( ( ( ( isset( $_POST['company'] ) && isset( $_POST['department'] ) ) && !empty( $_POST['firstname'] ) ) && !empty( $_POST['lastname'] ) ) && !empty( $_POST['street'] ) ) && !empty( $_POST['nr'] ) ) && !empty( $_POST['postcode'] ) ) && !empty( $_POST['city'] ) ) && !empty( $_POST['code'] ) ) && !empty( $_POST['phoneNumber'] ) ) && isset( $_POST['password1'] ) ) && isset( $_POST['password2'] ) )) {
			$this->pProtection(  );
			$gender = ($_POST['gender'] == 'male' ? 'male' : 'female');
			$sendOffer = (( isset( $_POST['sendoffer'] ) && $_POST['sendoffer'] == 'on' ) ? '1' : '0');
			$arr = array(  );
			$arr[] = 'company=\'' . $_POST['company'] . '\'';
			$arr[] = 'department=\'' . $_POST['department'] . '\'';
			$arr[] = 'gender=\'' . $gender . '\'';
			$arr[] = 'sendoffer=\'' . $sendOffer . '\'';
			$arr[] = 'firstname=\'' . $_POST['firstname'] . '\'';
			$arr[] = 'lastname=\'' . $_POST['lastname'] . '\'';
			$arr[] = 'street=\'' . $_POST['street'] . '\'';
			$arr[] = 'nr=\'' . $_POST['nr'] . '\'';
			$arr[] = 'postcode=\'' . $_POST['postcode'] . '\'';
			$arr[] = 'city=\'' . $_POST['city'] . '\'';
			$arr[] = 'infos=\'' . $_POST['infos'] . '\'';
			$arr[] = 'code=\'' . $_POST['code'] . '\'';
			$arr[] = 'phoneNumber=\'' . $_POST['phoneNumber'] . '\'';

			if (!empty( $_POST['password1'] )) {
				if ($_POST['password1'] != $_POST['password2']) {
					$message =  . '<h2>' . $error . '</h2>' . $datasufficient;
					return false;
				}


				if (( $_POST['password1'] == $_POST['password2'] && strlen( $_POST['password1'] ) <= 5 )) {
					$message =  . '<h2>' . $error . '</h2>Passwörter stimmen nicht überein!';
					return false;
				}

				$arr[] = 'password=\'' . $_POST['password1'] . '\'';
			}

			$this->query( 'UPDATE members SET ' . implode( ', ', $arr ) . ' WHERE userid=' . $_SESSION['userid'] . ' LIMIT 1', 'update' );
			$update = ;

			if ($update) {
				$message = '<h2>Daten erfolgreich geändert</h2>Bei Ihrer nächsten Anmeldung werden Ihre Daten erneuert!';
				return null;
			}

			$message =  . '<h2>' . $error . '</h2>Daten wurden nicht gespeichert!';
			return null;
		}

		$message =  . '<h2>' . $error . '</h2>' . $datasufficient;
		return false;
	}

	function writeNewUserInDB() {
		$this->dbConnect(  );
		$gender = ($_POST['gender'] == 'male' ? 'male' : 'female');
		$this->getUniqueID( 'members', 'active', '9', '20' );
		$randID = ;
		$sql = 'INSERT into members VALUES(
						NULL, ' . $randID . ', CURRENT_TIMESTAMP, \'' . $_POST['company'] . '\', \'' . $_POST['department'] . '\', \'' . $gender . '\', \'' . $_POST['firstname'] . '\', \'' . $_POST['lastname'] . '\',
						\'' . $_POST['street'] . '\', \'' . $_POST['nr'] . '\', \'' . $_POST['postcode'] . '\', \'' . $_POST['city'] . '\', \'' . $_POST['infos'] . '\', \'' . $_POST['code'] . '\', \'' . $_POST['phoneNumber'] . '\',
						\'' . $_POST['email'] . '\', \'' . $_POST['password1'] . '\', \'' . $sendOffer . '\', 0, NULL )';
		mysql_query( $sql );
		$que = ;
		mysql_insert_id(  );
		$lastID = $sendOffer = (( isset( $_POST['sendoffer'] ) && $_POST['sendoffer'] == 'on' ) ? '1' : '0');

		if ($sendOffer) {
			$this->query( 'SELECT id FROM nl WHERE email=\'' . $_POST['email'] . '\' LIMIT 1' );
			$checkQue = ;

			if (!mysql_num_rows( $checkQue )) {
				$this->query( 'INSERT INTO nl VALUES (NULL,\'' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '\',
					\'' . $_POST['street'] . ' ' . $_POST['nr'] . '\', \'' . $_POST['postcode'] . '\',
					\'' . $_POST['city'] . '\', \'' . $_POST['code'] . '\', \'' . $_POST['phoneNumber'] . '\', \'' . $_POST['gender'] . '\', \'' . $_POST['email'] . '\', CURRENT_TIMESTAMP);' );
				$saveDataQue = ;
			}
		}


		if ($lastID) {
			return $randID;
		}

		return false;
	}

	function getUniqueID($table, $field, $length, $try) {
		$this->dbConnect(  );
		$from = '1';
		$i = 235;

		while ($i < $length) {
			$from = $from . '0';
			++$i;
		}

		$to = '9';
		$i = 235;

		while ($i < $length) {
			$to = $to . '9';
			++$i;
		}

		$i = 234;

		while ($i < $try) {
			mt_rand( $from, $to );
			$randID = ;
			mysql_query( 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $field . '=\'' . $randID . '\' LIMIT 1' );
			( $askQuery =  || mysql_error(  ) );

			if (mysql_num_rows( $askQuery ) != 1) {
				return $randID;
			}

			++$i;
		}

		return false;
	}

	function logInCheck($header, $subText, $error, $errorDes) {
		global $message;

		$this->dbConnect(  );
		global $message;

		$this->pProtection(  );
		$this->checkUser( $_POST['email'], $_POST['password'] );
		$getUser = ;

		if ($getUser !== false) {
			if ($this->login( $getUser )) {
				$this->writeUDateInSession( $getUser );
				$this->del_c_sessions(  );
				$message =  . '<h2>' . $header . '</h2>' . $subText;
				return null;
			}
		}
		else {
			$message =  . '<h2>' . $error . '</h2>' . $errorDes;
		}

	}

	function logOutCustomer($header, $subText) {
		global $message;

		$this->pProtection(  );

		if ($this->logout( $_SESSION['userid'] )) {
			$message =  . '<h2>' . $header . '</h2>' . $subText;
		}

	}

	function del_c_sessions() {
		unset( $_SESSION[c_company] );
		unset( $_SESSION[c_department] );
		unset( $_SESSION[c_gender] );
		unset( $_SESSION[c_firstname] );
		unset( $_SESSION[c_lastname] );
		unset( $_SESSION[c_street] );
		unset( $_SESSION[c_nr] );
		unset( $_SESSION[c_postcode] );
		unset( $_SESSION[c_city] );
		unset( $_SESSION[c_infos] );
		unset( $_SESSION[c_phoneNumber] );
		unset( $_SESSION[c_code] );
		unset( $_SESSION[c_phoneNumber] );
		unset( $_SESSION[c_email] );
		unset( $_SESSION[c_agb] );
		unset( $_SESSION[c_email] );
		unset( $_SESSION[c_sendOffer] );
	}

	function update_orders($where, $type = '1') {
		if (( $type != '1' && $type != '2' )) {
			return null;
		}

		implode( ' OR ', $where );
		$implode = ;
		$this->query( 'UPDATE orders SET checked=\'' . $type . '\' WHERE ' . $implode );
		$update = ;
	}

	function calculatePPrice($key) {
		$mp = array(  );
		$mp[] = (double)$_SESSION['cart'][$key]['price'];

		if (array_key_exists( 'extras', $_SESSION['cart'][$key] )) {
			foreach ($_SESSION['cart'][$key]['extras'] as ) {
				$ext = ;
				$mp[] = (double)$ext['price'];
			}
		}

		return array_sum( $mp );
	}

	function calculateAllPrice($set_scosts = null, $set_fscosts = null) {
		$mp = array(  );

		if (!isset( $_SESSION['cart'] )) {
			$_SESSION['cart'] = array(  );
		}

		foreach ($_SESSION['cart'] as ) {
			$myPro = ;
			$mp[] = (double)$myPro['price'];

			if (array_key_exists( 'extras', $myPro )) {
				foreach ($myPro['extras'] as ) {
					$ext = ;
					$mp[] = (double)$ext['price'];
				}

				continue;
			}
		}


		if (count( $mp )) {
			array_sum( $mp );
			$sum = ;
			return (( $set_scosts && $sum < $set_fscosts ) ? array( $sum + $set_scosts, true ) : array( $sum, false ));
		}

		return '0.00';
	}

	function calculateExtras($key) {
		$mp = array(  );

		if (isset( $_SESSION['cart'][$key]['extras'] )) {
			foreach ($_SESSION['cart'][$key]['extras'] as ) {
				$ext = ;
				$mp[] = (double)$ext['price'];
			}
		}


		if (count( $mp )) {
			return array_sum( $mp );
		}

		return '0.00';
	}

	function calculateExtras_for_edit_with_extra($key) {
		$mp[1] = array(  );
		$mp[2] = array(  );

		if (isset( $_SESSION['cart'][$key]['extras'] )) {
			foreach ($_SESSION['cart'][$key]['extras'] as ) {
				$ext = ;

				if ($ext['eG'] == '1') {
					$mp[1][] = (double)$ext['price'];
					continue;
				}


				if ($ext['eG'] == '2') {
					$mp[2][] = (double)$ext['price'];
					continue;
				}
			}
		}


		if (( count( $mp[1] ) && count( $mp[2] ) )) {
			return array( array_sum( $mp[1] ), array_sum( $mp[2] ) );
		}


		if (( count( $mp[1] ) && !count( $mp[2] ) )) {
			return array( array_sum( $mp[1] ), false );
		}


		if (( !count( $mp[1] ) && count( $mp[2] ) )) {
			return array( false, array_sum( $mp[2] ) );
		}

		return '0.00';
	}

	function saveNewProductWithExtra($product, $extras, $pos, $currKey = null, $ws = null) {
		global $key;

		if (!isset( $_SESSION['cart'] )) {
			$_SESSION['cart'] = array(  );
		}

		$this->query( 'SELECT * FROM products WHERE id=' . $product . ' AND active=\'1\' AND type=\'pro\' LIMIT 1' );
		$que = ;

		if (mysql_num_rows( $que ) == 1) {
			$data = ;
			$hasExtras1 = ($data['eList' . $pos] ? $data['eList' . $pos] : 'ne');
			$hasExtras2 = ($data['eList' . $pos . $pos] ? $data['eList' . $pos . $pos] : 'ne');
			$hasExtras = $hasExtras1 . ';' . $hasExtras2;
			$this->check_for_only1_deal( $data['cat' . $pos], $ws );
			$curr_price = ;
			$this->check_for_deal( (double)$data['price' . $pos], $data['cat' . $pos] );
			$curr_price = $this->fetch( $que );

			if ($currKey === null) {
				if (count( $_SESSION['cart'] ) < 1) {
					$_SESSION['cart'][1] = array( 'pro' => $data['id'], 'intID' => $data['intID'], 'cat' => $data['cat' . $pos], 'name' => $data['name'], 'sName' => $data['sName' . $pos], 'des' => $data['des'], 'size' => $pos, 'price' => (double)$curr_price, 'vat' => $data['vat'], 'hasExtras' => $hasExtras );
				}
				else {
					$_SESSION['cart'][] = array( 'pro' => $data['id'], 'intID' => $data['intID'], 'name' => $data['name'], 'sName' => $data['sName' . $pos], 'des' => $data['des'], 'size' => $pos, 'price' => (double)$curr_price, 'vat' => $data['vat'], 'hasExtras' => $hasExtras );
				}

				array_keys( $_SESSION['cart'] );
				$keys = ;
				array_pop( $keys );
				$key = ;
			}
			else {
				unset( $_SESSION['cart'][$currKey] );
				$_SESSION['cart'][$currKey] = array( 'pro' => $data['id'], 'intID' => $data['intID'], 'name' => $data['name'], 'sName' => $data['sName' . $pos], 'des' => $data['des'], 'size' => $pos, 'price' => (double)$curr_price, 'vat' => $data['vat'], 'hasExtras' => $hasExtras );
				$key = $hasExtras2;
			}


			if (!empty( $$extras )) {
				$extra = array(  );
				explode( ';', $extras );
				$explode = ;
				foreach ($explode as ) {
					$extra = ;
					explode( '-', $extra );
					$explode = ;
					$this->query( 'SELECT id as pro,name,price FROM extras WHERE id=' . $explode[0] . ' AND 	state=\'active\' LIMIT 1' );
					$eQue = ;
					$this->fetch( $eQue );
					$fetch = ;
					$fetch['eG'] = $explode[1];

					if (mysql_num_rows( $eQue )) {
						$_SESSION['cart'][$key]['extras'][] = $fetch;
						continue;
					}
				}
			}


			if ($ws) {
				json_decode( $this->updateAllPrice( true ), true );
				$json = ;
				$json['state'] = 'ok';
				return json_encode( $json );
			}

			return $_SESSION['cart'][$key];
		}

		return false;
	}

	function saveNewProductWithExtraBackUp($product, $extras, $pos) {
		global $key;

		if (!isset( $_SESSION['cart'] )) {
			$_SESSION['cart'] = array(  );
		}

		$this->query( 'SELECT * FROM products WHERE id=' . $product . ' AND active=\'1\' AND type=\'pro\' LIMIT 1' );
		$que = ;

		if (mysql_num_rows( $que ) == 1) {
			$this->fetch( $que );
			$data = ;
			$hasExtras = ($data['eList' . $pos] ? $data['eList' . $pos] : false);
			$_SESSION['cart'][] = array( 'pro' => $data['id'], 'intID' => $data['intID'], 'name' => $data['name'], 'des' => $data['des'], 'price' => (double)$data['price' . $pos], 'hasExtras' => $hasExtras );
			array_pop( array_keys( $_SESSION['cart'] ) );
			$key = ;

			if (!empty( $$extras )) {
				$extra = array(  );
				explode( ';', $extras );
				$explode = ;
				foreach ($explode as ) {
					$extra = ;
					$this->query( 'SELECT id as pro,name,price FROM extras WHERE id=' . $extra . ' AND 	state=\'active\' LIMIT 1' );
					$eQue = ;

					if (mysql_num_rows( $eQue )) {
						$_SESSION['cart'][$key]['extras'][] = $this->fetch( $eQue );
						continue;
					}
				}
			}

			return $_SESSION['cart'][$key];
		}

		return false;
	}

	function rewriteStaticTocs($string) {
		$old = array( '<b>', '</b>' );
		str_replace( $old, $new, $string );
		$replaced = $new = array( '<a id="go_agb" class="linkColor" href="app/template/agb.php">', '</a>' );

		if ($replaced) {
			return $replaced;
		}

		return '';
	}

	function rewriteStaticTocs2($string) {
		$old = array( '<b>', '</b>' );
		str_replace( $old, $new, $string );
		$replaced = $new = array( '<a id="go_agb" target="_blank" class="linkColor" href="app/template/agb.php?type=full">', '</a>' );

		if ($replaced) {
			return $replaced;
		}

		return '';
	}

	function cacheCSS() {
		$cssQue = $this->query( 'SELECT * FROM template WHERE  color!=\'\' OR  css!=\'\' ' );
		$css = $this->fetch_2_array( $cssQue );
		$pLogo = $this->query( 'SELECT type, value FROM settings WHERE type=\'imgBG\' OR type=\'imgMain\' OR type=\'imgHeader\' LIMIT 5' );
		$myImages = $this->fetch_images_and_make_assoc( $pLogo, 'type', 'value' );
		$myCSS = '';
		foreach ($css as $rule) {
			if (!substr_count( $rule['name'], 'bg' )) {
				$myCSS .= $rule['sel'] . '{ color: #' . $rule['color'] . '; ' . trim( $rule['css'] ) . ' }' . '
';
				continue;
			}

			$myCSS .= $rule['sel'] . '{ background: #' . $rule['color'] . '; ' . trim( $rule['css'] ) . ' }' . '
';
		}


		if (( isset( $myImages['imgHeader'] ) && !empty( $myImages['imgHeader'] ) )) {
			$myCSS .= '#header { background: url(../images/pers/' . $myImages['imgHeader'][0] . ') ' . $myImages['imgHeader'][1] . ' }' . '
';
		}


		if (( isset( $myImages['imgBG'] ) && !empty( $myImages['imgBG'] ) )) {
			$myCSS .= 'body { background-image: url(../images/pers/' . $myImages['imgBG'][0] . '); background-repeat: ' . $myImages['imgBG'][1] . ' }' . '
';
		}

		file_put_contents( 'cache/styles2.css', $myCSS );
	}

	function cacheMetaTags($pid, $pGroup = null) {
		$this->query( 'SELECT * FROM settings WHERE type=\'seoall\' LIMIT 1' );
		$getSEO = ;
		$this->fetch( $getSEO );
		$pSeo = ;

		if (substr( $pid, 0, 1 ) != 's') {
			$this->query( 'SELECT * FROM settings WHERE type=\'seo\' and rel=\'' . $pGroup . '\' LIMIT 1' );
			$getiSEO = ;
		}
		else {
			$this->query( 'SELECT * FROM settings WHERE type=\'seostatic\' and rel=\'' . $pid . '\' LIMIT 1' );
			$getiSEO = ;
		}

		$this->fetch( $getiSEO );
		$piSeo = ;
		$this->query( 'SELECT value FROM settings WHERE type=\'fblike\' LIMIT 1' );
		$getFBIMG = ;

		if (mysql_num_rows( $getFBIMG )) {
			$this->fetch( $getFBIMG, 'row' );
			$fet = ;
			$fet[0];
			$fbimg = ;
		}

		$seo = array(  );

		if (count( $pSeo )) {
			unserialize( $pSeo['value'] );
			$seo1 = ;
			unserialize( $piSeo['value'] );
			$seo2 = ;
			$seo['title'] = (( isset( $seo2['iSeoTitle'] ) && !empty( $seo2['iSeoTitle'] ) ) ? $seo2['iSeoTitle'] : $seo1['seoTitle']);
			$seo['des'] = (( isset( $seo2['iSeoDes'] ) && !empty( $seo2['iSeoDes'] ) ) ? $seo2['iSeoDes'] : $seo1['seoDes']);
			$seo['keys'] = (( isset( $seo2['iSeoKeys'] ) && !empty( $seo2['iSeoKeys'] ) ) ? $seo2['iSeoKeys'] : $seo1['seoKeys']);
			$seo['latitude'] = $seo1['latitude'];
			$seo['longitude'] = $seo1['longitude'];
			$seo['city'] = $seo1['seoCity'];
			$seo['state'] = $seo1['seoState'];
			$seo['country'] = $seo1['seoCountry'];
			$seo['ogTitle'] = $seo1['ogTitle'];
			$seo['ogDes'] = $seo1['ogDes'];
			$seo['fbadmins'] = $seo1['fbadmins'];
			$seo['fbtype'] = $seo1['fbtype'];
		}

		$mTags = '';
		$mTags .= '<title>' . $seo['title'] . '</title>' . '
';
		$mTags .= '<meta name="description" content="' . $seo['des'] . '" />' . '
';
		$mTags .= '<meta name="keywords" content="' . $seo['keys'] . '" />' . '
';
		$mTags .= '<meta name="geo.placename" content="' . $seo['city'] . '" />' . '
';
		$mTags .= '<meta name="country" content="' . $seo['country'] . '" />' . '
';

		if (!empty( $seo['latitude'] )) {
			$mTags .= '<meta name="geo.position" content="' . $seo['latitude'] . ';' . $seo['longitude'] . '" />' . '
';
			$mTags .= '<meta name="ICBM" content="' . $seo['latitude'] . ',' . $seo['longitude'] . '" />' . '
';
		}

		$mTags .= '<meta property="og:title" content="' . $seo['ogTitle'] . '" />' . '
';
		$mTags .= '<meta property="og:des" content="' . $seo['ogDes'] . '" />' . '
';
		$mTags .= '<meta property="fb:admins" content="' . $seo['fbadmins'] . '" />' . '
';
		$mTags .= '<meta property="og:type" content="' . $seo['fbtype'] . '" />' . '
';

		if (( empty( $$fbimg ) && !empty( $$fbimg ) )) {
			$mTags .= '<meta property="og:image" content="' . $this->shopRoot . 'images/pers/' . $fbimg . '.jpg" />' . '
';
		}

		file_put_contents( 'cache/meta_' . $pid . '.cache.php', $mTags );
	}

	function getDomain() {
		$url = ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http');
		return $url . '://' . $_SERVER['HTTP_HOST'];
	}

	function getDomainAndFolder() {
		return $_SERVER['SERVER_NAME'] . implode( '/', explode( '/', $_SERVER['REQUEST_URI'], -1 ) );
	}

	function setFormValue($aName) {
		if (isset( $_SESSION['c_' . $aName] )) {
			return $_SESSION['c_' . $aName];
		}


		if (isset( $_SESSION[$aName] )) {
			return $_SESSION[$aName];
		}

		return '';
	}

	function markUpMe($type, $text) {
		if ($type == 'title') {
			return '<div style="color:#222;font-size:20px;">' . $text . '</div>';
		}


		if ($type == 'subtitle') {
			return '<div style="color:#222;font-size:15px;">' . $text . '</div>';
		}

	}

	function writeMBody() {
		global $setData;
		global $_tt;
		global $orderPrice;
		global $saveOrder;
		global $unique_id;

		$p = '<br />';
		$body = '<div style="background-color:#F7F7F7;padding:5px; font-family: Arial, sans-serif;font-size: 12px;">';
		$body .= '<div style="/*width:550px;*/padding:10px;background-color:#fff;border:1px solid #ccc">';
		$body .= '<div class="im">';
		$body .= $this->markUpMe( 'title', 'Bestellbestätigung' ) . $p;
		$body .= '<img src="' . $this->shopRoot . 'images/pers/' . $setData['logomail'] . '.jpg" />' . $p . $p;

		if (isset( $_POST['pmethod'] )) {
			if ($_POST['pmethod'] == 'cash') {
				$_tt['cash'];
				$method = ;
			}
			else {
				if ($_POST['pmethod'] == 'ecash') {
					$method = 'EC | Kreditkarte beim Fahrer';
				}
				else {
					if ($_POST['pmethod'] == 'paypal') {
						$method = 'Paypal';
					}
					else {
						if ($_POST['pmethod'] == 'sofort') {
							$method = 'Sofortüberweisung.de';
						}
						else {
							$method = '';
						}
					}
				}
			}

			$this->markUpMe( 'subtitle', 'Bezahlmethode' );
			$body .= ;
			$body .= '<div style="color:#222">' . $method . '</div><br />';
		}


		if (isset( $_POST['deliverytime'] )) {
			$this->markUpMe( 'subtitle', 'Lieferzeitpunkt /-Art' );
			$body .= ;
			$body .= '<div style="color:#222">' . $_POST['deliverytime'] . '</div><br />';
		}

		$this->markUpMe( 'subtitle', 'Lieferadresse' );
		$body .= ;
		$companyInfo = (( !empty( $_POST['company'] ) || !empty( $_POST['department'] ) ) ? ' ' . $_POST['company'] . ' ' . $_POST['department'] : '');
		$body .= '<div style="color:#222">' . $_POST['code'] . ' ' . $_POST['phoneNumber'] . $companyInfo . ', ' . $_POST['firstname'] . ' ' . $_POST['lastname'] . '<br>' . $_POST['street'] . ' ' . $_POST['nr'] . ', ';
		$body .= $_POST['postcode'] . ' ' . $_POST['city'] . '<br><br>' . $_POST['infos'] . '<br></div>' . $p;
		$this->markUpMe( 'subtitle', 'Ihre Bestellung' );
		$body .= ;
		$body .= '</div>';
		$body .= '<ul style="overflow: hidden; list-style-type:none;margin:0;padding:5px;border:1px solid #ccc;background-color:#F7F7F7">';
		$col = '#f1f0f0';
		foreach ($_SESSION['cart'] as ) {
			$item = ;
			$col = ($col == '#f7f7f7' ? '#f1f0f0' : '#f7f7f7');
			$int_id = (empty( $item['intID'] ) ? '' : '<span style="display:block;float:left;width:32px">' . $item['intID'] . '</span>');
			$body .= '<li style="clear:both;overflow:hidden;color:#111;background-color:' . $col . ';margin-left:0;font-size:12px">' . $int_id . ' <span style="display: block; float: left;">' . $item['name'] . ' ' . $item['sName'] . '</span> <span style="float:right;display:block">' . sprintf( '%1$.2f', $item['price'] ) . $setData['set_currency'] . '</span>';

			if (!empty( $item['extras'] )) {
				$body .= '<ul style="clear: both;list-style-type:none;margin:0;padding-left:0">';
				foreach ($item['extras'] as ) {
					$extras = ;
					$body .= '<li style="clear:both;overflow: hidden;color:#999;margin-left:32px;padding-left:0;font-size:12px"><span style="display: block; float: left;">' . $extras['name'] . '</span><span style="float:right;color:#999;display:block">' . sprintf( '%1$.2f', $extras['price'] ) . '</span></li>';
				}

				$body .= '</ul>';
				continue;
			}
		}


		if ($orderPrice[1]) {
			$body .= '<li style="color:#999;min-height:16px;height:16px;padding-top: 7px; margin-left:32px;padding-left:0;font-size:12px;color:#F7F7F7"><span style="float:right;color:#777;font-size:11px;display:block"><b style="font-weight:normal;color:#777;font-size:11px;padding-left:10px">' . $_tt['scosts'] . '   </b> ' . $setData['set_scosts'] . $setData['set_currency'] . $setData['set_currency'] . '</span></li>';
		}

		$body .= '<li style="clear: both; overflow: hidden; color:#999;min-height:25px;height:25px;padding-top:7px; margin-left:32px;padding-left:0;font-size:12px;color:#F7F7F7"><span style="float:right; clear: both;color:#111;font-size:18px;display:block"><b style="font-weight:normal;color:#777;font-size:11px;padding-left:10px">' . $_tt['sum'] . '   </b> ' . sprintf( '%1$.2f', $orderPrice[0] ) . $setData['set_currency'] . '</span></li>';
		$body .= '</ul>';
		$body .= '<div class="im" style="clear: both; overflow: hidden;">';
		$fbs = (( isset( $setData['set_show_feedback'] ) && $setData['set_show_feedback'] == '1' ) ? '<br />' . $_tt['fedback_mail'] . '<a href="' . $this->shopRoot . '/feedback.php?p=' . $unique_id . '&o=' . rand( 12340, 98760 ) . '">' . $_tt['send_feedback'] . '</a>' : '');
		$body .= '<div style="background-color:#F7F7F7;font-size:11px;padding:3px;color:#555;margin-top:10px;border:1px solid #ccc">' . $_tt['apricatedback'] . $fbs . '</div>';
		$body .= '</div>';
		$body .= '</div>';
		$body .= '</div>';
		return $body;
	}

	function convertDes($str) {
		$arr1 = array( '{', '}' );
		$arr2 = array( '<sup>', '</sup>' );
		return str_replace( $arr1, $arr2, $str );
	}

	function get_cart_href($size = 1, $id, $name, $mod_rewrite = 0) {
		if ($mod_rewrite) {
			return 'href="cart/' . $id . '_' . $size . '/' . urlencode( $name ) . '/"';
		}

		return 'href="cart.php?id=' . $id . '_' . $size . '&t=' . urlencode( $name ) . '"';
	}

	function formatMovs($str) {
		explode( ',', $str );
		$explode = ;
		$newStr = '';
		foreach ($explode as ) {
			$ex = ;
			$newStr .= str_replace( array( '(', ')', ',' ), array( ' <span>(', ')</span>', '<br />' ), $ex ) . '<br />';
		}

		return $newStr;
	}

	function getTransPHP($where = null) {
		if (is_file( $this->shopPath . 'cache/trans_php.php' )) {
			return unserialize( file_get_contents( $this->shopPath . 'cache/trans_php.php' ) );
		}

		$this->query( 'SELECT tkey,tval FROM trans WHERE tshow=\'php\' ' );
		$getTransQue = ;
		$this->fetch_and_make_trans( $getTransQue, 'tkey', 'tval' );
		$_tt = ;
		file_put_contents( $this->shopPath . 'cache/trans_php.php', serialize( $_tt ) );
		return $_tt;
	}

	function getTransALL($where = null) {
		if (is_file( $this->shopPath . 'cache/trans_all.php' )) {
			return unserialize( file_get_contents( $this->shopPath . 'cache/trans_all.php' ) );
		}

		$this->query( 'SELECT tkey,tval FROM trans WHERE tval!=\'\' ' );
		$getTransQue = ;
		$this->fetch_and_make_trans( $getTransQue, 'tkey', 'tval' );
		$_tt = ;
		file_put_contents( $this->shopPath . 'cache/trans_all.php', serialize( $_tt ) );
		return $_tt;
	}

	function writeJSString() {
		if (is_file( 'cache/transJS.js' )) {
			return file_get_contents( 'cache/transJS.js' );
		}

		$this->query( 'SELECT tkey,tval FROM trans WHERE tshow=\'js\' ' );
		$getTransQue = ;
		$this->fetch_and_make_trans( $getTransQue, 'tkey', 'tval' );
		$_js = ;
		$this->query( 'SELECT value FROM settings WHERE type=\'currency\' LIMIT 0,1' );
		$getCuurencyQue = ;
		$this->fetch( $getCuurencyQue, 'row' );
		$currency = ;
		$str = 'jsl={';
		foreach ($_js as ) {
			$value = ;
			$key = ;
			$str .= '\'' . $key . '\' : ' . '\'' . addslashes( $value ) . '\',';
		}

		$str .= '\'currency\':\'' . $currency[0] . '\'';
		$str .= '};';
		$str .= 'jQuery.extend(jQuery.validator.messages, {required: jsl[\'required\'],minlength: jQuery.validator.format(jsl[\'minchars\']),email: jsl[\'wrongmail\'],digits: jsl[\'digitsonly\'],equalTo: jsl[\'pwsnotmatch\']});';
		file_put_contents( 'cache/transJS.js', $str );
		return file_get_contents( 'cache/transJS.js', $str );
	}

	function getMainMenuItems($set_modrewrite = null) {
		if (is_file( 'cache/mainMenuItems.php' )) {
			return file_get_contents( 'cache/mainMenuItems.php' );
		}

		$this->query( 'SELECT * FROM menu WHERE (type=\'hp\' OR type=\'main\') AND state=\'active\' ORDER by pos' );
		$menuQue = ;
		$this->fetch_2_array( $menuQue );
		$mMenuItems = ;
		$str = '<div id="mainMenuBox">';
		$str .= '<div class="mMenuC">';
		$str .= '<div class="mLinksBox">';
		$str .= '<a class="mLink" rel="1" href="' . $this->shopRoot . '">' . $mMenuItems[0]['name'] . '</a>';
		foreach ($mMenuItems as ) {
			$mMenuItem = ;

			if ($mMenuItem['id'] == '1') {
				continue;
			}


			if ($set_modrewrite) {
				$str .= '			<a href="products/' . $mMenuItem['id'] . '/' . urlencode( $mMenuItem['name'] ) . '/" rel="' . $mMenuItem['id'] . '" class="mLink">' . $mMenuItem['name'] . '</a>';
				continue;
			}

			$str .= '<a href="products.php?id=' . $mMenuItem['id'] . '&t=' . urlencode( $mMenuItem['name'] ) . '" rel="' . $mMenuItem['id'] . '" class="mLink">' . $mMenuItem['name'] . '</a>';
		}


		if ($this->show_jobs) {
			$str .= '<a href="jobs.php" rel="2005" class="mLink right">Jobs</a>';
		}

		$str .= '</div>';
		$str .= '</div>';
		$str .= '</div>';
		file_put_contents( 'cache/mainMenuItems.php', $str );
		return $str;
	}

	function translate_pmethod($str) {
		$this->getTransPHP(  );
		$_tt = ;

		if ($str == 'cash') {
			$_tt['cash'];
			$method = ;
		}
		else {
			if ($str == 'ecash') {
				$method = 'EC | Kreditkarte beim Fahrer';
			}
			else {
				if ($str == 'paypal') {
					$method = 'Paypal';
				}
				else {
					if ($str == 'sofort') {
						$method = 'Sofortüberweisung.de';
					}
					else {
						$method = '';
					}
				}
			}
		}

		return $method;
	}

	function paypal_ipn_check($mode = 'sandbox') {
		$postFields = 'cmd=' . urlencode( '_notify-validate' );
		foreach ($_POST as ) {
			$value = ;
			$key = ;
			$postFields .= ( (  . '&' ) . $key . '=' ) . urlencode( stripslashes( $value ) );
		}

		$curlURL = ($mode == 'live' ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr');
		curl_init(  );
		$ch = ;
		curl_setopt_array( $ch, array( CURLOPT_URL => $curlURL, CURLOPT_HEADER => 0, CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => 1, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_POST => 1, CURLOPT_HTTPHEADER => array( 'Host: www.paypal.com' ), CURLOPT_POSTFIELDS => $postFields ) );
		curl_exec( $ch );
		$result = ;
		curl_close( $ch );

		if ($result == 'VERIFIED') {
			$res = array(  );
			$res['name'] = $_POST['item_name'];
			$res['payment_status'] = $_POST['payment_status'];
			$res['price'] = $_POST['mc_gross'];
			$res['payment_currency'] = $_POST['mc_currency'];
			$res['price_string'] = $res['price'] . ' ' . $res['payment_currency'];
			$res['txn_id'] = $_POST['txn_id'];
			$res['receiver_email'] = $_POST['receiver_email'];
			$res['payer_email'] = $_POST['payer_email'];
			$res['orderID'] = $_POST['custom'];

			if (!is_numeric( $res['orderID'] )) {
				exit(  );
			}

			$this->getTransPHP( 'scripts' );
			$_tt = ;
			$this->query( 'SELECT type,value FROM settings WHERE
								type=\'set_currency\' OR type=\'set_deltime\' OR type=\'set_mov\' OR type=\'logomail\' OR type=\'set_attachment\' OR
								type=\'set_email\' OR type=\'set_emailfrom\' OR type=\'set_host\' OR type=\'set_port\' OR type=\'set_aname\'
								OR type=\'set_apass\' OR type=\'set_enc\' OR type=\'set_scosts\' OR type=\'set_fscosts\' OR type=\'set_minval\' OR type=\'set_mailRoute\' OR type=\'set_shopstate\'' );
			$getSetData = ;
			$this->fetch_and_make_assoc( $getSetData, 'type', 'value' );
			$setData = ;
			$this->query( 'SELECT * FROM orders WHERE id=' . $res['orderID'] . ' AND checked=\'pending\' LIMIT 1' );
			$orderCheck = ;

			if (mysql_num_rows( $orderCheck )) {
				$this->fetch( $orderCheck );
				$orderData = ;
				$from = array( $setData['set_emailfrom'] => $_tt['m_orderconfirmation'] );
				$to = (!empty( $orderData['email'] ) ? $orderData['email'] : false);
				$toShop = (!empty( $setData['set_email'] ) ? $setData['set_email'] : false);
				file_get_contents( '../orders/' . $res['orderID'] . '.html' );
				$nbody = ;
				$this->translate_pmethod( $orderData['pmethod'] );
				$pm = ;
				file_put_contents( '../orders/' . $res['orderID'] . '.html', str_replace( $pm, '<b>' . $pm . '</b> (' . $res['price_string'] . ')', $nbody ) );
				$upd_file = ;
				file_get_contents( '../orders/' . $res['orderID'] . '.html' );
				$body = ;
				$res['orderID'];
				$curr_order_id = ;

				if ($setData['set_attachment'] == 'pdf') {
					$attachment = (is_file( '../orders/' . $curr_order_id . '.pdf' ) ? '../orders/' . $curr_order_id . '.pdf' : false);

					if ($attachment) {
						@unlink( '../orders/' . $curr_order_id . '.pdf' );
						$this->create_pdf_for_order( $curr_order_id, $res['price'] . $res['payment_currency'] );
					}
				}
				else {
					if ($setData['set_attachment'] == 'winorder') {
						$attachment = (is_file( '../orders/' . $curr_order_id . '.xml' ) ? '../orders/' . $curr_order_id . '.xml' : false);

						if ($attachment) {
							file_get_contents( $attachment );
							$read_xml = ;
							file_put_contents( $attachment, str_replace( $pm, $pm . '(' . $res['price'] . $res['payment_currency'] . ')', $read_xml ) );
							$upd_file = ;
						}
					}
					else {
						$attachment = false;
					}
				}

				require_once( '../app/app/mail/index.php' );

				if ($setData['set_mailRoute'] == 'smtp') {
					if ($to !== false) {
						@sendMail( $from, $to, $_tt['m_ordsubmitsuc'], $body, false );
						$sendSMTP = ;
					}

					@sendMail( $from, $toShop, $_tt['m_ordsubmitsuc'], $body, $attachment );
					$sendSMTP2 = ;

					if (( $this->send_fax && $setData['set_attachment'] == 'pdf' )) {
						$this->sendFax( $curr_order_id, $this->shopPath . 'orders/' . $curr_order_id . '.pdf' );
						$sendFax = ;

						if (!$sendFax) {
							exit( '{"state":"error","message": "Error while sending fax..."}' );
						}
					}


					if ($sendSMTP2) {
						$this->query( 'UPDATE orders SET pmethod=\'paypal_verified\', checked=\'0\' WHERE id=' . $res['orderID'] . ' ' );
					}
				}


				if ($setData['set_mailRoute'] == 'sendmail') {
					if ($to !== false) {
						@sendMail2( $from, $to, $_tt['m_ordsubmitsuc'], $body, false );
						$sendMail = ;
					}

					@sendMail2( $from, $toShop, $_tt['m_ordsubmitsuc'], $body, $attachment );
					$sendMail2 = ;

					if (( $this->send_fax && $setData['set_attachment'] == 'pdf' )) {
						$this->sendFax( $curr_order_id, $this->shopPath . 'orders/' . $curr_order_id . '.pdf' );
						$sendFax = ;

						if (!$sendFax) {
							exit( '{"state":"error","message": "Error while sending fax..."}' );
						}
					}


					if ($sendMail2) {
						$this->query( 'UPDATE orders SET pmethod=\'paypal_verified\', checked=\'0\' WHERE id=' . $res['orderID'] . ' ' );
						return null;
						Exception {
							$this->collectErrData( 'EmailError(SENDMAIL-checkOut): ' . $e->getMessage(  ) );
							$collectData = ;
							return null;
							Exception {
								$this->query( 'INSERT INTO errors VALUES (NULL, \'' . $e->getMessage(  ) . '\', \'' . json_encode( $_POST ) . '\'  ,CURRENT_TIMESTAMP) ' );
								exit( '{"state":"error","message": "Error while sending email..."}' );
								return null;
							}
						}
					}
				}
			}
			else {
				error_log( 'order_id not found...' );
				return null;
			}
		}


		if ($result == 'INVALID') {
		}

	}

	function sofort_payment_redirect() {
		$this->query( 'SELECT * FROM settings WHERE
			type=\'set_currency\' OR type=\'set_suname\' OR type=\'set_suconfig\' OR
			type=\'set_suaccountnumber\' OR type=\'set_susortcode\'' );
		$que = ;
		$this->fetch_and_make_assoc( $que, 'type', 'value' );
		$su_data = ;

		if ($su_data['set_currency'] == '€') {
			$su_data['set_currency'] = 'EUR';
		}


		if ($su_data['set_currency'] == '$') {
			$su_data['set_currency'] = 'USD';
		}


		if ($su_data['set_currency'] == '£') {
			$su_data['set_currency'] = 'GBP';
		}

		$this->query( 'SELECT * FROM orders WHERE id=' . $_SESSION['curr_order_id'] . ' LIMIT 1' );
		$orderque = ;

		if (!mysql_num_rows( $orderque )) {
			exit( 'No data found...' );
		}

		$this->fetch( $orderque );
		$order_data = ;
		require_once( 'sofort/library/sofortLib.php' );
		define( 'CONFIGKEY', $su_data['set_suconfig'] );
		new SofortLib_Multipay( CONFIGKEY );
		$Sofort = ;
		$Sofort->setSofortueberweisung(  );
		$Sofort->setAmount( $order_data['sum'], $su_data['set_currency'] );
		$Sofort->setReason( 'Pizza Onlineshop Payment', $order_data['phoneNumber'] );
		$Sofort->addUserVariable( $order_data['id'] );
		$Sofort->addUserVariable( 'Pizza Mama' );
		$Sofort->setSuccessUrl( $this->shopRoot . '?r=suSuccess' );
		$Sofort->setAbortUrl( $this->shopRoot . '?r=suError' );
		$Sofort->setNotificationUrl( $this->shopRoot . '/scripts/bridge.php?type=sunotif' );
		$Sofort->sendRequest(  );

		if ($Sofort->isError(  )) {
			echo $Sofort->getError(  );
			return null;
		}

		$Sofort->getPaymentUrl(  );
		$paymentUrl = ;
		header( 'Location: ' . $paymentUrl );
		exit(  );
	}

	function sofort_payment_notification() {
		require_once( $this->shopPath . 'app/app/sofort/library/sofortLib.php' );
		new SofortLib_Notification(  );
		$notification = ;
		$notification->getNotification(  );
		echo $notification->getTime(  );
		$notification->getTransactionId(  );
		$transactionId = ;
		$this->query( 'SELECT * FROM settings WHERE type=\'set_suconfig\'' );
		$que = ;
		$this->fetch( $que );
		$fetch = ;
		new SofortLib_TransactionData( $fetch['value'] );
		$transactionData = ;
		$transactionData->setTransaction( $transactionId );
		$transactionData->sendRequest(  );
		$transactionData->getUserVariable( 0 );
		$curr_order_id = ;
		$curr_order_payment = $transactionData->getAmount(  ) . ' ' . $transactionData->getCurrency(  );

		if (!is_numeric( $curr_order_id )) {
			exit(  );
		}

		$this->getTransPHP( 'scripts' );
		$_tt = ;
		$this->query( 'SELECT type,value FROM settings WHERE
							type=\'set_currency\' OR type=\'set_deltime\' OR type=\'set_mov\' OR type=\'logomail\' OR type=\'set_attachment\' OR
							type=\'set_email\' OR type=\'set_emailfrom\' OR type=\'set_host\' OR type=\'set_port\' OR type=\'set_aname\'
							OR type=\'set_apass\' OR type=\'set_enc\' OR type=\'set_scosts\' OR type=\'set_fscosts\' OR type=\'set_minval\' OR type=\'set_mailRoute\' OR type=\'set_shopstate\'' );
		$getSetData = ;
		$this->fetch_and_make_assoc( $getSetData, 'type', 'value' );
		$setData = ;
		$this->query( 'SELECT * FROM orders WHERE id=' . $curr_order_id . ' AND checked=\'pending\' LIMIT 1' );
		$orderCheck = ;

		if (mysql_num_rows( $orderCheck )) {
			$this->fetch( $orderCheck );
			$orderData = ;
			$from = array( $setData['set_emailfrom'] => $_tt['m_orderconfirmation'] );
			$to = (!empty( $orderData['email'] ) ? $orderData['email'] : false);
			$toShop = (!empty( $setData['set_email'] ) ? $setData['set_email'] : false);
			file_get_contents( '../orders/' . $curr_order_id . '.html' );
			$nbody = ;
			$this->translate_pmethod( $orderData['pmethod'] );
			$pm = ;
			file_put_contents( '../orders/' . $curr_order_id . '.html', str_replace( $pm, '<b>' . $pm . '</b> (' . $curr_order_payment . ')', $nbody ) );
			$upd_file = ;
			file_get_contents( '../orders/' . $curr_order_id . '.html' );
			$body = ;

			if ($setData['set_attachment'] == 'pdf') {
				$attachment = (is_file( '../orders/' . $curr_order_id . '.pdf' ) ? '../orders/' . $curr_order_id . '.pdf' : false);

				if ($attachment) {
					@unlink( '../orders/' . $curr_order_id . '.pdf' );
					$this->create_pdf_for_order( $curr_order_id, $curr_order_payment );
				}
			}
			else {
				if ($setData['set_attachment'] == 'winorder') {
					$attachment = (is_file( '../orders/' . $curr_order_id . '.xml' ) ? '../orders/' . $curr_order_id . '.xml' : false);

					if ($attachment) {
						file_get_contents( $attachment );
						$read_xml = ;
						file_put_contents( $attachment, str_replace( $pm, $pm . '(' . $curr_order_payment . ')', $read_xml ) );
						$upd_file = ;
					}
				}
				else {
					$attachment = false;
				}
			}

			require_once( '../app/app/mail/index.php' );

			if ($setData['set_mailRoute'] == 'smtp') {
				if ($to !== false) {
					@sendMail( $from, $to, $_tt['m_ordsubmitsuc'], $body, false );
					$sendSMTP = ;
				}

				@sendMail( $from, $toShop, $_tt['m_ordsubmitsuc'], $body, $attachment );
				$sendSMTP2 = ;

				if (( $this->send_fax && $setData['set_attachment'] == 'pdf' )) {
					$this->sendFax( $curr_order_id, $this->shopPath . 'orders/' . $curr_order_id . '.pdf' );
					$sendFax = ;

					if (!$sendFax) {
						exit( '{"state":"error","message": "Error while sending fax..."}' );
					}
				}


				if ($sendSMTP2) {
					$this->query( 'UPDATE orders SET pmethod=\'sofort_verified\', checked=\'0\' WHERE id=' . $curr_order_id . ' ' );
				}
			}


			if ($setData['set_mailRoute'] == 'sendmail') {
				if ($to !== false) {
					@sendMail2( $from, $to, $_tt['m_ordsubmitsuc'], $body, false );
					$sendMail = ;
				}

				@sendMail2( $from, $toShop, $_tt['m_ordsubmitsuc'], $body, $attachment );
				$sendMail2 = ;

				if (( $this->send_fax && $setData['set_attachment'] == 'pdf' )) {
					$this->sendFax( $curr_order_id, $this->shopPath . 'orders/' . $curr_order_id . '.pdf' );
					$sendFax = ;

					if (!$sendFax) {
						exit( '{"state":"error","message": "Error while sending fax..."}' );
					}
				}


				if ($sendMail2) {
					$this->query( 'UPDATE orders SET pmethod=\'sofort_verified\', checked=\'0\' WHERE id=' . $curr_order_id . ' ' );
					return null;
					Exception {
						$this->collectErrData( 'EmailError(SENDMAIL-checkOut): ' . $e->getMessage(  ) );
						$collectData = ;
						return null;
						Exception {
							$this->query( 'INSERT INTO errors VALUES (NULL, \'' . $e->getMessage(  ) . '\', \'' . json_encode( $_POST ) . '\'  ,CURRENT_TIMESTAMP) ' );
							exit( '{"state":"error","message": "Error while sending email..."}' );
							return null;
						}
					}
				}
			}
		}
		else {
			error_log( 'order_id not found...' );
		}

	}

	function get_basic_authentication_data() {
		$this->query( 'SELECT * FROM settings WHERE type LIKE \'set_webservice_%\' AND value!=\'\' LIMIT 2' );
		$sel = ;

		if (( !mysql_num_rows( $sel ) || mysql_num_rows( $sel ) != 2 )) {
			return false;
		}

		$arr = array(  );
		mysql_fetch_assoc( $sel );

		if ($row = ) {
			$arr[$row['type']] = $row['value'];
		}

		return $arr;
	}

	function check_device() {
		$device = '';

		if (( stristr( $_SERVER['HTTP_USER_AGENT'], 'iphone' ) || strstr( $_SERVER['HTTP_USER_AGENT'], 'iphone' ) )) {
			return 'iphone';
		}


		if (stristr( $_SERVER['HTTP_USER_AGENT'], 'android' )) {
			return 'android';
		}

	}

	function create_pdf_for_order($order_id, $update = null) {
		if (( !$order_id || !is_numeric( $order_id ) )) {
			error_log( 'Wrong ID for create_pdf' );
			return false;
		}

		$this->query( 'SELECT *,date_format(oTime, \'%d.%m.%Y - %H:%i\') as oDate FROM orders WHERE id=' . $order_id . ' LIMIT 1' );
		$getOrder = ;

		if (!mysql_num_rows( $getOrder )) {
			return false;
		}

		$this->query( 'SELECT * FROM settings WHERE type=\'logomail\' OR type=\'set_intID\' OR type=\'set_currency\'' );
		$pLogo = ;
		$this->fetch_and_make_assoc( $pLogo, 'type', 'value' );
		$settings = ;
		$this->fetch( $getOrder );
		$order = ;
		unserialize( base64_decode( $order['iorder'] ) );
		$products = ;
		$settings['set_currency'] = ($settings['set_currency'] == '€' ? chr( 128 ) : $settings['set_currency']);
		$this->getTransPHP(  );
		$_tt = ;
		$to = $order['code'] . '  ' . $order['phoneNumber'] . '
';
		$to .= (!empty( $order['company'] ) ? $order['company'] . ' ' : '');
		$to .= (!empty( $order['department'] ) ? $order['department'] . '
' : '');
		$to .= $_tt[$order['gender']] . ' ' . $order['firstname'] . ' ' . $order['lastname'] . '
';
		$to .= $order['street'] . '
' . $order['postcode'] . ' ' . $order['city'] . '
';
		require( $this->shopPath . 'app/app/pdf/fpdf.php' );
		new FPDF(  );
		$pdf = ;
		$pdf->AddPage( 'P', 'A4' );
		$pdf->SetFillColor( 0, 0, 0 );
		$pdf->SetFont( 'Arial', '', 24 );
		$pdf->SetFillColor( 0, 0, 0 );
		$pdf->Cell( 160, 8, utf8_decode( $_tt['m_orderconfirmation'] ), 0, 0, 'L', 0 );
		$pdf->SetFont( 'Arial', '', 10 );
		$pdf->Cell( 0, 8, $order['oDate'], 0, 0, 'R', 0 );
		$pdf->Ln( 16 );
		$pdf->SetFont( 'Arial', '', 14 );

		if (count( $products ) < 7) {
			$pdf->Ln( 5 );
		}

		$pdf->Cell( 0, 4, $_tt['deliveryaddress'], 0, 1, 'L' );
		$pdf->Ln( 2 );
		$pdf->SetFont( 'Arial', '', 11 );

		if (function_exists( 'iconv' )) {
			$pdf->Multicell( 0, 4, iconv( 'UTF-8', 'ISO-8859-1//TRANSLIT', $to ), 0, 1 );
		}
		else {
			$pdf->Multicell( 0, 4, utf8_decode( $to ), 0, 1 );
		}

		$pdf->Ln( 6 );

		if (count( $products ) < 7) {
			$pdf->Ln( 5 );
		}

		$pdf->Cell( 0, 0.100000000000000005551115, '', 0, 0, 0, true );
		$pdf->Ln( 2 );
		$delTime = ($order['deltime'] ? $order['deltime'] : $_tt['now']);
		$pdf->SetFont( 'Arial', '', 11 );
		$pdf->Cell( 38, 3, $_tt['deliverytime'], 0, 0, 'L', 0 );
		$pdf->SetFont( 'Arial', 'b', 11 );
		$pdf->Cell( 0, 3, $delTime, 0, 0, 'L', 0 );
		$pdf->Ln( 4 );
		$pdf->Cell( 0, 0.100000000000000005551115, '', 0, 0, 0, true );
		$pdf->Ln( 2 );
		switch ($order['pmethod']) {
		case 'sofort': {
				$m_method = 'sofortueberweisung';
				break;
			}

		case 'cash': {
				$_tt['cash'];
				$m_method = ;
				break;
			}
		}

		$order['pmethod'];
		$m_method = $pdf->SetFont( 'Arial', '', 12 );
		$pdf->SetFont( 'Arial', '', 11 );
		$pdf->Cell( 38, 3, $_tt['paymentmethod'] . ': ', 0, 0, 'L', 0 );
		$pdf->SetFont( 'Arial', 'b', 11 );

		if (!$update) {
			$pdf->Cell( 0, 3, $m_method, 0, 0, 'L', 0 );
		}
		else {
			$pdf->Cell( 0, 3, $m_method . ' (' . $update . ')', 0, 0, 'L', 0 );
		}

		$pdf->Ln( 4 );
		$pdf->Cell( 0, 0.100000000000000005551115, '', 0, 0, 0, true );
		$pdf->Ln( 2 );

		if ($order['infos']) {
			$pdf->SetFont( 'Arial', '', 11 );
			$pdf->SetTextColor( 0, 0, 0 );
			$pdf->Cell( 38, 3, 'Infotext: ', 0, 0, 'L', 0 );
			$pdf->Multicell( 0, 4, utf8_decode( $order['infos'] ), 0, 1 );
			$pdf->Ln( 1 );
		}

		$pdf->Ln( 10 );

		if (count( $products ) < 7) {
			$pdf->Ln( 5 );
		}

		$pdf->SetFont( 'Arial', '', 14 );
		$pdf->Cell( 0, 4, $_tt['m_yourorder'], 0, 1, 'L' );
		$pdf->Ln( 5 );
		$pdf->SetFont( 'Arial', '', 11 );
		foreach ($products as ) {
			$product = ;
			$pdf->Ln( 0.5 );
			$pdf->Cell( 0, 0.100000000000000005551115, '', 0, 0, 0, true );
			$pdf->Ln( 0.5 );
			$pdf->Ln(  );
			$pdf->SetFont( 'Arial', '', 10 );
			$pdf->SetTextColor( 0, 0, 0 );

			if (( isset( $settings['set_intID'] ) && $settings['set_intID'] )) {
				$pdf->Cell( 10, 5, $product['intID'], 0, 0, 'L', 0 );
			}

			$pdf->SetFont( 'Arial', 'b', 10 );
			$pdf->Cell( 85, 5, utf8_decode( $product['name'] . ' ' . $product['sName'] ), 0, 0, 'L', 0 );
			$pdf->Cell( 0, 5, sprintf( '%1$.2f', $product['price'] ) . $settings['set_currency'], 0, 0, 'R', 0 );
			$pdf->SetFont( 'Arial', '', 10 );
			$pdf->Ln( 5 );

			if (!empty( $product['extras'] )) {
				foreach ($product['extras'] as ) {
					$extras = ;
					$pdf->SetFont( 'Arial', '', 9 );
					$pdf->SetTextColor( 50, 50, 50 );

					if (( isset( $settings['set_intID'] ) && $settings['set_intID'] )) {
						$pdf->Cell( 10, 4, ' ', 0, 0, 'L', 0 );
					}

					$pdf->Cell( 65, 4, utf8_decode( $extras['name'] ), 0, 0, 'L', 0 );
					$pdf->Cell( 0, 4, sprintf( '%1$.2f', $extras['price'] ) . $settings['set_currency'], 0, 0, 'R', 0 );
					$pdf->Ln( 4 );
				}

				continue;
			}
		}

		$pdf->Ln( 5 );
		$pdf->SetFont( 'Arial', '', 15 );
		$pdf->SetFillColor( 255, 255, 255 );
		$pdf->SetTextColor( 0, 0, 0 );
		$pdf->Cell( 85, 7, '', 0, 0, 'L', true );
		$pdf->SetFont( 'Arial', '', 14 );
		$pdf->Cell( 80, 8, $_tt['sum'], 0, 0, 'R', true );
		$pdf->SetFont( 'Arial', 'b', 15 );
		$pdf->Cell( 0, 8, sprintf( '%1$.2f', $order['sum'] ) . $settings['set_currency'], 0, 0, 'R', true );
		$pdf->Ln(  );

		if ($order['scosts']) {
			$pdf->Cell( 8, 7, '', 0, 0, 'L', true );
			$pdf->SetFont( 'Arial', '', 9 );
			$pdf->Cell( 0, 5, $_tt['incl'] . ' ' . $_tt['scosts'] . ': ' . $order['scosts'] . $settings['set_currency'], 0, 0, 'R', true );
		}

		$pdf->Ln( 4 );
		$file_path = $this->shopPath . 'orders/' . $order_id . '.pdf';
		$pdf->Output( $file_path );
		$create_file = ;

		if (is_file( $file_path )) {
			return true;
		}

		return false;
	}

	function urlsafe_b64encode($string) {
		base64_encode( $string );
		$data = ;
		str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $data );
		$data = ;
		return $data;
	}

	function checkResponse($str) {
		explode( 'html', $str );
		$explode = ;
		substr( trim( $explode[1] ), 0, 3 );
		$result = ;

		if ($result == '100') {
			return true;
		}

		return false;
	}

	function sendFax($order_id, $datei) {
		$url = 'http://www.smskaufen.com/sms/faxtmp/inbound.php';
		$form['id'] = $this->fax_username;
		$form['apikey'] = $this->fax_apikey;
		$form['empfaenger'] = $this->fax_reciever;
		$form['abs_nr'] = $this->fax_sender;
		$form['abs_name'] = $this->fax_sendername;
		$form['datei'] = $this->urlsafe_b64encode( file_get_contents( $datei ) );
		$form['document'] = '@' . $datei;
		curl_init( $url );
		$ch = ;
		curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
		curl_setopt( $ch, CURLOPT_POSTFIELDS, $form );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt( $ch, CURLOPT_HEADER, true );
		curl_exec( $ch );
		$exec = ;
		curl_close( $ch );
		error_log( '---------------------------------------------' );
		$this->checkResponse( $exec );
		$res = error_log( $exec );
		return $res;
	}
}

error_reporting( 30719 );
?>

customer.zip

Link to comment
Share on other sites

Thanks for ur  fast reply jazzman1  hope u can help me

If want u can come in my pc via team viewer i am online always


What type of the field state is to set in mysql ?

what u mean by this i am nto very wel in php and mysql so if u want u can come in team viewer and ucan check dear

Regards Ghulam

Edited by GhulamMuhammad
Link to comment
Share on other sites

 

What type of the field state is to set in mysql ?

 

what u mean by this i am nto very wel in php and mysql so if u want u can come in team viewer and ucan check dear

 

http://dev.mysql.com/doc/refman/5.0/en/show-columns.html

 

 

If want u can come in my pc via team viewer i am online always

 

I don't use any proprietary software in my home.

Link to comment
Share on other sites

mysql> SHOW COLUMNS FROM deltimes;
+--------+----------------------------+------+-----+---------+----------------+
| Field  | Type                       | Null | Key | Default | Extra          |
+--------+----------------------------+------+-----+---------+----------------+
| id     | int(11)                    | NO   | PRI | NULL    | auto_increment |
| type   | enum('returning','single') | NO   |     | single  |                |
| state  | enum('0','1')              | NO   |     | 0       |                |
| days   | varchar(13)                | YES  |     | NULL    |                |
| cotype | enum('c','o')              | NO   |     | c       |                |
| value  | varchar(11)                | NO   |     | NULL    |                |
| text   | varchar(240)               | YES  |     | NULL    |                |
+--------+----------------------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)

Two problems I see here in your query on the line 669 and output shown above:

$getDelTimesQue = $this->query( 'SELECT * FROM deltimes WHERE state=\'1\' AND ( value=CURDATE() ) ' ); // line 669

1) An ENUM is a string object. You're setting the values as a string type (which is correct) and even though you could set the values to numbers MySQL developers strongly recommend that you do not use numbers as enumeration values. Read up this.

 

2) The arithmetic of using MySQL Date/Time functions do NOT work on type of fields different from Date/Time and Timestamp. Read up and this.

Link to comment
Share on other sites

i dont understand this all sir  let me share another  code of this pack maybe u can find any solution from there

 

this is index file of  this software

<?php


$currPage = "index";
require_once "app/app/customer.php";
$customer = new customer();
$sData = $customer->query("SELECT type, value FROM settings ");
$setData = $customer->fetch_and_make_assoc($sData, "type", "value");
$customer->check_debug($setData);
if (isset($_GET["del"]))
{
	if (isset($_GET["del"]) || $_GET["del"] == "reg")
	{
		if (isset($_SESSION["reg"]))
		{
			unset($_SESSION["reg"]);
		}
	}
}
$_tt = $customer->getTransPHP();
if (false || isset($_POST["type"]) || (false || (false || isset($_POST["type"]) || isset($_GET["type"])) || (false || (false || isset($_POST["type"]) || isset($_GET["type"])) || isset($_GET["r"]))))
{
	require_once "app/app/membersaction.php";
}
if (!isset($_GET["id"]))
{
	$_GET["id"] = 1;
}
$cSubQue = $customer->query("SELECT id FROM menu WHERE type='sub' AND state='active' AND rel=" . $_GET["id"] . " ORDER by pos LIMIT 1");
if (mysql_num_rows($cSubQue))
{
	$cCheck = $customer->fetch_2_array($cSubQue);
	$pGroup = $cCheck[0]["id"];
}
 else 
{
	$pGroup = $_GET["id"];
}
$fQue = $customer->query("SELECT id,name FROM static WHERE state='1' AND name!=''");
$footerData = $customer->fetch_2_array($fQue);
$fQue = $customer->query("SELECT type,html FROM static WHERE  type='myLinkText' OR type='myNLText'");
$cartAddText = $customer->fetch_and_make_assoc($fQue, "type", "html");
$subMQue = $customer->query("SELECT * FROM menu WHERE type='sub' AND state='active' AND rel=" . $_GET["id"] . "  ORDER by pos");
$sMenuItems = $customer->fetch_2_array($subMQue);
$isSubOf = $customer->query("SELECT rel FROM menu WHERE state='active' AND id=" . $_GET["id"]);
$isSubFet = $customer->fetch($isSubOf, "row");
$isSub = $isSubFet[0] ? ($isSubFet[0]) : false;
$getEStateQ = $customer->query("SELECT id FROM extras WHERE type='main' and state='active'");
$activeEList = $customer->fetch_id_array($getEStateQ);
$fQue = $customer->query("SELECT html FROM static WHERE  type='myLinkText'");
$cartAddText = $customer->fetch($fQue, "row");
$agb = $cartAddText[0];
if (!$isSub)
{
	$hasSubOf = $customer->query("SELECT * FROM menu WHERE type='sub' AND state='active' AND rel=" . $_GET["id"] . " ORDER BY pos");
	if (!mysql_num_rows($hasSubOf))
	{
		$hasSub = false;
	}
	 else 
	{
		$hasSub = true;
		$sMenuItems = $customer->fetch_2_array($hasSubOf, "assoc");
	}
}
 else 
{
	$hasSubOf = $customer->query("SELECT * FROM menu WHERE type='sub' AND state='active' AND rel=" . $isSub . " ORDER BY pos");
	if (!mysql_num_rows($hasSubOf))
	{
		$hasSub = false;
	}
	 else 
	{
		$hasSub = true;
		$sMenuItems = $customer->fetch_2_array($hasSubOf, "assoc");
	}
}
$checkDeals = $customer->set_deals_data();
$getQue = $customer->query("SELECT * FROM products WHERE rel=" . $pGroup . " AND active='1' AND device LIKE '%shop%' ORDER BY pos");
$products = $customer->fetch_2_array($getQue);
$dealQue = $customer->query("SELECT * FROM products WHERE rel!=1 AND type='pro' AND hp='1' AND active='1' ORDER BY pos");
$deals = $customer->fetch_2_array($dealQue);
{
	if (isset($_SESSION["inTime"]))
	{
	}
}
if (false || !isset($_SESSION["inTime"]) || (false || !isset($_SESSION["inTime"]) || (isset($_SESSION["inTime"]) || $setData["set_tolerance"] * 3 < time() - $_SESSION["inTime"][1])))
{
	$_SESSION["inTime"] = $customer->checkDelivertimes() ? (array(true, time())) : (array(false, time()));
}
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML+RDFa 1.0//EN\" \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">\r
<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\r
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r
<base href=\"";
echo $customer->shopRoot;
echo "\" />\r
";
if (!is_file("cache/meta_" . $_GET["id"] . ".cache.php"))
{
	$customer->cacheMetaTags($_GET["id"], $pGroup);
}
require_once "cache/meta_" . $_GET["id"] . ".cache.php";
if (!empty($setData["favicon"]))
{
	echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"images/pers/";
	echo $setData["favicon"];
	echo "\" /> ";
}
echo "<link rel=\"apple-touch-icon-precomposed\" href=\"images/icons/ios_icon_52.png\" />\r
<link rel=\"apple-touch-icon\" href=\"images/icons/ios_icon_52.png\" />\r
<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"images/icons/ios_icon_72.png\" />\r
<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"images/icons/ios_icon_114.png\" />\r
<link href=\"css/styles.css\" rel=\"stylesheet\" type=\"text/css\" />\r
";
if (!is_file("cache/styles2.css"))
{
	$customer->cacheCSS();
}
echo "<link href=\"cache/styles2.css\" rel=\"stylesheet\" type=\"text/css\" />\r
<!--[if IE]><link rel=\"stylesheet\" href=\"css/ieFixes.css\" type=\"text/css\" /><![endif]-->\r
<!--[if IE  7]><link rel=\"stylesheet\" href=\"css/ie7Fixes.css\" type=\"text/css\" /><![endif]-->\r
<!--[if IE  9]><link rel=\"stylesheet\" href=\"css/ie9Fixes.css\" type=\"text/css\" /><![endif]-->\r
<script type=\"text/javascript\" src=\"js/common.js\"></script>\r
<!--<script src=\"//connect.facebook.net/en_US/all.js\"></script>-->\r
<script type=\"text/javascript\">\r
";
echo $customer->writeJSString();
echo "\$(document).ready(function(){\r
	";
if (isset($message))
{
	if (isset($message) || !empty($message))
	{
		echo "showMessage('";
		echo $message;
		echo "');";
	}
}
echo "	\$('.mLinksBox a[rel=\"";
echo $_GET["id"];
echo "\"]').addClass('active');\r
	";
if (!$isSub)
{
	if (!$isSub || isset($sMenuItems[0]["id"]))
	{
		if (!$isSub || isset($sMenuItems[0]["id"]) || $sMenuItems[0]["id"])
		{
			echo "		\$('.mLinksBox a[rel=\"";
			echo $sMenuItems[0]["id"];
			echo "\"]').addClass('active');\r
	";
		}
	}
}
echo "	";
if ($isSub)
{
	echo " \$('.mLinksBox a[rel=\"";
	echo $isSub;
	echo "\"]').addClass('active'); ";
}
echo "	";
echo "})\r
</script>\r
<script type=\"text/javascript\" src=\"js/functions.js\"></script>\r
</head>\r
<body>\r
<!--\r
<div id=\"fb-root\"></div>\r
<script>(function(d, s, id) {\r
  var js, fjs = d.getElementsByTagName(s)[0];\r
  if (d.getElementById(id)) return;\r
  js = d.createElement(s); js.id = id;\r
  js.src = \"//connect.facebook.net/de_DE/all.js#xfbml=1&appId=dfdfdfdfdfdf\";\r
  fjs.parentNode.insertBefore(js, fjs);\r
}(document, 'script', 'facebook-jssdk'));</script>\r
-->\r
<div id=\"wrapper\">\r
<div id=\"main\">\r
";
require_once "app/template/headerMenu.php";
echo "<div id=\"content\" class=\"roundedL\" >\r
	<div class=\"mMenuC2\">\r
		<div id=\"orderBox\" class=\"roundedL frame\">   \r
            ";
require_once "app/template/logInBox.php";
echo "            <div id=\"sendOrderBox\" class=\"formBlock roundedS frame2\">\r
				";
require_once "app/template/cart.php";
echo "				";
require_once "app/template/orderBox.php";
echo " \r
			</div><!-- e o #orderBox -->\r
		</div>\r
		";
require_once "app/template/productBox.php";
echo "        ";
if (count($deals))
{
	require_once "app/template/deals.php";
}
echo "		\r
		\r
		<!--<div class=\"fb-like-box\" data-href=\"http://www.facebook.com/xxxxxxxx\" style=\"background-color: #333;\" data-width=\"650\" data-show-faces=\"true\" data-colorscheme=\"dark\" data-stream=\"false\" data-border-color=\"#555\" data-header=\"false\"></div>-->\r
		\r
    </div><!-- e o mMenuC-->\r
</div><!-- e o content-->\r
\r
";
if (isset($message))
{
	if (isset($message) || !empty($message))
	{
		echo "<div id=\"hiddenMessages\">\r
	<div id=\"message\">";
		echo $message;
		echo "</div>\r
</div>\r
";
	}
}
echo "\r\n";
require_once "app/template/footer.php";
echo "\r
<div class=\"hidden\">\r
	<div id=\"checkOut\">\r
    	<div class=\"ajaxLoader\">\r
        	<div class=\"coTitle\"></div>\r
        	<img id=\"aLoader\" src=\"images/ajaxLoader.gif\" />\r
            <div id=\"coContent\"></div>\r
            <div id=\"social\"></div>\r
            <div id=\"fbclose\"><img src=\"images/fancybox/fancy_close2.png\" /></div>\r
		</div>\r
    </div>\r
</div>\r
\r
<div class=\"hidden\">\r
	<div id=\"extras2\"></div>\r
</div>\r
\r
<div class=\"hidden\"><div id=\"responseBox\"></div></div>\r
\r
";
if ($setData["set_mov"] == "1")
{
	if ($setData["set_mov"] == "1" || !isset($_SESSION["reg"]))
	{
		require_once "app/template/map.php";
	}
}
echo "\r\n";
echo "\r
</div><!-- -e o main -->\r
</div><!-- end wrapper -->\r
";
if (is_file("app/template/analytics.php"))
{
	include "app/template/analytics.php";
}
echo "</body>\r
</html>";



Link to comment
Share on other sites

Don't escape the single quotes in you query. See the difference:

<?php

$getDelTimesQue = $this->query( "SELECT * FROM deltimes WHERE state=\'1\'");

//and 

$getDelTimesQue = $this->query( "SELECT * FROM deltimes WHERE state='1'");

To get "value = curdate()" working you must alter the column named "value" from varchar to date or datetime datatype. 

mysql> SHOW COLUMNS FROM deltimes;
+--------+----------------------------+------+-----+---------+----------------+
| Field  | Type                       | Null | Key | Default | Extra          |
+--------+----------------------------+------+-----+---------+----------------+
| id     | int(11)                    | NO   | PRI | NULL    | auto_increment |
| type   | enum('returning','single') | NO   |     | single  |                |
| state  | enum('0','1')              | NO   |     | 0       |                |
| days   | varchar(13)                | YES  |     | NULL    |                |
| cotype | enum('c','o')              | NO   |     | c       |                |
| value  | date                       | YES  |     | NULL    |                |
| text   | varchar(240)               | YES  |     | NULL    |                |
+--------+----------------------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)

mysql> SELECT * FROM deltimes where value = curdate() and state = '1'


Result: 
+----+-----------+-------+-----------+--------+------------+------+
| id | type      | state | days      | cotype | value      | text |
+----+-----------+-------+-----------+--------+------------+------+
| 52 | returning | 1     | 1,2,3,4,5 | c      | 2014-02-19 | NULL |
+----+-----------+-------+-----------+--------+------------+------+
1 row in set (0.00 sec)
Link to comment
Share on other sites

		function check_for_holiday() {
			$getDelTimesQue = $this->query( 'SELECT * FROM deltimes WHERE state=\'1\' AND ( value=CURDATE() ) ' );

Line 622 ===============      if (mysql_num_rows( $getDelTimesQue )) {
				while ($row = mysql_fetch_assoc( $getDelTimesQue )) {
					if ($row['type'] == 'single') {
						global $message;

						$message = $row['text'];
						return false;
					}
				}
			}

		}

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\WampDeveloper\Websites\www.pizza.com\webroot\app\app\customer.php on line 622

Edited by GhulamMuhammad
Link to comment
Share on other sites

  • 2 weeks later...
function check_for_holiday() {
            $getDelTimesQue = $this->query("SELECT * FROM deltimes WHERE state=1  AND ( value=CURDATE() ) ");

if (mysql_num_rows( $getDelTimesQue )) {
                while ($row = mysql_fetch_assoc( $getDelTimesQue )) {
                    if ($row['type'] == 'single') {
                        global $message;

                        $message = $row['text'];
                        return false;
                    }
                }
            }

        }
//------------------------------------------------------------------------------------------------------------------------------------
function query($sql, $modType = null) {
(empty($sql)) ? return false : return true;
 
if($this->dbConnect()){
               $que = mysql_query($sql) or die (mysql_error());
       if($modType == 'insert') {
        return mysql_insert_id();
       } else if ($modType == 'update') {
       return mysql_affected_rows();
      }else{
      return $que;
      }
 }else{
  return false
 }
}
 

This is happening because your $subject = mysql_query("SELECT * FROM deltimes WHERE state=1  AND ( value=CURDATE() ) "); returned FALSE due to the query failing, use mysql_error() to find out the error.

Usually do mysql_query() or die (mysql_error()) to ensure the code doesn't continue after an error.

 

Edited by Rockwood
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.