- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
- <head>
- <title>Dotacja/Donate</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <style>
- body {
- background-color: #f1f1f1;
- }
- </style>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body xml:lang="pl">
- <?php
- //Parametry do zmian:
- $secret_key = 'EAEED26488FCD32306D45CFD07170EFF0EA6ED716E2856EB0B84BF7926E26A2B';
- $action_url = 'https://vpos.polcard.com.pl/vpos/ecom/service.htm';
- $merchant_store_id = '78156151';
- if (count($_POST) > 0)
- {
- if (isset($_POST['amount']))
- $_POST['amount'] = $_POST['amount'] * 100;
- $request_params = '';
- // The order in the post_keys array is important!
- $post_keys = array('pos_id', 'order_id', 'session_id', 'amount', 'currency', 'test', 'language', 'client_ip', 'street', 'street_n1', 'street_n2', 'addr2', 'addr3', 'city', 'postcode', 'country', 'email', 'ba_firstname', 'ba_lastname', 'merchant_label');
- foreach($post_keys as $key)
- {
- if (isset($_POST[$key]) && $_POST[$key] != '')
- {
- if ($request_params != '') $request_params.= '&';
- $request_params.= $key.'='.$_POST[$key];
- }
- }
- $string_for_control_data_sign = $request_params . pack("H*" , $secret_key);
- $string_for_control_data_sign = $request_params;
- $control = calculateControlData($secret_key, $string_for_control_data_sign);
- $request_params .= '&controlData=' . $control;
- ob_start();
- header("Location: " . $action_url . "?".$request_params);
- ob_end_clean();
- die();
- }
- ?>
- <div class="container">
- <br />
- <div><img src="https://www.polcard.pl/assets/img/banner/First-Data-Polcard-blue.png" alt="PolCard" width="140px"/></div><br />
- <div style="border-top: 1px solid #b6becf; padding-top: 20px;"></div>
- <?php
- $testing_the_form = TRUE;
- if ($testing_the_form) { $form_action = 'donate.php'; }
- else { $form_action = "https://vpos.polcard.com.pl/vpos/ecom/service.htm"; }
- ?>
- <form name="payment_form" method="post" action="<?php print $form_action; ?>" class="form_payment" onSubmit="return disablesubmit (this);">
- <input type='hidden' name="pos_id" value ="<?php print $merchant_store_id; ?>"/>
- <input type="hidden" name="order_id" class="form-control" id="inputOrder_id" value="ORDER_<?php $orderID = randomPassword(10); print $orderID; ?>" style="width: 300px;">
- <input type="hidden" name="session_id" class="form-control" id="inputSession_id" value="<?php print randomPassword(20); ?>" style="width: 300px;">
- <div class="form-group">
- <label class="control-label col-sm-2" for="inputSubject">Kwota dotacji/Amount:</label>
- <div class="col-sm-10">
- <input type="text" required name="amount" pattern="^\d+(?:\.\d{0,2})?$" class="form-control" id="inputAmount" placeholder="0.00" style="width: 300px;">
- </div>
- </div>
- <input type='hidden' name="currency" value="PLN" />
- <input type='hidden' name="test" value="Y"/>
- <div class="form-group">
- <div class="control-group">
- <label class="control-label col-sm-2" for="inputSubject">Język/Language:</label>
- <div class="col-sm-10">
- <select name="language" class="form-control" style="width: 300px;">
- <option value="pl" selected>Polski</option>
- <option value="en">Angielski</option>
- <option value="de">Niemiecki</option>
- <option value="ru">Rosyjski</option>
- <option value="fr">Francuski</option>
- <option value="it">Włoski</option>
- <option value="es">Hiszpański</option>
- <option value="pt">Portugalski</option>
- </select>
- </div>
- </div>
- </div>
- <input type='hidden' name='client_ip' value="<?php print $_SERVER['REMOTE_ADDR']; ?>">
- <input type="hidden" name="street" class="form-control" id="inputStreet" placeholder="Ulica" style="width: 300px;">
- <input type="hidden" name="street_n1" class="form-control" id="inputStreetN1" placeholder="Nr domu" style="width: 300px;">
- <input type="hidden" name="street_n2" class="form-control" id="inputStreetN2" placeholder="Nr mieszkania" style="width: 300px;">
- <input type="hidden" name="addr2" class="form-control" id="inputAddr2" placeholder="Dodatkowe pole adresowe 2" style="width: 300px;">
- <input type="hidden" name="addr3" class="form-control" id="inputAddr3" placeholder="Dodatkowe pole adresowe 3" style="width: 300px;">
- <input type="hidden" name="city" class="form-control" id="inputCity" placeholder="Miasto" style="width: 300px;">
- <input type="hidden" name="postcode" class="form-control" id="inputPostCode" placeholder="Kod Pocztowy" style="width: 300px;">
- <input type="hidden" name="country" class="form-control" id="inputCountry" placeholder="Kraj" style="width: 300px;">
- <div class="form-group">
- <div class="control-group">
- <label class="control-label col-sm-2" for="inputSubject">e-mail:</label>
- <div class="col-sm-10">
- <input type="email" name="email" required class="form-control" id="inputEmail" placeholder="[email protected]" style="width: 300px;">
- </div>
- </div>
- </div>
- <input type="hidden" name="ba_firstname" class="form-control" id="inputFirstName" placeholder="Imię" style="width: 300px;">
- <input type="hidden" name="ba_lastname" class="form-control" id="inputLastName" placeholder="Nazwisko" style="width: 300px;">
- <input type="hidden" name="merchant_label" class="form-control" id="inputLabel" placeholder="Opis widoczny w raporcie" style="width: 300px;">
- <?php
- function calculateControlData($salt, $params) {
- $saltTab = str_split($salt);
- $hexLenght = strlen($salt);
- $saltBin = "";
- for ($x = 1; $x <= $hexLenght/2; $x++)
- {
- $saltBin .= (pack("H*", substr($salt,2 * $x - 2,2)));
- }
- return hash("sha256", $params.$saltBin);
- }
- function randomPassword($countLetters) {
- $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
- $pass = array(); //remember to declare $pass as an array
- $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
- for ($i = 0; $i < $countLetters; $i++) {
- $n = rand(0, $alphaLength);
- $pass[] = $alphabet[$n];
- }
- return implode($pass); //turn the array into a string
- }
- ?>
- <div><br /><br /><input type="image" src="https://www.polcard.pl/assets/img/banner/FDP-button-160x35-px.png"/></div>
- <div style="clear: both;"><!-- --></div>
- </form>
- <br /><br />
- <div style="border-top: 1px solid #b6becf; padding-top: 20px;">
- <div class="div_form_payment_bottom_right"><img src="https://www.polcard.pl/assets/img/banner/FDP-baner-statyk-980x75-px.png" alt="Płatności" border="0" /></div>
- <div style="clear: both;"><!-- --></div>
- </div>
- </div></div><div class="bottom_block_1">
- </div>
- </div>
- <br />
- <script>
- $(".check_input").on("keypress", function(event) {
- // Disallow anything not matching the regex pattern (A to Z uppercase, a to z lowercase, digits 0 to 9 and white space)
- // For more on JavaScript Regular Expressions, look here: https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions
- var englishAlphabetDigitsAndWhiteSpace = /[A-Za-z0-9 ]/g;
- // Retrieving the key from the char code passed in event.which
- // For more info on even.which, look here: http://stackoverflow.com/q/3050984/114029
- var key = String.fromCharCode(event.which);
- //alert(event.keyCode);
- // For the keyCodes, look here: http://stackoverflow.com/a/3781360/114029
- // keyCode == 8 is backspace
- // keyCode == 46 is DELETE
- // keyCode == 9 is TAB
- // keyCode == 35 is END
- // keyCode == 36 is HOME
- // keyCode == 37 is left arrow
- // keyCode == 39 is right arrow
- // englishAlphabetDigitsAndWhiteSpace.test(key) does the matching, that is, test the key just typed against the regex pattern
- if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 35 || event.keyCode == 36 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || englishAlphabetDigitsAndWhiteSpace.test(key)) {
- return true;
- }
- // If we got this far, just return false because a disallowed key was typed.
- return false;
- });
- $('.check_input').on("paste",function(e)
- {
- e.preventDefault();
- });
- </div> <!-- /container -->
- </script>
- </body></html>