Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> łączenie dostpaya z innym skryptem
Sahee
post
Post #1





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 1.09.2011

Ostrzeżenie: (0%)
-----


Siemka, potrzebuję połączyć 2 skrypty ze sobą.
Pierwszy to Whitelista do serwera MineCraft
a drugi to skrypt płatności SMS w dotpay'u


to skrypt sprawdzający czy dany kod jest aktywny (nie zużyty):
  1. <?php
  2. echo file_get_contents('http://dotpay.pl/check_code_fullinfo.php?type=sms&del=1&id=34286&code=LESSER&check=' . $sms);
  3. ?>


A tutaj kod z indexu który najprawdopodobniej trzeba przerobić :

  1. <?php
  2. $finish = false;
  3. include("config.php");
  4. require_once("libs/recaptchalib.php");
  5. $error= "";
  6. function Valid(){
  7. include("config.php");
  8. $resp = recaptcha_check_answer ($recaptcha_privatekey,
  9. $_SERVER["REMOTE_ADDR"],
  10. $_POST["recaptcha_challenge_field"],
  11. $_POST["recaptcha_response_field"]);
  12. if ($resp->is_valid or $recaptcha_enabled == false) {
  13. if(isset($_POST["username"]) and strlen($_POST["username"]) > 0 and $_POST["username"] != ""){
  14. $con = @mysql_connect($host,$username,$password);
  15. if($con == null){
  16. $error = "<span style='color: #990000;'>MySQL error: " . mysql_error() ."</span>";
  17. return $error;
  18. }
  19. $db = @mysql_select_db($db);
  20. if($db == null){
  21. $error = "<span style='color: #990000;'>MySQL error: " . mysql_error() ."</span>";
  22. return $error;
  23. }
  24. $IngameUsername = mysql_escape_string($_POST["username"]);
  25.  
  26. $result = @mysql_query("INSERT INTO `$table` (`name`) VALUES ('$IngameUsername');");
  27. if($result == null){
  28. $error = "<span style='color: #990000;'>MySQL error: " . mysql_error() ."</span>";
  29. return $error;
  30. }
  31. $error = "<span style='color: #009900;'>You are now added to the whitelist. Please wait a few minutes before trying to connect!</span>";
  32. return $error;
  33. }else{
  34. $error = "<span style='color: #990000;'>You need to enter your minecraft username!</span>";
  35. return $error;
  36. }
  37. }else{
  38. if(isset($_POST["formsent"])){
  39. $error = "<span style='color: #990000;'>Wrong captcha entered!</span>";
  40. return $error;
  41. }
  42. }
  43. }
  44. $error = Valid();
  45. ?>
  46. <html>
  47. <head>
  48. <title>Whitelist User</title>
  49.  
  50. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  51.  
  52. <script type="text/javascript" src="js/custom-form-elemtents.js"></script>
  53.  
  54. <link rel="stylesheet" href="css/default.css" media="screen" />
  55. </head>
  56. <body>
  57. <div class="wrapper">
  58. <fieldset>
  59. <legend>
  60. Whitelist submission
  61. </legend>
  62. <form method="post" action="">
  63. <?php
  64. if($recaptcha_enabled){
  65. echo "Anti-bot verification:<br />";
  66. echo recaptcha_get_html($recaptcha_publickey);
  67. }
  68. ?>
  69. Minecraft username:<br />
  70. <input type="hidden" id="formsent" name="formsent" />
  71. <input type="text" id="username" name="username" class="input" />
  72. <input type="submit" class="submit"/>
  73. </form>
  74. <?php
  75. echo $error;
  76. ?>
  77. </fieldset>
  78. </div>
  79. </body>
  80. </html>

Config:
  1. <?php
  2. $host = "localhost";
  3. $username = "";
  4. $password = "";
  5. $db = "";
  6. $table = "";
  7.  
  8. //Re-captcha
  9. $recaptcha_enabled = false;
  10. $recaptcha_publickey = "";
  11. $recaptcha_privatekey = "";
  12. ?>


To na tyle, jak będzie coś jeszcze potrzebne to pisać w tym temacie, z góry dziękuje za pomoc i wysiłek smile.gif !
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 19:27