"); echo("

INSTALLATION ERROR

"); echo(""); echo("
 
"); echo("
$string

 

"); echo("

If you require help installing please contact

"); echo(""); exit(); } function thumb_upload_image($image,$width,$height,$upload_path) { if($height > 0 and $width > 0) { if(file_exists($upload_path)) { unlink($upload_path); } require_once('thumb/phpthumb.class.php'); $phpThumb = new phpThumb(); $phpThumb->setSourceFilename($image); $phpThumb->h = $height; $phpThumb->w = $width; $phpThumb->q = 95; $phpThumb->config_output_format = 'jpeg'; $phpThumb->config_error_die_on_error = false; if(!$phpThumb->GenerateThumbnail()) { echo 'Failed: '.implode("\n", $phpThumb->debugmessages); } if(!$phpThumb->RenderToFile($upload_path)) { echo 'Failed: '.implode("\n", $phpThumb->debugmessages); } } return 1; } function upload_images($image,$type,$d,$f,$id) { require("config.php"); $smallimage = $path . $id . "_thumb_$d.jpg"; $bigimage = $path . $id . "_original_$d.jpg"; thumb_upload_image($image,$thumb_width,$thumb_height,$smallimage); thumb_upload_image($image,$large_width,$large_height,$bigimage); } function delete_image($id,$d) { require("config.php"); $smallimage = $path . $id . "_thumb_$d.jpg"; $bigimage = $path . $id . "_original_$d.jpg"; if (file_exists($smallimage)) { unlink($smallimage); } if (file_exists($bigimage)) { unlink($bigimage); } } function check_login($my_session) { require("config.php"); $connection = mysqli_connect($host,$usr,$pwd,$db); $query = mysqli_query($connection, "SELECT username from cart_login_$shop_code where session='$my_session'"); while ($row = mysqli_fetch_array($query)) { $username = $row["username"]; } return $username; } function get_postage($weight) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT price from cart_weights_$shop_code where weightfrom <= '$weight' and weightto > '$weight' ", $connection); while ($row = mysql_fetch_array($query)) { $price = $row["price"]; } return $price; } function cart_rows($my_session,$filename) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $summary = cart_summary($my_session); $array = array(); $query = mysql_db_query($db, "SELECT * FROM cart_temp_$shop_code where session='$my_session' and product_show != 'N' ", $connection); if(!mysql_num_rows($query)) { $filename = "shop_cart_empty.html"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); $contents = str_replace("Xpage_fromX", $_SESSION['cart_url'], $contents); $contents = str_replace("Xsummary_priceX", $summary[0], $contents); $contents = str_replace("Xsummary_qtyX", $summary[1], $contents); $contents = str_replace("Z~", $currency, $contents); print $contents; fclose ($handle); exit(); } while ($row = mysql_fetch_array($query)) { $product_name = $row["product_name"]; $product_code = $row["product_code"]; $product_price = $row["product_price"]; $product_tax = $row["product_tax"]; $product_weight = $row["product_weight"]; $product_quantity = $row["product_quantity"]; $id = $row["id"]; $product_price_total = $product_price * $product_quantity; $product_price_total = sprintf("%.2f",$product_price_total); $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); $contents = str_replace("XquantityX", $product_quantity, $contents); $contents = str_replace("Xproduct_nameX", $product_name, $contents); $contents = str_replace("Xproduct_codeX", $product_code, $contents); $contents = str_replace("XpriceX", $product_price, $contents); $contents = str_replace("XtotalX", $product_price_total, $contents); $contents = str_replace("Xproduct_taxX", $product_tax, $contents); $contents = str_replace("Xproduct_weightX", $product_weight, $contents); $contents = str_replace("XidX", $id, $contents); $contents = str_replace("Xpage_fromX", $from, $contents); $contents = str_replace("Z~", $currency, $contents); array_push($array,$contents); fclose ($handle); } return implode("\n", $array); } function cart_details($my_session,$country,$delivery_country) { $array = array(); $subtotal = 0; $weight = 0; $taxable = 0; require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT * FROM cart_temp_$shop_code where session='$my_session'", $connection); while ($row = mysql_fetch_array($query)) { $product_price = $row["product_price"]; $product_weight = $row["product_weight"]; $product_quantity = $row["product_quantity"]; $product_tax = $row["product_tax"]; $subtotal += ($product_price * $product_quantity); $weight += ($product_weight * $product_quantity); if($product_tax == "Yes") { $taxable += ($product_price * $product_quantity); } } $postage = get_postage($weight); $delivery_multiplier = get_dm($delivery_country); $tax = get_tax($country); $postage = $postage * $delivery_multiplier; $tax = ($taxable * $tax) +($postage * $tax) - ($tax * total_discount($my_session)); $total = $subtotal + $postage + $tax; $subtotal = sprintf("%.2f",$subtotal); $postage = sprintf("%.2f",$postage); $taxable = sprintf("%.2f",$taxable); $tax = sprintf("%.2f",$tax); $total = sprintf("%.2f",$total); $discount = sprintf("%.2f",total_discount($my_session)); array_push($array, $subtotal); array_push($array, $weight); array_push($array, $taxable); array_push($array, $postage); array_push($array, $tax); array_push($array, $total); array_push($array, $discount); return $array; } function total_discount($my_session) { $discount = 0; require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT * FROM cart_temp_$shop_code where session='$my_session' and product_show='N' ", $connection); while ($row = mysql_fetch_array($query)) { $product_price = $row["product_price"]; $discount += $product_price; } $discount = $discount * -1; $discount = sprintf("%.2f",$discount); return $discount; } function get_dm($delivery_country) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT delivery_multiplier from cart_countries_$shop_code where country_name LIKE '%$delivery_country%'", $connection); check_mysql($query); while ($row = mysql_fetch_array($query)) { $delivery_multiplier = $row["delivery_multiplier"]; } return $delivery_multiplier; } function get_tax($country) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT tax_rate from cart_countries_$shop_code where country_name LIKE '%$country%'", $connection); while ($row = mysql_fetch_array($query)) { $tax_rate = $row["tax_rate"]; } $tax_rate = $tax_rate / 100; return $tax_rate; } function email_products($my_session) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $array = array(); $query = mysql_db_query($db, "SELECT * from cart_temp_$shop_code where session = '$my_session' and product_show != 'N' ", $connection); while ($row = mysql_fetch_array($query)) { $product_name = $row["product_name"]; $product_code = $row["product_code"]; $product_price = $row["product_price"]; $product_quantity = $row["product_quantity"]; $product_total = $product_price * $product_quantity; $product_total = sprintf("%.2f",$product_total); array_push($array, "$product_quantity x $product_name ($product_code) - $currency $product_total"); } return $array; } function products_to_database($my_session,$orderno,$status) { $now = time(); require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $details = mysql_db_query($db, "SELECT * from cart_customers_$shop_code where session='$my_session'", $connection); check_mysql($details); while ($row = mysql_fetch_array($details)) { $email = $row["email"]; } $query = mysql_db_query($db, "SELECT * from cart_temp_$shop_code where session = '$my_session' and product_show != 'N' ", $connection); while ($row = mysql_fetch_array($query)) { $product_name = $row["product_name"]; $product_code = $row["product_code"]; $product_price = $row["product_price"]; $product_quantity = $row["product_quantity"]; $product_name = addslashes($product_name); $insert = mysql_db_query($db, "INSERT into cart_record_$shop_code (email, orderno, product_name, product_code, product_price, product_quantity, status, statusdate, orderplaced, message) VALUES ('$email', '$orderno', '$product_name', '$product_code', '$product_price', '$product_quantity', '$status', '$now', '$now', '')", $connection); check_mysql($insert); $update = mysql_db_query($db, "update cart_products_$shop_code set product_stock=product_stock-$product_quantity where product_name='$product_name' and product_code='$product_code'", $connection); check_mysql($update); } $delete = mysql_db_query($db, "DELETE from cart_temp_$shop_code where session='$my_session'", $connection); check_mysql($delete); return; } function forgot_password($email) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $query = mysql_db_query($db, "SELECT * from cart_customers_$shop_code where email = '$email' and email != '' ", $connection); if(!mysql_num_rows($query)) { message("Account Error","Unable to locate your e-mail address in our database.

Click here to try again."); } while ($row = mysql_fetch_array($query)) { $name = $row["name"]; $password = $row["password"]; $filename = "../emails/forgot_password.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); $contents = str_replace("XnameX", $name, $contents); $contents = str_replace("XemailX", $email, $contents); $contents = str_replace("XpasswordX", $password, $contents); mail("$email","$forgot_password","$contents","From: $forgot_password_email"); fclose ($handle); } message("Password Sent","Your password has been e-mailed to $email

Click here to return to the log-in page."); } function database_connect($shost,$susr,$spwd) { require("config.php"); $kfile = str_replace($uploads_dir, $kfile, $path); $kfile = substr_replace($kfile, "",-1); $handle = @fopen ($kfile, "r"); if(!$handle) { database_error("rMEZORW oRXVMHV pVB"); exit(); } $lk = fread ($handle, filesize ($kfile)); fclose ($handle); list($q1,$q2,$q3)= split ("-", $lk, 3); if(strlen($q1) != "10") { database_error("rMEZORW oRXVMHV pVB"); exit(); } if(md5(getenv("SERVER_NAME")) != $q2) { database_error("rMEZORW oRXVMHV pVB"); exit(); } $qfrom = '0123456789'; $qto = 'bYL+QaeVxC'; $strc = strtr($q3, $qto, $qfrom); $now = time(); if($strc < $now) { database_error("rMEZORW oRXVMHV pVB"); exit(); } return mysql_connect($shost,$susr,$spwd); } function worldpay($my_session) { $filename = "../credit_cards/worldpay.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); return $contents; } function paypal($my_session) { $filename = "../credit_cards/paypal.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); return $contents; } function invoice($my_session) { $filename = "../credit_cards/invoice.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); return $contents; } function secure($my_session) { $filename = "../credit_cards/ssl.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); return $contents; } function backup_table ($table) { require("config.php"); $connection = mysql_connect($host,$usr,$pwd); $result .= "# Dump of $table \n"; $result .= "# Dump DATE : " . date("d-M-Y") ."\n\n"; $query = mysql_db_query($db, "select * from $table", $connection); $num_fields = @mysql_num_fields($query); while ($row = mysql_fetch_row($query)) { $result .= "INSERT INTO ".$table." VALUES("; for($j=0; $j<$num_fields; $j++) { # $row[$j] = addslashes($row[$j]); $row[$j] = str_replace("'", "", $row[$j]); $row[$j] = ereg_replace("\n","\\n",$row[$j]); if (isset($row[$j])) $result .= "\"$row[$j]\"" ; else $result .= "\"\""; if ($j<($num_fields-1)) $result .= ","; } $result .= ");\n"; } return $result . "\n\n\n"; } function convert_to_datetime($ugly) { if(is_array($ugly)) { return date("Y-m-d H:i:s", $ugly[0]); } else { $ugly = explode("/", $ugly); $day = $ugly[0]; $month = $ugly[1]; $year = $ugly[2]; if($month == '01') { $month = 'January'; } elseif($month == '02') { $month = 'February'; } elseif($month == '03') { $month = 'March'; } elseif($month == '04') { $month = 'April'; } elseif($month == '05') { $month = 'May'; } elseif($month == '06') { $month = 'June'; } elseif($month == '07') { $month = 'July'; } elseif($month == '08') { $month = 'August'; } elseif($month == '09') { $month = 'September'; } elseif($month == '10') { $month = 'October'; } elseif($month == '11') { $month = 'November'; } elseif($month == '12') { $month = 'December'; } $str = strtotime("$day $month $year 00:00:00"); return date("Y-m-d H:i:s", $str); } } function convert_to_display($ugly) { $str = strtotime($ugly); return date("d/m/Y",$str); } function convert_to_front($ugly) { $str = strtotime($ugly); return date("D jS M Y",$str); } function convert_to_datetime2($ugly) { if(is_array($ugly)) { return date("Y-m-d H:i:s", $ugly[0]); } else { $ugly = explode("/", $ugly); $day = $ugly[0]; $month = $ugly[1]; $year = $ugly[2]; if($month == '01') { $month = 'January'; } elseif($month == '02') { $month = 'February'; } elseif($month == '03') { $month = 'March'; } elseif($month == '04') { $month = 'April'; } elseif($month == '05') { $month = 'May'; } elseif($month == '06') { $month = 'June'; } elseif($month == '07') { $month = 'July'; } elseif($month == '08') { $month = 'August'; } elseif($month == '09') { $month = 'September'; } elseif($month == '10') { $month = 'October'; } elseif($month == '11') { $month = 'November'; } elseif($month == '12') { $month = 'December'; } $str = strtotime("$day $month $year 00:00:00"); return date("Y-m-d H:i:s", $str); } } function escape($f) { // Escaping illegal characters $f = str_replace("&", "&", $f); $f = str_replace("<", "<", $f); $f = str_replace(">", ">", $f); $f = str_replace("\"", """, $f); return $f; } function convert_to_display2($ugly) { $str = strtotime($ugly); return date("d/m/Y",$str); } function convert_to_front2($ugly) { $str = strtotime($ugly); return date("D jS M Y",$str); } ?>