ballhogjoni Posted April 10, 2007 Share Posted April 10, 2007 can someone tell me whats wrong with this if statement? if (!empty($_SESSION['STREET1']) && !empty($_SESSION['CITYNAME']) && !empty($_SESSION['BuyerEmail']) && !empty($_SESSION['CreditCardNumber']) && !empty($_SESSION['ExpYear']) && !empty($_SESSION['ExpMonth']) && !empty($_SESSION['CreditCardType']) && !empty($_SESSION['CVV2']) && !empty($_SESSION['FIRSTNAME']) && !empty($_SESSION['LASTNAME']) && !empty($_SESSION['STATEORPROVINCE']) && !empty($_SESSION['POSTALCODE']) && !empty($_SESSION['COUNTRY']) && !empty($_SESSION['PHONE'])) Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 10, 2007 Share Posted April 10, 2007 Looks fine to me. Why are you asking the question? Ken Quote Link to comment Share on other sites More sharing options...
gazalec Posted April 10, 2007 Share Posted April 10, 2007 is that the whole code because you dont have a condition like if (something = ''){ echo "this field is empty"; }else{ #continue to next page; } Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 10, 2007 Author Share Posted April 10, 2007 for some reason my script is moving on to the } else { portion of my if else statement. heres some code <?php function SOAP_DoDirectPaymentRequest($username, $password, $accountEmail, $user_name, $userExists, $entry_page, $CreditCardType, $CreditCardNumber, $ExpMonth, $ExpYear, $CVV2, $ip, $tax_who="ALL", $tax_state=""){ if (!empty($_SESSION['STREET1']) && !empty($_SESSION['CITYNAME']) && !empty($_SESSION['BuyerEmail']) && !empty($_SESSION['CreditCardNumber']) && !empty($_SESSION['ExpYear']) && !empty($_SESSION['ExpMonth']) && !empty($_SESSION['CreditCardType']) && !empty($_SESSION['CVV2']) && !empty($_SESSION['FIRSTNAME']) && !empty($_SESSION['LASTNAME']) && !empty($_SESSION['STATEORPROVINCE']) && !empty($_SESSION['POSTALCODE']) && !empty($_SESSION['COUNTRY']) && !empty($_SESSION['PHONE'])) { $result = mysql_query("SELECT * FROM address WHERE IPAddress='{$_SESSION['IPAddress']}'"); if( mysql_num_rows($result) == 1 ) { $sql = "SELECT FIRSTNAME, LASTNAME, STREET1, STREET2, CITYNAME, STATEORPROVINCE, POSTALCODE, COUNTRY, PHONE, PAYER, IPAddress FROM address WHERE IPAddress='{$_SESSION['IPAddress']}'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); //BUILD SOAP $doDirectPaymentRequest = <<< QUOTE <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header> <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" SOAP-ENV:mustUnderstand="1"> <Credentials xmlns="urn:ebay:apis:eBLBaseComponents"> <Username>$username</Username> <Password>$password</Password> <Subject>$accountEmail</Subject> </Credentials> </RequesterCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <DoDirectPaymentReq xmlns="urn:ebay:api:PayPalAPI"> <DoDirectPaymentRequest xmlns="urn:ebay:api:PayPalAPI"> <Version xmlns="urn:ebay:apis:eBLBaseComponents">1.0</Version> <DoDirectPaymentRequestDetails xmlns="urn:ebay:apis:eBLBaseComponents"> <PaymentAction>Sale</PaymentAction> <PaymentDetails> <OrderTotal currencyID="USD">1.95</OrderTotal> <ItemTotal currencyID="USD">1.95</ItemTotal> <ShippingTotal currencyID="USD">$Shipping</ShippingTotal> <HandlingTotal currencyID="USD">$Handling</HandlingTotal> <TaxTotal currencyID="USD">0.00</TaxTotal> <OrderDescription>$OrderDescription</OrderDescription> <InvoiceID>$InvoiceID</InvoiceID> <ShipToAddress> QUOTE; if (!empty($row[company])){ $doDirectPaymentRequest .= "<Name>$row[company]</Name>"; } else { $doDirectPaymentRequest .= "<Name>$row[FIRSTNAME] $row[LASTNAME]</Name>"; } $doDirectPaymentRequest .= <<< QUOTE <Street1>$row[sTREET1]</Street1> <Street2>$row[sTREET2]</Street2> <CityName>$row[CITYNAME]</CityName> <StateOrProvince>$row[sTATEORPROVINCE]</StateOrProvince> <Country>$row[COUNTRY]</Country> <Phone>$row[PHONE]</Phone> <PostalCode>$row[postALCODE]</PostalCode> </ShipToAddress> QUOTE; mysql_data_seek($result, 0); while ($row = mysql_fetch_assoc($result)){ if ($tax_who == "STATE") { if ($row['STATEORPROVINCE'] != $tax_state) $total_tax = 0.00; } elseif ($tax_who == "NONE") { $total_tax = 0.00; } else { $total_tax = $TaxTotal; } $doDirectPaymentRequest .= <<< QUOTE <PaymentItem> <Name>$item_name</Name> <Number></Number> <Quantity>$item_quantity</Quantity> <SalesTax currencyID="USD">$TaxTotal</SalesTax> <Amount currencyID="USD">$ItemTotal</Amount> </PaymentItem> QUOTE; } mysql_data_seek($result, 0); $row = mysql_fetch_assoc($result); $doDirectPaymentRequest .= <<< QUOTE </PaymentDetails> <CreditCard> <CreditCardType>$CreditCardType</CreditCardType> <CreditCardNumber>$CreditCardNumber</CreditCardNumber> <ExpMonth>$ExpMonth</ExpMonth> <ExpYear>$ExpYear</ExpYear> <CardOwner> <Payer>$row[PAYER]</Payer> <PayerID></PayerID> <PayerStatus></PayerStatus> <PayerName> <FirstName>$row[FIRSTNAME]</FirstName> <LastName>$row[LASTNAME]</LastName> </PayerName> <PayerCountry>$row[COUNTRY]</PayerCountry> <PayerBusiness></PayerBusiness> <Address> QUOTE; if (!empty($row[company])){ $doDirectPaymentRequest .= "<Name>$row[company]</Name>"; } else { $doDirectPaymentRequest .= "<Name>$row[FIRSTNAME] $row[LASTNAME]</Name>"; } $doDirectPaymentRequest .= <<< QUOTE <Street1>$row[sTREET1]</Street1> <Street2>$row[sTREET2]</Street2> <CityName>$row[CITYNAME]</CityName> <StateOrProvince>$row[sTATEORPROVINCE]</StateOrProvince> <Country>$row[COUNTRY]</Country> <Phone>$row[PHONE]</Phone> <PostalCode>$row[postALCODE]</PostalCode> </Address> </CardOwner> <CVV2>$CVV2</CVV2> </CreditCard> <IPAddress>$ip</IPAddress> <MerchantSessionId>$InvoiceID</MerchantSessionId> </DoDirectPaymentRequestDetails> </DoDirectPaymentRequest> </DoDirectPaymentReq> </SOAP-ENV:Body> </SOAP-ENV:Envelope> QUOTE; return $doDirectPaymentRequest; } else { echo ("We're sorry, but it seems as though you have already ordered you ".$item_name.".<br>If you feel you have reached this message in error please contact <a href=\"mailto:sales@xxxx.com\">sales@xxxx.com</a>.<br>"); echo ("</body></html>"); echo "The Information we have for you is:<br />"; echo $_SESSION['BuyerEmail']; echo $_SESSION['ExpYear']; echo $_SESSION['ExpMonth']; echo $_SESSION['CreditCardType']; echo $_SESSION['CreditCardNumber']; echo $_SESSION['CVV2']; echo $_SESSION['FIRSTNAME']; echo $_SESSION['LASTNAME']; echo $_SESSION['STREET1']; echo $_SESSION['STREET2']; echo $_SESSION['CITYNAME']; echo $_SESSION['STATEORPROVINCE']; echo $_SESSION['POSTALCODE']; echo $_SESSION['COUNTRY']; echo $_SESSION['PHONE']; echo $_SESSION['PAYER']; echo $_SESSION['IPAddress']; echo $Status = "1"; exit; } } ?> I forgot to say, it is receiveing the correct values in the seesion because it will echo all those values in the } else { portion of the script. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.