payment gateway

i am trying to get a total amount to pay in the instead of 30 i have been left with this as our web designer has left

[php]<?php
include_once(“dbfiles/db1.php”);

$vendor = ‘wizardmotorcycl’;
$key = ‘1056199’;

$live = 100;

function worldpay($orderid) {

global $vendor,$key,$live;

$_SESSION['orderID'] = $orderid;

if ($live) $vspsite="https://secure-test.worldpay.com/wcc/purchase";
	else $vspsite="https://secure-test.worldpay.com/wcc/purchase"; 

$sql = "SELECT * FROM orders1 WHERE id='{$orderid}'";
$result = mysql_query($sql) or die('ERROR:: '.$sql.'<br><br>'.mysql_error());

$sql2 = "SELECT * FROM config WHERE config_id=1";
$result2 = mysql_query($sql2) or die('ERROR:: '.$sql.'<br><br>'.mysql_error());

if (mysql_num_rows($result)==1 && mysql_num_rows($result2)==1) {
	
	$order = mysql_fetch_assoc($result);
	$config = mysql_fetch_assoc($result2);
	
	$data = array(
		'VendorTxCode'=>$order['id'],
		'Amount'=>number_format($order['grandtotal'],2,".",""),
		'Currency'=>'GBP',
		'Description'=>$config['store_name'].' Order',
		'SuccessURL'=>'http://'.$_SERVER['HTTP_HOST'].str_replace('checkout','transok',$_SERVER['REQUEST_URI']),
		'FailureURL'=>'http://'.$_SERVER['HTTP_HOST'].str_replace('checkout','transnotok',$_SERVER['REQUEST_URI']),
		'CustomerEmail'=>$order['email'],
		'VendorEmail'=>$config['store_owner_email_address'],
		'CustomerName'=>$order['title']." ".$order['forename']." ".$order['surname'],
		'DeliveryAddress'=>$order['d_street_address1']." ".$order['d_street_address2'],
		'DeliveryPostCode'=>$order['postcode'],
		'BillingAddress'=>$order['cardaddress'],
		'BillingPostCode'=>$order['cardpostcode'],
		'ContactNumber'=>$order['dayphone'] 
	);
	
	$crypt = base64Encode(SimpleXor(formatData($data),$key));
	
	?>
	

	<form action='https://secure-test.worldpay.com/wcc/purchase' method=post>
<script>
		window.onload=function() {
		  setTimeout("document.Worldpay.submit()",3000);
		}

	</script>    
<?php[/php]

You are using obsolete MySQL code that will not work at all in the latest version of Php. You need to use PDO with prepared statements.

You also do not need the two queries. You only need one written correctly.

[php][/php]

Is just a hidden input, one that I would not trust either! To change the value you replace the part where is says, value. BUT, that is easily changeable by someone else as well. So, if you are looking to actually use this, you need someone that can provide a better solution than something that was dreamed up in a highschool/ college web development assignment.

I was wanting the total to go in instead of “30” i wanted the form to go off with a total everytime something was ordered

Sponsor our Newsletter | Privacy Policy | Terms of Service