Facebook
From Diminutive Moth, 3 Years ago, written in Plain Text.
This paste is a reply to Skrypt na sprawdzanie from rekin12 - view diff
Embed
Download Paste or View Raw
Hits: 271
  1. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  2. <head>
  3. <title>Dotacja/Donate</title>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width, initial-scale=1">
  6.   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  7.           <style>
  8.             body {
  9.                                 background-color: #f1f1f1;
  10.             }
  11.         </style>
  12.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  13.   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  14. </head>
  15. <body xml:lang="pl">
  16. <?php
  17. //Parametry do zmian:
  18.   $secret_key = 'EAEED26488FCD32306D45CFD07170EFF0EA6ED716E2856EB0B84BF7926E26A2B';
  19.   $action_url = 'https://vpos.polcard.com.pl/vpos/ecom/service.htm';
  20.   $merchant_store_id = '78156151';
  21.   if (count($_POST) > 0)
  22.   {
  23.   if (isset($_POST['amount']))
  24.   $_POST['amount'] = $_POST['amount'] * 100;
  25.  
  26.   $request_params = '';
  27.   // The order in the post_keys array is important!
  28.   $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');
  29.   foreach($post_keys as $key)
  30.    {
  31.     if (isset($_POST[$key]) && $_POST[$key] != '')
  32.         {
  33.       if ($request_params != '') $request_params.= '&';
  34.       $request_params.= $key.'='.$_POST[$key];
  35.     }
  36.    }
  37.   $string_for_control_data_sign = $request_params . pack("H*" , $secret_key);
  38.   $string_for_control_data_sign = $request_params;
  39.   $control = calculateControlData($secret_key, $string_for_control_data_sign);
  40.   $request_params .= '&controlData=' . $control;
  41.   ob_start();
  42.   header("Location: " . $action_url . "?".$request_params);
  43.   ob_end_clean();
  44.   die();
  45.   }
  46. ?>
  47. <div class="container">
  48. <br />
  49. <div><img src="https://www.polcard.pl/assets/img/banner/First-Data-Polcard-blue.png" alt="PolCard" width="140px"/></div><br />
  50. <div style="border-top: 1px solid #b6becf; padding-top: 20px;"></div>  
  51. <?php
  52.   $testing_the_form = TRUE;
  53.   if ($testing_the_form) { $form_action = 'donate.php'; }
  54.   else { $form_action = "https://vpos.polcard.com.pl/vpos/ecom/service.htm"; }
  55. ?>
  56.           <form name="payment_form" method="post" action="<?php  print $form_action; ?>" class="form_payment" onSubmit="return disablesubmit (this);">
  57.       <input type='hidden' name="pos_id" value ="<?php print $merchant_store_id; ?>"/>
  58.       <input type="hidden" name="order_id" class="form-control" id="inputOrder_id" value="ORDER_<?php $orderID = randomPassword(10); print $orderID; ?>" style="width: 300px;">
  59.       <input type="hidden" name="session_id" class="form-control" id="inputSession_id" value="<?php print randomPassword(20); ?>" style="width: 300px;">
  60.   <div class="form-group">
  61.     <label class="control-label col-sm-2" for="inputSubject">Kwota dotacji/Amount:</label>
  62.     <div class="col-sm-10">
  63.       <input type="text" required name="amount" pattern="^\d+(?:\.\d{0,2})?$" class="form-control" id="inputAmount" placeholder="0.00" style="width: 300px;">
  64.     </div>
  65.   </div>
  66.   <input type='hidden' name="currency" value="PLN" />
  67.   <input type='hidden' name="test" value="Y"/>
  68.   <div class="form-group">
  69.   <div class="control-group">
  70.     <label class="control-label col-sm-2" for="inputSubject">Język/Language:</label>
  71.     <div class="col-sm-10">
  72.                 <select name="language" class="form-control" style="width: 300px;">
  73.                         <option value="pl" selected>Polski</option>
  74.                         <option value="en">Angielski</option>
  75.                         <option value="de">Niemiecki</option>
  76.                         <option value="ru">Rosyjski</option>
  77.                         <option value="fr">Francuski</option>
  78.                         <option value="it">Włoski</option>
  79.                         <option value="es">Hiszpański</option>
  80.                         <option value="pt">Portugalski</option>
  81.                 </select>
  82.     </div>
  83.   </div>
  84.   </div>
  85.         <input type='hidden' name='client_ip' value="<?php print  $_SERVER['REMOTE_ADDR']; ?>">
  86.     <input type="hidden" name="street" class="form-control" id="inputStreet" placeholder="Ulica" style="width: 300px;">
  87.     <input type="hidden" name="street_n1" class="form-control" id="inputStreetN1" placeholder="Nr domu" style="width: 300px;">
  88.     <input type="hidden" name="street_n2" class="form-control" id="inputStreetN2" placeholder="Nr mieszkania" style="width: 300px;">
  89.     <input type="hidden" name="addr2" class="form-control" id="inputAddr2" placeholder="Dodatkowe pole adresowe 2" style="width: 300px;">
  90.     <input type="hidden" name="addr3" class="form-control" id="inputAddr3" placeholder="Dodatkowe pole adresowe 3" style="width: 300px;">
  91.     <input type="hidden" name="city" class="form-control" id="inputCity" placeholder="Miasto" style="width: 300px;">
  92.     <input type="hidden" name="postcode" class="form-control" id="inputPostCode" placeholder="Kod Pocztowy" style="width: 300px;">
  93.     <input type="hidden" name="country" class="form-control" id="inputCountry" placeholder="Kraj" style="width: 300px;">
  94.   <div class="form-group">
  95.   <div class="control-group">
  96.     <label class="control-label col-sm-2" for="inputSubject">e-mail:</label>
  97.     <div class="col-sm-10">
  98.       <input type="email" name="email" required class="form-control" id="inputEmail" placeholder="[email protected]" style="width: 300px;">
  99.     </div>
  100.   </div>
  101.   </div>  
  102.       <input type="hidden" name="ba_firstname" class="form-control" id="inputFirstName" placeholder="Imię" style="width: 300px;">
  103.       <input type="hidden" name="ba_lastname" class="form-control" id="inputLastName" placeholder="Nazwisko" style="width: 300px;">
  104.       <input type="hidden" name="merchant_label" class="form-control" id="inputLabel" placeholder="Opis widoczny w raporcie" style="width: 300px;">      
  105. <?php
  106.         function calculateControlData($salt, $params) {
  107.            $saltTab = str_split($salt);
  108.            $hexLenght = strlen($salt);
  109.            $saltBin = "";
  110.            for ($x = 1; $x <= $hexLenght/2; $x++)
  111.            {
  112.               $saltBin .= (pack("H*", substr($salt,2 * $x - 2,2)));
  113.              
  114.            }
  115.            return hash("sha256", $params.$saltBin);
  116.         }
  117.        
  118.         function randomPassword($countLetters) {
  119.             $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
  120.             $pass = array(); //remember to declare $pass as an array
  121.             $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
  122.             for ($i = 0; $i < $countLetters; $i++) {
  123.                 $n = rand(0, $alphaLength);
  124.                 $pass[] = $alphabet[$n];
  125.             }
  126.             return implode($pass); //turn the array into a string
  127.         }
  128. ?>
  129. <div><br /><br /><input type="image" src="https://www.polcard.pl/assets/img/banner/FDP-button-160x35-px.png"/></div>  
  130.  
  131.                         <div style="clear: both;"><!-- --></div>
  132.                        
  133.                         </form>
  134.                         <br /><br />
  135.                         <div style="border-top: 1px solid #b6becf; padding-top: 20px;">
  136.                         <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>
  137.                        
  138.                         <div style="clear: both;"><!-- --></div>                       
  139.                         </div>
  140.                         </div></div><div class="bottom_block_1">
  141.                         </div>
  142.                         </div>
  143.                         <br />
  144.  <script>  
  145.     $(".check_input").on("keypress", function(event) {
  146.     // Disallow anything not matching the regex pattern (A to Z uppercase, a to z lowercase, digits 0 to 9 and white space)
  147.     // For more on JavaScript Regular Expressions, look here: https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions
  148.     var englishAlphabetDigitsAndWhiteSpace = /[A-Za-z0-9 ]/g;
  149.    
  150.     // Retrieving the key from the char code passed in event.which
  151.     // For more info on even.which, look here: http://stackoverflow.com/q/3050984/114029
  152.     var key = String.fromCharCode(event.which);
  153.    
  154.     //alert(event.keyCode);
  155.    
  156.     // For the keyCodes, look here: http://stackoverflow.com/a/3781360/114029
  157.     // keyCode == 8  is backspace
  158.         // keyCode == 46  is DELETE
  159.         // keyCode == 9 is TAB
  160.         // keyCode == 35 is END
  161.         // keyCode == 36 is HOME
  162.     // keyCode == 37 is left arrow
  163.     // keyCode == 39 is right arrow
  164.     // englishAlphabetDigitsAndWhiteSpace.test(key) does the matching, that is, test the key just typed against the regex pattern
  165.     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)) {
  166.         return true;
  167.     }
  168.     // If we got this far, just return false because a disallowed key was typed.
  169.     return false;
  170. });
  171.  
  172. $('.check_input').on("paste",function(e)
  173. {
  174.     e.preventDefault();
  175. });
  176.  
  177. </div> <!-- /container -->
  178. </script>
  179. </body></html>