close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

undefined function microtime_float() error on confirm page

Thread began 8/02/2012 7:00 pm by rgolab68503 | Last modified 8/14/2012 11:42 am by Jason Byrnes | 3171 views | 11 replies |

rgolab68503

undefined function microtime_float() error on confirm page

Hi Jason,

This is kind of a continuation to my last thread but with different issues.

Ray went into my computer and for some reason when he tried to add teh checkout functions he did not come up with the same errors we came up with. This in a way is a good thing. Most the pages are work up to the confirm page. I added the error reporting code to the top of the page and when I try "Submit the order" I get this error.

Fatal error: Call to undefined function microtime_float() in /var/www/html/toyo_support_site/support/Display/confirm.php on line 110

I attached the confirm page and the checkout page just in case that is the route of the problem.

Any ideas?

Attached Files
Confirm.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the universal Email code bloack that is curently at lines 75 - 163:

php:
<?php

if (!isset($_SESSION))session_start();
if (((
$_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)))     {
  
//WA Universal Email object="mail"
  
set_time_limit(0);
  
$EmailRef "waue_confirm_4";
  
$BurstSize 1;
  
$BurstTime 200;
  
$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 ][] = "".((isset($_SESSION["eCartCheckoutForm_firstname"]))?$_SESSION["eCartCheckoutForm_firstname"]:"")  ." ".((isset($_SESSION["eCartCheckoutForm_lastname"]))?$_SESSION["eCartCheckoutForm_lastname"]:"")  ."|WA|".((isset($_SESSION["eCartCheckoutForm_email"]))?$_SESSION["eCartCheckoutForm_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_confirm_4.php");
      
$endtime microtime_float();
      
$TimeTracker[] =$endtime $starttime;
      
$RealWait array_sum($TimeTracker)/sizeof($TimeTracker);
      if (
$LoopCount $BurstSize == && $CurIndex sizeof($RecipArray[$RecipIndex]))  {
        
$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 (
function_exists("rel2abs")) $GoToPage $GoToPage?rel2abs($GoToPage,dirname(__FILE__)):"";
  if (
$GoToPage!="")     {
    
header("Location: ".$GoToPage);
  }
}
?>




needs to be moved so it comes after the Store Order details code block that ends at line 41 in the confirm page.

Sign in to reply to this post

rgolab68503

Hey jason,

A little confused. Line 41 when I look at it in Dreamweaver falls right in the middle of this recordset code block.

<?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;
THIS IS WHERE LINE 41 IS ---- case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$pass_word_rsUSERNAME = "-1";
if (isset($_SESSION['pass_word'])) {
$pass_word_rsUSERNAME = $_SESSION['pass_word'];
}
$user_name_rsUSERNAME = "-1";
if (isset($_SESSION['user_name'])) {
$user_name_rsUSERNAME = $_SESSION['user_name'];
}
mysql_select_db($database_toyosupport, $toyosupport);
$query_rsUSERNAME = sprintf("SELECT * FROM entry WHERE Password = %s AND Name = %s", GetSQLValueString($pass_word_rsUSERNAME, "text"),GetSQLValueString($user_name_rsUSERNAME, "text"));
$rsUSERNAME = mysql_query($query_rsUSERNAME, $toyosupport) or die(mysql_error());
$row_rsUSERNAME = mysql_fetch_assoc($rsUSERNAME);
$totalRows_rsUSERNAME = mysql_num_rows($rsUSERNAME);
mysql_select_db($database_toyosupport, $toyosupport);
$query_rsPROVINCE = "SELECT * FROM provinces ORDER BY ID ASC";
$rsPROVINCE = mysql_query($query_rsPROVINCE, $toyosupport) or die(mysql_error());
$row_rsPROVINCE = mysql_fetch_assoc($rsPROVINCE);
$totalRows_rsPROVINCE = mysql_num_rows($rsPROVINCE);
?>


Could you confirm where is should be moved to.

Sign in to reply to this post

Jason ByrnesWebAssist

my apologies, i meant to type 411.

lines 359 - 411 are the code for the store order details:

php:
<?php 

// WA eCart Store Cart Details in Db
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger
{
  
$WA_connection $t0y0t1r3s;
  
$WA_table "orderdetails";
  
$WA_redirectURL "checkout_success.php";
  
$WA_indexField "DetailOrderID";
  
$WA_fieldNamesStr "DetailOrderID|DetailProductID|DetailName|DetailPrice|DetailQuantity";
  
$WA_fieldValuesStr WA_eCDB_ConvertNumber("".((isset($_SESSION["Displays_OrderID"]))?$_SESSION["Displays_OrderID"]:"")  ."") . "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("ID")  ."") . "|" "".$Displays->DisplayInfo("Name")  ."" "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("Price")  ."") . "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("Quantity")  ."");
  
$WA_columnTypesStr "none,none,NULL|none,none,NULL|',none,''|none,none,NULL|none,none,NULL";
  
$WA_sql "";
  
mysql_select_db($database_t0y0t1r3s$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;
  }
  
$Displays->MoveFirst();
  while (!
$Displays->EOF())
  {
    
$WA_fieldValuesStr WA_eCDB_ConvertNumber("".((isset($_SESSION["Displays_OrderID"]))?$_SESSION["Displays_OrderID"]:"")  ."") . "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("ID")  ."") . "|" "".$Displays->DisplayInfo("Name")  ."" "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("Price")  ."") . "|" WA_eCDB_ConvertNumber("".$Displays->DisplayInfo("Quantity")  ."");
    
$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());
    
$Displays->MoveNext();
  }
  if (
$WA_redirectURL != "")  {
    
header("Location: ".$WA_redirectURL); exit;
  }
  
$Displays->MoveFirst();
}
?>



the UE code block needs to be after the details are stored.

Sign in to reply to this post

rgolab68503

No worries, I thought that is was you meant so i tried it that way before. I have made the changes but I think it got worse.

These are the errors that come up now.


Notice: Undefined variable: t0y0t1r3s in /var/www/html/toyo_support_site/support/Display/confirm.php on line 221

Notice: Undefined variable: database_t0y0t1r3s in /var/www/html/toyo_support_site/support/Display/confirm.php on line 234

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/html/toyo_support_site/support/Display/confirm.php on line 236

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/toyo_support_site/support/Display/confirm.php on line 270

Now i did some changes to the email as well and am wondering if this has caused the erros. Basically in the version before it was supposed to pull a sales reps email. I have now set up a recordset and am pulling it that way. I proved that the email is comming in OK by plaing it on the page (see Error2_aug3.jpg). I attached the new confirm.php as it sits now as well as the checkout.php page.

It is all getting to the confirm page OK but once you hit the "submit order" button then the errors happen and it stays on the confirm page.

Attached Files
Confirm2.zip
Sign in to reply to this post

rgolab68503

OK, i got a little further. For some reason it dumped the database connection to t0y0t1r3s:

<?php require_once('../../Connections/t0y0t1r3s.php'); ?>

Hoperfully the email part is working now.

Sign in to reply to this post

rgolab68503

No Mail

OK I am getting to the checkout stage but the mail is not working now.

Attached are the most current files.

Attached Files
Confirm3.zip
Sign in to reply to this post

Jason ByrnesWebAssist

are you testing locally or remotely?

make sure you are testing remotely, in most cases the email wont be able to work testing locally unless you have installed an STP server.

In the Universal Email behavior, how have you set the SMTP server settings?

Who is your host?

Sign in to reply to this post

rgolab68503

hi Jason,

Yes all the tests are on a remote server. Just to be clear as well in case it matters but I have two carts so far working off of the same server. I did a test to make sure the other cart was working and it is (See attach cart_examp_Aug3.jpg).

Mail setup is identical for both: See Cart_emailsetup_Aug3.jpg

Only diference on this page is the CC field which has the recipient getting the information from a database.

See Cart_emailsetup2_Aug3.jpg

I will try removing this option to see if it clears things up and get back to you.

Sign in to reply to this post

Jason ByrnesWebAssist

i see the problem.

The store cart details behavior is redirecting to the success page before the email is being sent.

change line 285:

php:
$WA_redirectURL = "checkout_success.php";



to:

php:
$WA_redirectURL = "";



then change line 343:

php:
$GoToPage = "";




to:

php:
$GoToPage = "checkout_success.php";
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...