Paypal表单提交美元而不是英镑

时间:2017-09-07 11:49:34

标签: php forms paypal

在我的网站上,当您填写页面底部的捐款表单并点击“捐款”时,您将被定向到PayPal并收到以下错误消息:

  

此收件人不接受以美元计价的付款。请联系卖家并要求他更新其付款接收偏好以接受此货币。

所以看来我的网站试图以美元提交捐赠金额,它应该以英镑提交......从我的代码中,我看不到任何与美元相关的信息,我看到这个在捐赠表格的代码中:

<div id="donate_form" style="width:465px; text-align:right; margin-left:auto; margin-right:auto;">      
<form action="https://www.paypal.com/cgi-bin/webscr" target="_self" method="post" name="form1" id="form1">

<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="office@lifechurch.org.uk">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="CLC">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://www.lifechurchgive.org.uk/thanks.php">
<input type="hidden" name="cancel_return" value="http://www.lifechurchgive.org.uk/cancel.php">
<input type="hidden" name="currency_code" value="GBP">
<!--<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHNwYJKoZIhvcNAQcEoIIHKDCCByQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA74FWzLn4DCnIxB4zk6BVnMALPccZk2MtVPpyqhdS73b9KVOplD/EmBSfA7dLaR9hDhrTxjMx4ETwpvBCQv+Zc4QF18NYerp5z9CG4w7u3ub7qdrrMn7Nxt6fck0PhKSCR0Unkw0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wob7BDWZJRroYGUpIGRMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMDAyMTYxNDMwMjZaMCMGCSqGSIb3DQEJBDEWBBRhSOhijH/bIHYvkaiATB9JixUOKTANBgkqhkiG9w0BAQEFAASBgCysjBqxhxIbLnuQ+svn2XPkAIp8Sttix4ScbAi7MEiYYM2hx6Vd67JUGxBzCUlOO8PHzRcrqcR2nl9S8YnVZ+GfWcUZHHmdN6b8tgHPmgYrOSZkkv+UI/GW8q35KzMj58i6ssO8iiTnXngmNN15iOMR2B1EUy9Ll6XShl9Q7d4j-----END PKCS7-----">-->
<span id="ajaxresult" name="ajaxresult"><?PHP include("validate.php"); ?></span>

<?PHP 
#$ajax = "loadXMLDoc('/validate.php','ajaxresult','submit2','displaydonation=true&amp;title1='+title1.value+'&amp;first_name='+first_name.value+'&amp;last_name='+last_name.value+'&amp;H_PhoneNumber='+H_PhoneNumber.value+'&amp;email='+email.value+'&amp;amount='+amount.value+'&amp;message='+message.value);document.getElementById('submit2').disabled=true;cursor_wait();";

$ajax = "loadXMLDoc('/validate.php','ajaxresult','submit2','displaydonation=true&amp;title1='+title1.value+'&amp;first_name='+first_name.value+'&amp;last_name='+last_name.value+'&amp;email='+email.value+'&amp;amount='+amount.value+'&amp;message='+message.value+'&amp;giftaid='+giftaid.checked);document.getElementById('submit2').disabled=true;cursor_wait();";

echo '<br /><div class="submitbutton">'.make_form_var('input','button','submit2','submit2','Make Donation','','','','','','','','','',$ajax).'</div>';
?>
</form>

<!--
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6210814"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" /></a> -->

</div><!-- end of donate_form --> 

确实有很多内容已经注释掉了。

我有一个validate.php文件,但我在那里看不到有关货币/英镑/美元的任何信息,所以必须有一些东西可以将它设置为美元,但也许没有使用这些条款?

我实际上会在validation.php文件中发布代码,抱歉长度...

<?PHP

ini_set( 'display_errors', 0 );

date_default_timezone_set('Europe/London');

#session_start();

function make_form_var($formvar='',$type='',$name='',$id='',$value='',$size='',$maxlength='',$checked='',$src='',$rows='',$columns='',$class='',$title='',$align='',$onclick='',$onblur='') {

        if ($formvar == '') { return; }

        $object = '<'.$formvar.' ';                                                     # 1
        if ($type != '')        { $object.= 'type="'.$type.'" '; }                      # 2
        if ($name != '')        { $object.= 'name="'.$name.'" '; }                      # 3
        if ($id != '')          { $object.= 'id="'.$id.'" '; }                          # 4
        if ($value != '')       { $object.= 'value="'.$value.'" '; }                    # 5
        if ($size != '')        { $object.= 'size="'.$size.'" '; }                      # 6
        if ($maxlength != '')   { $object.= 'maxlength="'.$maxlength.'" '; }            # 7
        if ($checked != '')     { $object.= 'checked="'.$checked.'" '; }                # 8
        if ($src != '')         { $object.= 'src="'.$src.'" '; }                        # 9
        if ($rows != '')        { $object.= 'rows="'.$rows.'" '; }                      # 10
        if ($columns != '')     { $object.= 'cols="'.$columns.'" '; }                   # 11
        if ($class != '')       { $object.= 'class="'.$class.'" '; }                    # 12
        if ($title != '')       { $object.= 'title="'.$title.'" '; }                    # 13
        if ($align != '')       { $object.= 'align="'.$align.'" '; }                    # 14
        if ($onclick != '')     { $object.= 'onclick="'.$onclick.'" '; }                # 15
        if ($onblur != '')      { $object.= 'onblur="'.$onblur.'" '; }                  # 16

        if ($formvar == 'textarea') {
                $object.='>'.$value.'</'.$formvar.'>';
        } else {
                $object.=' />';
        }

        return $object;
}

function valid_email($email)
{
// check an email address is valid
if (preg_match('/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/', $email))

return true;
else
return false;
}

$newarray = $_POST;

if ($_SERVER['PHP_SELF'] == '/index.php' || isset($_POST['displaydonation'])) {

    # place values on the session
    if (isset($newarray['title1'])) {
        $_SESSION['DONATION']->title1 = $newarray['title1'];
    } else {
        if (!isset($_SESSION['DONATION']->title1)) { $_SESSION['DONATION']->title1 = ''; }
    }

    if (isset($newarray['first_name'])) {
        $_SESSION['DONATION']->first_name = $newarray['first_name'];
    } else {
        if (!isset($_SESSION['DONATION']->first_name)) { $_SESSION['DONATION']->first_name = ''; }
    }

    if (isset($newarray['last_name'])) {
        $_SESSION['DONATION']->last_name = $newarray['last_name'];
    } else {
        if (!isset($_SESSION['DONATION']->last_name)) { $_SESSION['DONATION']->last_name = ''; }
    }

    if (isset($newarray['email'])) {
        $_SESSION['DONATION']->email = $newarray['email'];
    } else {
        if (!isset($_SESSION['DONATION']->email)) { $_SESSION['DONATION']->email = ''; }
    }

    if (isset($newarray['amount'])) {
        $_SESSION['DONATION']->amount = $newarray['amount'];
    } else {
        if (!isset($_SESSION['DONATION']->amount)) { $_SESSION['DONATION']->amount = '0.00'; }
    }

    if (isset($newarray['message'])) {
        $_SESSION['DONATION']->message = $newarray['message'];
    } else {
        if (!isset($_SESSION['DONATION']->message)) { $_SESSION['DONATION']->message = ''; }
    }

    if (isset($newarray['giftaid'])) {
        if ($newarray['giftaid'] == 'true') { $newarray['giftaid'] = 1; } else { $newarray['giftaid'] == 0; }
        $_SESSION['DONATION']->giftaid = $newarray['giftaid'];
    } else {
        if (!isset($_SESSION['DONATION']->giftaid)) { $_SESSION['DONATION']->giftaid = '1'; }
    }

    $emailvalid = ''; $emailvalid = valid_email($_SESSION['DONATION']->email);

    if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->first_name != '' && $_SESSION['DONATION']->last_name != '' && $_SESSION['DONATION']->email != '' && $emailvalid != false && $_SESSION['DONATION']->amount != '' && $_SESSION['DONATION']->amount >= 5.00) {

        # email details
        $subject =  "Website Donation";
        $body = $body."The following donation was started on ".date('l dS F').". The user was forwarded to paypal to complete the transaction.\n\n";
        $body = $body."Contact Name: ".$_SESSION['DONATION']->title." ".$_SESSION['DONATION']->first_name." ".$_SESSION['DONATION']->last_name."\n\n";
        $body = $body."Email: ".$_SESSION['DONATION']->email."\n\n";
        $body = $body."Amount: ".$_SESSION['DONATION']->amount."\n\n";
        if ( $_SESSION['DONATION']->message != '')  { $body = $body."Message: ".$_SESSION['DONATION']->message."\n\n"; }
        if ( $_SESSION['DONATION']->giftaid == '1')     { $body = $body."Gift aid: Yes\n\n"; }

        $to =    "office@lifechurch.org.uk";
        $from = $_SESSION['DONATION']->email;
        $headers  = 'From: ' . $from . "\n";
        $headers .= 'Return-Path: ' . $from . "\n";
        $headers .= 'BCC: gavin.lloyd@sky.com'."\n";
        $headers .= 'BCC:'."\n";
        $headers .= 'MIME-Version: 1.0' ."\n";
        $headers .= 'Content-Type: text/plain; charset=ISO-8859-1' ."\n";
        $headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";

        $mailOk=mail($to, $subject, $body, $headers);

        # forward form to paypal
        echo 'submitform';

    } else {

        echo '<div class="formlabel">Title: </div>';
        echo '<div class="formobject">';
        echo make_form_var('input','text','title1','title1',$_SESSION['DONATION']->title1,'5','6','','','','','paypaltextbox');
        echo '</div>';
        echo '<div class="formclear"></div>';

        if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->first_name == '') {
            echo '<div class="error">Please enter your first name:</div>';
        }

        echo '<div class="formlabel"><span class="requiredtext">First name:* </span></div>';
        echo '<div class="formobject">';
        echo make_form_var('input','text','first_name','first_name',$_SESSION['DONATION']->first_name,'26','100','','','','','paypaltextbox');
        echo '</div>';
        echo '<div class="formclear"></div>';

        if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->last_name == '') {
            echo '<div class="error">Please enter your last name:</div>';
        }

        echo '<div class="formlabel"><span class="requiredtext">Last name:* </span></div>';
        echo '<div class="formobject">';
        echo make_form_var('input','text','last_name','last_name',$_SESSION['DONATION']->last_name,'26','100','','','','','paypaltextbox');
        echo '</div>';
        echo '<div class="formclear"></div>';



        if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->email == '') {
            echo '<div class="error">Please enter your email:</div>';
        } else if (isset($_POST['displaydonation']) && $emailvalid == false) {
            echo '<div class="error">Please enter a valid email address:</div>';
        }

        echo '<div class="formlabel"><span class="requiredtext">Email:* </span></div>';
        echo '<div class="formobject">';
        echo make_form_var('input','text','email','email',$_SESSION['DONATION']->email,'26','100','','','','','paypaltextbox');
        echo '</div>';
        echo '<div class="formclear"></div>';

        if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->amount == '') {
            echo '<div class="error">Please enter a donation:</div>';
        } else if (isset($_POST['displaydonation']) && $_SESSION['DONATION']->amount < 5.00) {
            echo '<div class="error">Please enter a donation of &pound;5.00 or more:</div>';
        }

        echo '<div class="formlabel"><span class="requiredtext">Donation:* </span></div>';
        echo '<div class="formobject">';
        echo make_form_var('input','text','amount','amount',$_SESSION['DONATION']->amount,'6','16','','','','','paypaltextboxcost','','right','','MM_changeProp(\'amount\',\'\',\'value\',cent(this.value),\'INPUT/TEXT\')');
        echo ' (minimum &pound;5.00)</div>';
        echo '<div class="formclear"></div>';

        echo '<div class="formlabel">Message: </div>';
        echo '<div class="formobject">';
        echo make_form_var('textarea','','message','message',$_SESSION['DONATION']->message,'','','','','5','','paypaltextbox');
        echo '</div>';
        echo '<div class="formclear"></div>';

        echo '<div class="formlabel">Gift aid: </div>';
        echo '<div class="formobject">';
        $checked='';
        if ($_SESSION['DONATION']->giftaid == 1) { $checked = 'checked'; }
        echo make_form_var('input','checkbox','giftaid','giftaid','1','','',$checked,'','','','');
        echo '</div>';
        echo '<div class="formclear"><br /><p class="donate_small">I am a UK taxpayer. Please treat the gift I have made to Chesterfield Christian Life Church (CLC) as a Gift Aid Donation. I understand CLC will reclaim income tax at the basic rate on my donations and I must pay an amount of income tax or capital gains tax equal to the amount that will be reclaimed. IE - You are confirming that you are a UK tax payer and that you are happy for us to reclaim the tax - for every £1 you give to CLC we can reclaim 25p from the tax man - which is pretty cool. All donations qualify - large or small, regular or one-off, and whatever the method of payment. </p></div>';
    }
}

谁能告诉我我应该找什么?

0 个答案:

没有答案