Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Page Won't Load

Featured Replies

Hi All,

 

I've created an online ordering system that has quite a few different scripts all running on one page. This includes saving the order to a database, generating an XML file and then emailing it to the customer in a confirmation email.

 

The problem is that for some reason, when accessing the site using a windows PC, all the scripts get processed but the page itself never loads. It just says 'Connecting' for ages. However on my Mac it all goes through fine and the page loads saying 'Thank you for your order' etc.

 

Anyone know why this might be?

it is the beast that is IE dry.gif

 

it is a javascript error most likely, are you using AJAX ?

  • Author

it is the beast that is IE dry.gif

 

it is a javascript error most likely, are you using AJAX ?

 

Just checked and you're right, it is just IE where the problem lies.

 

The page is using some AJAX just to check that all of the fields are filled in before the form is submitted. Do you think this needs to be removed?

Shouldn't need to be removed, IE is a web-devs worst nightmare !

 

are you using jquery ?

  • Author

No, I did it quickly in Dreamweaver so used Spry which was probably a mistake. Would that make a difference?

mistake would be harsh, but try to make use of jQuery, it is cross-browser compatible

  • Author

I've tried removing all the AJAX on the page and that hasn't made a difference. Anything else you could suggest?

Ajax is so simple with jquery you shouldn't be looking elsewhere, a query ajax call is as simple as :

 

$.ajax({
url: '/path/to/url.php',
data: 'string=MyString&key=123',
type: 'POST',
success: function(response) {
  alert('The response is ' + response);
}
});

Edited by skidz

  • Author

I can't link you to the page as it is password protected but here is the code:

 

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/magtoc.php'); ?>
<?php
$eCart1->GetContent();
?>
<?php
//initialize the session
if (!isset($_SESSION)) {
 session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
 $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
 //to fully log out a visitor we need to clear the session varialbles
 $_SESSION['MM_Username'] = NULL;
 $_SESSION['MM_UserGroup'] = NULL;
 $_SESSION['PrevUrl'] = NULL;
 unset($_SESSION['MM_Username']);
 unset($_SESSION['MM_UserGroup']);
 unset($_SESSION['PrevUrl']);

 $logoutGoTo = "login.php?msg=2";
 if ($logoutGoTo) {
   header("Location: $logoutGoTo");
   exit;
 }
}
?>
<?php
if (!isset($_SESSION)) {
 session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
 // For security, start by assuming the visitor is NOT authorized. 
 $isValid = False; 

 // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
 // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
 if (!empty($UserName)) { 
   // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
   // Parse the strings into arrays. 
   $arrUsers = Explode(",", $strUsers); 
   $arrGroups = Explode(",", $strGroups); 
   if (in_array($UserName, $arrUsers)) { 
     $isValid = true; 
   } 
   // Or, you may restrict access to only certain users based on their username. 
   if (in_array($UserGroup, $arrGroups)) { 
     $isValid = true; 
   } 
   if (($strUsers == "") && true) { 
     $isValid = true; 
   } 
 } 
 return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
 $MM_qsChar = "?";
 $MM_referrer = $_SERVER['PHP_SELF'];
 if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
 if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
 $MM_referrer .= "?" . $QUERY_STRING;
 $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
 header("Location: ". $MM_restrictGoTo); 
 exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
 if (PHP_VERSION < 6) {
   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 }

 $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 switch ($theType) {
   case "text":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
     break;    
   case "long":
   case "int":
     $theValue = ($theValue != "") ? intval($theValue) : "NULL";
     break;
   case "double":
     $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
     break;
   case "date":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
     break;
   case "defined":
     $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
     break;
 }
 return $theValue;
}
}

$colname_users = "-1";
if (isset($_SESSION['MM_Username'])) {
 $colname_users = $_SESSION['MM_Username'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_users = sprintf("SELECT * FROM user_accounts WHERE username = %s", GetSQLValueString($colname_users, "text"));
$users = mysql_query($query_users, $magtoc) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = mysql_num_rows($users);

mysql_select_db($database_magtoc, $magtoc);
$query_stdtickets = "SELECT * FROM `std-tickets`";
$stdtickets = mysql_query($query_stdtickets, $magtoc) or die(mysql_error());
$row_stdtickets = mysql_fetch_assoc($stdtickets);
$totalRows_stdtickets = mysql_num_rows($stdtickets);

$colname_accounts = "-1";
if (isset($_SESSION['MM_Username'])) {
 $colname_accounts = $_SESSION['MM_Username'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_accounts = sprintf("SELECT * FROM accounts WHERE username = %s", GetSQLValueString($colname_accounts, "text"));
$accounts = mysql_query($query_accounts, $magtoc) or die(mysql_error());
$row_accounts = mysql_fetch_assoc($accounts);
$totalRows_accounts = mysql_num_rows($accounts);

$colname_relatedaccounts = "-1";
if (isset($row_accounts['account_number'])) {
 $colname_relatedaccounts = $row_accounts['account_number'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_relatedaccounts = sprintf("SELECT * FROM accounts WHERE account_number = %s", GetSQLValueString($colname_relatedaccounts, "int"));
$relatedaccounts = mysql_query($query_relatedaccounts, $magtoc) or die(mysql_error());
$row_relatedaccounts = mysql_fetch_assoc($relatedaccounts);
$totalRows_relatedaccounts = mysql_num_rows($relatedaccounts);
?>
<?php


session_start();
$cart = $_SESSION['cart'];
if ($cart) {
$cart .= ','.$_GET['id'];
} else {
$cart = $_GET['id'];
}
$_SESSION['cart'] = $cart;
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "")     {
 header("Location: ".$eCart1->redirStr);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MagToc - ATOC Online Ordering System</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="reset.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://gettopup.com/releases/latest/top_up-min.js"></script>
<link href="WA_eCart/CSS/eC_Clean_GranitePine_Arial.css" rel="stylesheet" type="text/css" />
<script src="WA_eCart/Scripts/copyShipping.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
var selObj = document.getElementById('shipping_branch');
var txtStreet1Obj = document.getElementById('shipping_street1');
var txtPostcodeObj = document.getElementById('shipping_postcode');

var selIndex = selObj.selectedIndex;
txtStreet1Obj.value = selObj.options[selIndex].title;
txtPostcodeObj.value = selObj.options[selIndex].id;
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){

$("#placeorder").click(function(){
$('form#checkout').attr({action: "placeorder.php"});
$('form#checkout').submit();
});

$("#parkorder").click(function(){
$('form#checkout').attr({action: "parkorder.php"});
$('form#checkout').submit();
});

});
</script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="center-wrap">
 <div class="logo"><img src="images/logo.png" width="258" height="86" alt="MagToc" /></div>
 <div class="account-bar">Welcome back <strong><?php echo $row_accounts['account_name']; ?></strong>! | <a href="<?php echo $logoutAction ?>">Log Out<br />
 </a><a href="basket.php">View Basket</a></div>
 <div class="nav-bar">
   <ul>
     <li><a href="index.php">Home</a></li>
     <li><a href="about.php">About Us</a></li>
     <li><a href="contact.php">Contact Us</a></li>
     <li><a href="terms.php">Terms & Conditions</a></li>
   </ul>
 </div>
 <div class="content">
   <h1>Delivery Information</h1>
   <div class="categories"><strong> Categories: <a href="orderform1.php">Standard Tickets</a> | <a href="orderform2.php">TOC Specific Tickets</a> | <a href="orderform3.php">AdHoc Items</a></strong></div>

   <div class="notice">Please only press <strong>Place Order </strong> once to avoid placing multiple orders.</div>
   <div class="center-txtarea">
     <div class="eC_Clean_Pacifica_Arial">
       <div class="eC_Clean_GranitePine_Arial">
         <div class="eC_CheckoutFormWrapper">
           <form action="placeorder.php" method="post" name="ecart_checkout_form" id="checkout">
             <div class="eC_PurchaserInfoWrapper">
               <div class="eC_CheckoutFormBody">
                 <div class="eC_FieldsetWrapper">
                   <h3 class="eC_CheckoutFormHeader">Invoice Information</h3>
                   <table border="0" cellpadding="0" cellspacing="0">
                     <tr>
                       <th><label for="companyname" >Company Name</label></th>
                       <td><input name="companyname" type="text" id="companyname" value="<?php echo $row_accounts['account_name']; ?>" size="70" /></td>
                     </tr>
                     <tr>
                       <th><label for="street1" >Address</label></th>
                       <td><input name="street1" type="text" id="street1" value="<?php echo $row_accounts['delivery_address1']; ?>" size="70" /></td>
                     </tr>
                     <tr>
                       <th><label for="street2" >Address Line 2</label></th>
                       <td><input name="street2" type="text" id="street2" value="<?php echo $row_accounts['delivery_address2']; ?>" size="70" /></td>
                     </tr>
                     <tr>
                       <th><label for="city" >City</label></th>
                       <td><input name="city" type="text" id="city" value="<?php echo $row_accounts['delivery_town']; ?>" size="70" /></td>
                     </tr>
                     <tr>
                       <th><label for="postcode" >Postal Code</label></th>
                       <td><input name="postcode" type="text" id="postcode" value="<?php echo $row_accounts['delivery_postcode']; ?>" size="70" /></td>
                     </tr>
                   </table>
                 </div>
                 <div class="eC_FieldsetWrapper">
                   <h3 class="eC_CheckoutFormHeader">Shipping Information</h3>
                   <table border="0" cellpadding="0" cellspacing="0">
                     <tr>
                       <th>Select Address<span class="red-text"> (You must select one)</span>:</th>
                       <td><label for="shipping_branch"></label>
                         <select name="shipping_branch" id="shipping_branch" onchange="showSelected();">
                           <?php
do {  
?>
                           <option id="<?php echo $row_relatedaccounts['delivery_postcode']; ?>" title="<?php echo $row_relatedaccounts['delivery_address1']; ?>, <?php echo $row_relatedaccounts['delivery_address2']; ?>, <?php echo $row_relatedaccounts['delivery_town']; ?>" value="<?php echo $row_relatedaccounts['delivery_branch']?>"<?php if (!(strcmp($row_relatedaccounts['delivery_branch'], $row_relatedaccounts['delivery_name']))) {echo "selected=\"selected\"";} ?>><?php echo $row_relatedaccounts['delivery_name']?></option>
                           <?php
} while ($row_relatedaccounts = mysql_fetch_assoc($relatedaccounts));
 $rows = mysql_num_rows($relatedaccounts);
 if($rows > 0) {
     mysql_data_seek($relatedaccounts, 0);
  $row_relatedaccounts = mysql_fetch_assoc($relatedaccounts);
 }
?>
                       </select></td>
                     </tr>
                     <br />
                     <tr>
                       <th><label for="shipping_street1" >Shipping Address</label></th>
                       <td><textarea name="shipping_street1" cols="70" rows="5" readonly="readonly" id="shipping_street1"></textarea></td>
                     </tr>
                     <tr>
                       <th><label for="shipping_postcode" >Shipping Postal Code</label></th>
                       <td><input name="shipping_postcode" type="text" id="shipping_postcode" value="" size="70" readonly="readonly" /></td>
                     </tr>
                   </table>
                 </div>
                 <div class="eC_FieldsetWrapper">
                   <h3 class="eC_CheckoutFormHeader">Order Information</h3>
                   <table border="0" cellpadding="0" cellspacing="0">
                     <br />
                     <tr>
                       <th><label for="po_number" >Purchase Order Number <span class="red-text">(You must enter one)</span></label></th>
                       <td>
                         <input name="po_number" type="text" id="po_number" value="" size="70" />
                       </td>
                     </tr>
                     <tr>
                       <th>Order Instructions<br />
(If you wish to pay by purchase card, please call our customer service team on 01205 591368)</th>
                       <td><label>
                         <textarea name="orderinstructions" id="orderinstructions" cols="70" rows="5"></textarea>
                       </label></td>
                     </tr>
                   </table>
                 </div>
               </div>
             </div>
             <table class="eC_ButtonWrapper" border="0" cellpadding="0" cellspacing="0">
               <tr>
                 <td><input name="sessionuser" type="hidden" id="sessionuser" value="<?php echo $row_accounts['username']; ?>" />
                 <input name="accountnumber" type="hidden" id="accountnumber" value="<?php echo $row_accounts['account_number']; ?>" />
                 <input type="submit" name="parkorder" id="parkorder" value="Park Order" />                  
                 <input type="submit" name="placeorder" id="placeorder" value="Place Order"  /></td>
               </tr>
             </table>
           </form>
         </div>
       </div>
     </div>
   </div>
   <p> </p>
   <p> </p>
 </div>
 <div class="footer">© Magnadata International 2011</div>
</div>
</body>
</html>
<?php
mysql_free_result($users);

mysql_free_result($stdtickets);

mysql_free_result($accounts);

mysql_free_result($relatedaccounts);
?>

got me, without being able to get to the page etc. it would be difficult to troubleshoot, what version of IE ?

  • Author

got me, without being able to get to the page etc. it would be difficult to troubleshoot, what version of IE ?

 

All the PCs i've tried have the latest IE installed I believe. Not sure if it makes a difference but here is the code of the page that is supposed to load but doesn't:

 

<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/magtoc.php'); ?>
<?php
$eCart1->GetContent();
?>
<?php
$eCart1->GetContent();
?>
<?php
//initialize the session
if (!isset($_SESSION)) {
 session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
 $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
 //to fully log out a visitor we need to clear the session varialbles
 $_SESSION['MM_Username'] = NULL;
 $_SESSION['MM_UserGroup'] = NULL;
 $_SESSION['PrevUrl'] = NULL;
 unset($_SESSION['MM_Username']);
 unset($_SESSION['MM_UserGroup']);
 unset($_SESSION['PrevUrl']);

 $logoutGoTo = "login.php?msg=2";
 if ($logoutGoTo) {
   header("Location: $logoutGoTo");
   exit;
 }
}
?>
<?php
if (!isset($_SESSION)) {
 session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
 // For security, start by assuming the visitor is NOT authorized. 
 $isValid = False; 

 // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
 // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
 if (!empty($UserName)) { 
   // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
   // Parse the strings into arrays. 
   $arrUsers = Explode(",", $strUsers); 
   $arrGroups = Explode(",", $strGroups); 
   if (in_array($UserName, $arrUsers)) { 
     $isValid = true; 
   } 
   // Or, you may restrict access to only certain users based on their username. 
   if (in_array($UserGroup, $arrGroups)) { 
     $isValid = true; 
   } 
   if (($strUsers == "") && true) { 
     $isValid = true; 
   } 
 } 
 return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
 $MM_qsChar = "?";
 $MM_referrer = $_SERVER['PHP_SELF'];
 if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
 if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
 $MM_referrer .= "?" . $QUERY_STRING;
 $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
 header("Location: ". $MM_restrictGoTo); 
 exit;
}
?>
<?php
//WA eCart Include
require_once("WA_eCart/WA_eCart_Database_PHP.php");
?>
<?php 
// WA eCart Store Cart Details in Db
if ("" == "") // Trigger
{
 $WA_connection = $magtoc;
 $WA_table = "orders";
 $WA_redirectURL = "";
 $WA_indexField = "custref";
 $WA_fieldNamesStr = "actiontype|recordtype|ordertype|customerno|shippingno|custref|shipto|jobtype|deliverydate|productcode|qty|packqty|unitprice|lineprice|unitindicator|orderinstructions|pricing_unit";
 $WA_fieldValuesStr = "Order" . "|" . "New" . "|" . "STD" . "|" . "".$_POST['accountnumber']  ."" . "|" . WA_eCDB_ConvertNumber("".$_POST['shipping_branch']  ."") . "|" . "".$_POST['po_number']  ."" . "|" . "".$_POST['shipping_branch']  ."" . "|" . "N" . "|" . "".$_POST['deliverydate']  ."" . "|" . "".$eCart1->DisplayInfo("Reference")  ."" . "|" . "".$eCart1->DisplayInfo("Quantity")  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("PackQty")  ."") . "|" . "".$eCart1->DisplayInfo("Price")  ."" . "|" . "".$eCart1->DisplayInfo("TotalPrice")  ."" . "|" . "UNIT" . "|" . "".$_POST['orderinstructions']  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("PricingUnit")  ."");
 $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|',none,''|',none,''|',none,''|',none,''|none,none,NULL";
 $WA_sql = "";
 mysql_select_db($database_magtoc, $WA_connection);
 $indexFieldIndex = -1;
 $WA_fieldValues = explode("|", $WA_fieldValuesStr);
 if (!session_id()) session_start();
 if ($WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
   $WA_redirectURL .= ((strpos('?', $WA_redirectURL) === false)?"?":"&").$_SERVER["QUERY_STRING"];
 }
 $WA_fieldNames = explode("|", $WA_fieldNamesStr);
 $WA_columns = explode("|", $WA_columnTypesStr);
 for ($i = 0; $i < sizeof($WA_fieldNames); $i++)
 {
   if ($WA_indexField  == $WA_fieldNames[$i])
   {
     $indexFieldIndex = $i;
     break;
   }
 }
 $deleteFieldValue = $WA_fieldValues[$indexFieldIndex];
 if (isset($deleteFieldValue) && $deleteFieldValue != "")
 { 
   $deleteParamsObj = WA_generateInsertParams(array($WA_indexField), array($WA_columns[$indexFieldIndex]), array($deleteFieldValue), -1);
   $WA_sql = "Delete from " . $WA_table . " where " . $WA_indexField . " = " . $deleteParamsObj->WA_dbValues;
   $WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
   $WA_okToDelete = false;
 }
 $eCart1->MoveFirst();
 while (!$eCart1->EOF())
 {
   $WA_fieldValuesStr = "Order" . "|" . "New" . "|" . "STD" . "|" . "".$_POST['accountnumber']  ."" . "|" . WA_eCDB_ConvertNumber("".$_POST['shipping_branch']  ."") . "|" . "".$_POST['po_number']  ."" . "|" . "".$_POST['shipping_branch']  ."" . "|" . "N" . "|" . "".$_POST['deliverydate']  ."" . "|" . "".$eCart1->DisplayInfo("Reference")  ."" . "|" . "".$eCart1->DisplayInfo("Quantity")  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("PackQty")  ."") . "|" . "".$eCart1->DisplayInfo("Price")  ."" . "|" . "".$eCart1->DisplayInfo("TotalPrice")  ."" . "|" . "UNIT" . "|" . "".$_POST['orderinstructions']  ."" . "|" . WA_eCDB_ConvertNumber("".$eCart1->DisplayInfo("PricingUnit")  ."");
   $WA_fieldValues = explode("|", $WA_fieldValuesStr);
   $insertParamsObj = WA_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
   $WA_sql = "insert into ".$WA_table." (".$insertParamsObj->WA_tableValues.") values (".$insertParamsObj->WA_dbValues.")";
   $WA_editCmd = mysql_query($WA_sql, $WA_connection) or die(mysql_error());
   $eCart1->MoveNext();
 }
 if ($WA_redirectURL != "")  {
   header("Location: ".$WA_redirectURL); exit;
 }
 $eCart1->MoveFirst();
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
 if (PHP_VERSION < 6) {
   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 }

 $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 switch ($theType) {
   case "text":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
     break;    
   case "long":
   case "int":
     $theValue = ($theValue != "") ? intval($theValue) : "NULL";
     break;
   case "double":
     $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
     break;
   case "date":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
     break;
   case "defined":
     $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
     break;
 }
 return $theValue;
}
}

$colname_accounts = "-1";
if (isset($_SESSION['MM_Username'])) {
 $colname_accounts = $_SESSION['MM_Username'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_accounts = sprintf("SELECT * FROM accounts WHERE username = %s", GetSQLValueString($colname_accounts, "text"));
$accounts = mysql_query($query_accounts, $magtoc) or die(mysql_error());
$row_accounts = mysql_fetch_assoc($accounts);
$totalRows_accounts = mysql_num_rows($accounts);

$colname_currentorder = "-1";
if (isset($_POST['po_number'])) {
 $colname_currentorder = $_POST['po_number'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_currentorder = sprintf("SELECT * FROM orders WHERE custref = %s", GetSQLValueString($colname_currentorder, "text"));
$currentorder = mysql_query($query_currentorder, $magtoc) or die(mysql_error());
$row_currentorder = mysql_fetch_assoc($currentorder);
$totalRows_currentorder = mysql_num_rows($currentorder);

$colname_savename = "-1";
if (isset($_POST['po_number'])) {
 $colname_savename = $_POST['po_number'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_savename = sprintf("SELECT * FROM orders WHERE custref = %s", GetSQLValueString($colname_savename, "text"));
$savename = mysql_query($query_savename, $magtoc) or die(mysql_error());
$row_savename = mysql_fetch_assoc($savename);
$totalRows_savename = mysql_num_rows($savename);
?>
<?php require_once("webassist/email/mail_php.php"); ?>
<?php require_once("webassist/email/mailformatting_php.php"); ?>
<?php
session_start();
$cart = $_SESSION['cart'];
if ($cart) {
$cart .= ','.$_GET['id'];
} else {
$cart = $_GET['id'];
}
$_SESSION['cart'] = $cart;
?>
<?php
header("Content-type: text/xml");

$host = "localhost";
$user = "magtoc_db";
$pass = "b0st0n1";
$database = "magtoc_db";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");

$colname_currentorder = "-1";
if (isset($_POST['po_number'])) {
 $colname_currentorder = $_POST['po_number'];
}
mysql_select_db($database_magtoc, $magtoc);
$query_currentorder = sprintf("SELECT * FROM orders WHERE custref = %s", GetSQLValueString($colname_currentorder, "text"));
$currentorder = mysql_query($query_currentorder, $magtoc) or die(mysql_error());

$xml_output = "<?xml version=\"1.0\"?>\n";

       $xml_output .= "<order>";
   $xml_output .= "<action";
   $xml_output  .=  " type=\"Order\"";
   $xml_output  .=  " recordtype=\"New\"";
       $xml_output  .=  " ordertype=\"STD\"";
       $xml_output  .=  " customerno=\"" . $row_currentorder['customerno'] . "\"";
       $xml_output  .=  " custref=\"" . $row_currentorder['custref'] . "\"";
       $xml_output  .=  " shipto=\"" . $row_currentorder['shipto'] . "\"";
       $xml_output  .=  " jobtype=\"N\"";
       $xml_output  .=  " deliverydate=\"" . $row_currentorder['deliverydate'] . "\"";
       $xml_output  .=  " orderinstructions=\"" . $row_currentorder['orderinstructions'] . "\">";
while($row_currentorder = mysql_fetch_assoc($currentorder)){
$xml_output .= "<product";
       $xml_output  .=  " productcode=\"" . $row_currentorder['productcode'] . "\"";
       $xml_output  .=  " qty=\"" . $row_currentorder['qty'] * $row_currentorder['pricing_unit'] . "\"";
       $xml_output  .=  " unitprice=\"" . $row_currentorder['unitprice'] . "\"";
       $xml_output  .=  " lineprice=\"" . $row_currentorder['lineprice'] . "\"";
       $xml_output  .=  " unitindicator=\"UNIT\" />";
}
       $xml_output .= "</action>";
       $xml_output .= "</order>";

// open some file for reading
$myFile = $row_savename['id'] . ".xml";
$fp = fopen($myFile, 'w+') or die("can't open file");

// write to file
fwrite($fp, $xml_output);

// close the connection and the file handler
fclose($fp);
?>
<?php
if (!isset($_SESSION))session_start();
if (("" == ""))     {
 //WA Universal Email object="mail"
 set_time_limit(0);
 $EmailRef = "waue_placeorder_5";
 $BurstSize = 200;
 $BurstTime = 1;
 $WaitTime = 1;
 $GoToPage = "";
 $RecipArray = array();
 $StartBurst = time();
 $LoopCount = 0;
 $TotalEmails = 0;
 $RecipIndex = 0;
 // build up recipients array
 $CurIndex = sizeof($RecipArray);
 $RecipArray[$CurIndex] = array();
 $RecipArray[$CurIndex ][] = "".$row_accounts['delivery_email']  ."";
 $TotalEmails += sizeof($RecipArray[$CurIndex]);
 $RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1);
 $TimeTracker = Array();
 $TotalBursts = floor($TotalEmails/$BurstSize);
 $AfterBursts = $TotalEmails % $BurstSize;
 $TimeRemaining = ($TotalBursts * $BurstTime) + ($AfterBursts*$RealWait);
 if ($TimeRemaining < ($TotalEmails*$RealWait) )  {
   $TimeRemaining = $TotalEmails*$RealWait;
 }
 $_SESSION[$EmailRef."_Total"] = $TotalEmails;
 $_SESSION[$EmailRef."_Index"] = 0;
 $_SESSION[$EmailRef."_Remaining"] = $TimeRemaining;
 while ($RecipIndex < sizeof($RecipArray))  {
   $EnteredValue = is_string($RecipArray[$RecipIndex][0]);
   $CurIndex = 0;
   while (($EnteredValue && $CurIndex < sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) {
     $starttime = microtime_float();
     if ($EnteredValue)  {
       $RecipientEmail = $RecipArray[$RecipIndex][$CurIndex];
     }  else  {
       $RecipientEmail = $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]];
     }
     $EmailsRemaining = ($TotalEmails- $LoopCount);
     $BurstsRemaining = ceil(($EmailsRemaining-$AfterBursts)/$BurstSize);
     $IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize;
     if ($AfterBursts<$EmailsRemaining) $IntoBurst = 0;
     $TimeRemaining = ($BurstsRemaining * $BurstTime * 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait));
     if ($TimeRemaining < ($EmailsRemaining*$RealWait) )  {
       $TimeRemaining = $EmailsRemaining*$RealWait;
     }
     $CurIndex ++;
     $LoopCount ++;
     session_commit();
     session_start();
     $_SESSION[$EmailRef."_Index"] = $LoopCount;
     $_SESSION[$EmailRef."_Remaining"] = round($TimeRemaining);
     session_commit();
     wa_sleep($WaitTime);
     include("webassist/email/waue_placeorder_5.php");
     $endtime = microtime_float();
     $TimeTracker[] =$endtime - $starttime;
     $RealWait = array_sum($TimeTracker)/sizeof($TimeTracker);
     if ($LoopCount % $BurstSize == 0)  {
       $TimePassed = (time() - $StartBurst);
       if ($TimePassed < ($BurstTime*60))  {
         $WaitBurst = ($BurstTime*60) -$TimePassed;
         wa_sleep($WaitBurst);
       }
       else  {
         $TimeRemaining = ($TotalEmails- $LoopCount)*$RealWait;
       }
       $StartBurst = time();
     }
     if (!$EnteredValue)  {
       $RecipArray[$RecipIndex][0] =  mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
     }
   }
   $RecipIndex ++;
 }
 $_SESSION[$EmailRef."_Total"] = 0;
 $_SESSION[$EmailRef."_Index"] = 0;
 $_SESSION[$EmailRef."_Remaining"] = 0;
 session_commit();
 session_start();
 if ($GoToPage!="")     {
   header("Location: ".$GoToPage);
 }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MagToc - ATOC Online Ordering System</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="reset.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://gettopup.com/releases/latest/top_up-min.js"></script>
<link href="WA_eCart/CSS/eC_Clean_GranitePine_Arial.css" rel="stylesheet" type="text/css" />
<script src="WA_eCart/Scripts/copyShipping.js" type="text/javascript"></script>
</head>
<body>
<div class="center-wrap">
 <div class="logo"><img src="images/logo.png" width="258" height="86" alt="MagToc" /></div>
 <div class="account-bar">Welcome back <strong><?php echo $row_accounts['account_name']; ?></strong>! | <a href="<?php echo $logoutAction ?>">Log Out<br />
 </a><a href="#">View Basket</a></div>
 <div class="nav-bar">
   <ul>
     <li><a href="index.php">Home</a></li>
     <li><a href="about.php">About Us</a></li>
     <li><a href="contact.php">Contact Us</a></li>
     <li><a href="terms.php">Terms & Conditions</a></li>
   </ul>
 </div>
 <div class="content">
   <h1>Order Placed</h1>
   <div class="categories"><strong> Categories: <a href="orderform1.php">Standard Tickets</a> | <a href="orderform2.php">TOC Specific Tickets</a> | <a href="orderform3.php">AdHoc Items</a></strong></div>

   <div class="center-txtarea">
     <p>Your order has been successfully placed on our system.</p>
     <p>You will shortly receive an email at <?php echo $row_accounts['delivery_email']; ?></p>
   </div>
   <p> </p>
   <p> </p>
 </div>
 <div class="footer">© Magnadata International 2011</div>
</div>
</body>
</html>
<?php
mysql_free_result($accounts);

mysql_free_result($currentorder);
?>

try changing strict to transitional on this page as on the previous code you sent

  • Author

the session handling looks a bit off to me, esp. have session_start(); half way down the page.

 

Is that likely to cause this kind of problem?

  • Author

Ok, i've tried moving the session_start(); to the top of the page and that hasn't helped. I can't really remove any of the session stuff as then the script won't work at all...

 

I've also checked the error log and that hasn't come up with any errors.

 

Any more suggestions? Getting really desperate now!

For start, place the session at top of each single page.

Next you don't need to use isset function for the $_SESSION unless it was given to a name like

$_SESSION['user'];

 

Also I notice a comment, php version <6?

That part is only if you arn't using php version 6.

 

Is this script taken from the internet?

I would double check the script of it's php versions which is very important.

  • Author

For start, place the session at top of each single page.

Next you don't need to use isset function for the $_SESSION unless it was given to a name like

$_SESSION['user'];

 

Also I notice a comment, php version <6?

That part is only if you arn't using php version 6.

 

Is this script taken from the internet?

I would double check the script of it's php versions which is very important.

 

Thanks for your reply. Most of these are scripts from the internet which have been adapted to suit. Unfortunately I'm primarily a designer and my PHP knowledge is some what limited.

 

What would you suggest replacing the following with?

 

if (!isset($_SESSION)) {
 session_start();
}

 

The line about PHP version 6 has been generated by Dreamweaver so not sure whether that's correct or not?

I'm half asleep atm but first things first, you've given us enough info to track down the site and left what looks like real mysql credentials. Remove those and change them, stat!

 

After that, do a quick view source and see if anything is being output before the doctype. I had a site I had to fix recently where IE raised merry hell over a comment appearing up top. That may or may not help but it's quick to check out.

Edited by henbast

Tl;dr but if it is a JS error in IE, go to:

 

Internet Options

Advanced

Uncheck "Disable script debugging" under browsing.

 

If you have an error it will popup at you.

 

Warning: This option will break the internet. Good luck browsing any other site ever again.

  • Author

Tl;dr but if it is a JS error in IE, go to:

 

Internet Options

Advanced

Uncheck "Disable script debugging" under browsing.

 

If you have an error it will popup at you.

 

Warning: This option will break the internet. Good luck browsing any other site ever again.

 

I tried that, no errors came up? Would that suggest Javascript isn't the problem?

  • Author

Send us a link to the page in question. I could run it through IE tester / firebug to see what errors are being generated.

 

PM Sent. If anyone else could help me out tonight, my email address is fred@alliancestudio.co.uk

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.