why doesn't this work

From: Date: Tue, 15 Apr 2003 20:29:00 +0000
Subject: why doesn't this work
Groups: php.general 
Request: Send a blank email to php-general+get-144019@lists.php.net to get a copy of this message
hi all the code listed below works, if you pass variables to it through the url line in the browser (i.e., http:// mysite.com/thispage.php?orderid=98&BS_request=verify&order-id=98&request=verify&cpi.card-state= ID&ms.merchant-id=MSJ&price=50.00......), but will not work if you pass these variables to the page through a POST operation. i'm not sure what's wrong with the page. it's a credit card validation page. i'm attempting to migrate it off a server with register globals on to a server with register globals off i've tried $_POST instead of $_REQUEST, to no avail can anyone tell what i'm doing wrong? thanks again freak code to follow: <? require_once("test_fns.php"); //this is the first call from creditcard_server //this is what the webserver executes if creditcard_server sends if a value of 'verify' //as $request if ($_REQUEST['request'] == "verify") { // display page if (!($conn = db_connect())) return false; //you may have to edit the sql calls and variables to work with register globals off later on when //cc payments are moved to www.test $result = mysql_query( "select * from mjp_cc where orderid = '$_REQUEST[orderid]'"); $row = mysql_fetch_array($result); //getting info from row in db $userid2 = $row['userid']; $merchant2 = $row['userid']; $orderid2 = $row['orderid']; $amount2 = $row['amount']; $paid2 = $row['paid']; if (!$result) return "Error."; //below, if the orderid and price match, and value of paid is 'no', return a status response to //creditcard_server of 'success' if ($_REQUEST['orderid'] == $orderid2 && $_REQUEST['price'] == $amount2 && $paid2 == "no") { echo "<html>"; echo "<head>"; echo "<title>Untitled Document</title>"; echo "</head>"; echo "<body>"; echo "<!--merchant response ms.status=accept -->"; echo "<br>"; echo "go ahead"; echo "</body>"; echo "</html>"; $verisign_string=$_SERVER['QUERY_STRING']; //you should update the cc_activity table at this point $result = mysql_query("insert into cc_activity values ('$userid2', 'MSJ', '$orderid2', '50.00', 'no','$verisign_string', 'mjp', now('$savedccactivity'))"); if (!$result) return "Error."; exit;} //if one of the if conditionos is not true, then send creditcard_server back a //donotaccept msg and exits echo "<html>"; echo "<head>"; echo "<title>Untitled Document</title>"; echo "</head>"; echo "<body>"; echo "<!--merchant response ms.status=donotaccept -->"; echo "<br>"; echo "denied"; echo "</body>"; echo "</html>"; $verisign_string=$_SERVER['QUERY_STRING']; //you should update the cc_activity table at this point $result = mysql_query("insert into cc_activity values ('$userid2', 'MSJ', '$orderid2', '50.00', 'no','$verisign_string', 'mjp', now('$savedccactivity'))"); if (!$result) return "Error."; exit; } //this is the second request from creditcard_server, after it has gotten one of the above msgs it //then requests this page again only it sends a value of 'result' for $request //this is what the webserver does if creditcard_server sends it a value of 'result' for $request if ($_REQUEST['request'] == "result") { // display page if (!($conn = db_connect())) return false; $result2 = mysql_query( "select * from mjp_cc where orderid = '$_REQUEST[orderid]'"); $row2 = mysql_fetch_array($result2); //getting info from row in db $orderid2 = $row2['orderid']; $amount2 = $row2['amount']; $paid2 = $row2['paid']; if (!$result2) return "Error."; if ($result == "success") { echo "<html>"; echo "<head>"; echo "<title>Untitled Document</title>"; echo "</head>"; echo "<body>"; echo "<!--merchant response ms.status=received -->"; echo "<br>"; echo "success"; echo "</body>"; echo "</html>"; $verisign_string=$_SERVER['QUERY_STRING']; //you should update the cc_activity table at this point $result = mysql_query("insert into cc_activity values ('$userid2', 'MSJ', '$orderid2', '50.00', 'no','$verisign_string', 'mjp', now('$savedccactivity'))"); if (!$result) return "Error."; exit;} echo "<html>"; echo "<head>"; echo "<title>Untitled Document</title>"; echo "</head>"; echo "<body>"; echo "<!--merchant response ms.status=received -->"; echo "<br>"; echo "failure"; echo "</body>"; echo "</html>"; $verisign_string=$_SERVER['QUERY_STRING']; //you should update the cc_activity table at this point $result = mysql_query("insert into cc_activity values ('$userid2', 'MSJ', '$orderid2', '50.00', 'no','$verisign_string', 'mjp', now('$savedccactivity'))"); if (!$result) return "Error."; exit; //you should update the cc_activity table at this point again, so you have 2 entries //for each cc transaction } ?> -- ______________________________________________ http://www.linuxmail.org/ Now with e-mail forwarding for only US$5.95/yr Powered by Outblaze

« previous php.general (#144019) next »