Advertisement
Guest User

gateway_button.php

a guest
Mar 11th, 2016
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require_once('WebToPay.php');
  4.  
  5. function get_self_url() {
  6. $s = substr(strtolower($_SERVER['SERVER_PROTOCOL']), 0,
  7. strpos($_SERVER['SERVER_PROTOCOL'], '/'));
  8.  
  9. if (!empty($_SERVER["HTTPS"])) {
  10. $s .= ($_SERVER["HTTPS"] == "on") ? "s" : "";
  11. }
  12.  
  13. $s .= '://'.$_SERVER['HTTP_HOST'];
  14.  
  15. if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80') {
  16. $s .= ':'.$_SERVER['SERVER_PORT'];
  17. }
  18.  
  19. $s .= dirname($_SERVER['SCRIPT_NAME']);
  20.  
  21. return $s;
  22. }
  23.  
  24. try {
  25. $self_url = get_self_url();
  26.  
  27. $request = WebToPay::buildRequest(array(
  28. // Čia surašyti tik keli parametrai.
  29. // Visų galimų parametrų su aprašymais sąrašą rasite žemiau.
  30. 'projectid' => 0,
  31. 'sign_password' => '',
  32. 'orderid' => 0,
  33. 'country' => 'LT',
  34. 'lang' => 'LIT',
  35. 'paytext' => 'Parama [site_name] svetainei.',
  36. 'accepturl' => $self_url.'/accept.php',
  37. 'cancelurl' => $self_url.'/cancel.php',
  38. 'callbackurl' => $self_url.'/callback.php',
  39. 'test' => 0,
  40. ));
  41. } catch (WebToPayException $e) {
  42. echo $e->getMessage();
  43. }
  44.  
  45. ?>
  46. <form method="post" action="<?php echo WebToPay::PAY_URL; ?>">
  47. <?php foreach ($request as $key => $val): ?>
  48. <input type="hidden" name="<?php echo $key ?>"
  49. value="<?php echo get_magic_quotes_gpc() ? $val : addslashes($val); ?>" />
  50. <?php endforeach; ?>
  51. <input type="image" border="0" name="submit"
  52. src="https://www.mokejimai.lt/payment/m/m_images/wfiles/i25zov101.gif"
  53. alt="Paremkite svetainę! - mokejimai.lt tai saugu ir patikima!" />
  54. </form>
Advertisement
RAW Paste Data Copied
Advertisement