register.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. //Open Game Panel Free User Registration Add On By
  25. // MarkDogg18769
  26. define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
  27. define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
  28. function exec_ogp_module()
  29. {
  30. global $db,$view,$settings;
  31. startSession();
  32. if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 )
  33. {
  34. $errmsg = '<table>';
  35. foreach($_SESSION['ERRMSG_ARR'] as $msg)
  36. {
  37. $errmsg .= "<tr><td><img width='8px' src='images/offline.png'/></td><td style='text-align:left;color:red;'>".$msg.'</td></tr>';
  38. }
  39. $errmsg .= '</table><br>';
  40. unset($_SESSION['ERRMSG_ARR']);
  41. }
  42. echo "<h2>".get_lang('user_registration')."</h2>";
  43. if(isset($errmsg))
  44. {
  45. echo $errmsg;
  46. $input = $_SESSION['INPUT'];
  47. }
  48. $lang_switch = (isset($_GET['lang']) AND $_GET['lang'] != "-" )? "&lang=".$_GET['lang'] : "";
  49. ?>
  50. <style>
  51. .left {
  52. margin-left:auto;
  53. margin-right:auto;
  54. text-align:left;
  55. }
  56. .right
  57. {
  58. margin-left:auto;
  59. margin-right:auto;
  60. text-align:right;
  61. }
  62. </style>
  63. <?php
  64. require_once('includes/form_table_class.php');
  65. $ft = new FormTable();
  66. $ft->start_form("?m=register&p=exec$lang_switch", "post", "name=\"loginForm\"");
  67. $ft->start_table();
  68. $ft->add_field('string','login_name',@$input['users_login']);
  69. $ft->add_field('password','users_passwd','');
  70. $ft->add_field('password','users_cpasswd','');
  71. $ft->add_field('string','users_fname',@$input['users_fname']);
  72. $ft->add_field('string','users_lname',@$input['users_lname']);
  73. $ft->add_field('string','users_email',@$input['users_email']);
  74. $ft->add_field_hidden('users_comment',get_lang_f('registered_on', date("d/m/Y")) );
  75. echo "<tr><td>&nbsp;</td><td align='right'>";
  76. if(!empty($settings['recaptcha_site_key']) && !empty($settings['recaptcha_secret_key'])){
  77. $sitekey = $settings['recaptcha_site_key'];
  78. $secretkey = $settings['recaptcha_secret_key'];
  79. }else{
  80. require_once('captchakeys.php');
  81. }
  82. $use_ssl = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? true : false;
  83. echo recaptcha_get_html($sitekey,null,$use_ssl);
  84. echo "</td></tr>";
  85. $ft->end_table();
  86. $ft->add_button("submit","Submit",get_lang('register_a_new_user'));
  87. $ft->end_form();
  88. }
  89. function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
  90. {
  91. if ($pubkey == null || $pubkey == '') {
  92. die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
  93. }
  94. if ($use_ssl) {
  95. $server = RECAPTCHA_API_SECURE_SERVER;
  96. } else {
  97. $server = RECAPTCHA_API_SERVER;
  98. }
  99. $errorpart = "";
  100. if ($error) {
  101. $errorpart = "&amp;error=" . $error;
  102. }
  103. return "<script src='" . $server . ".js'></script><div style='display: inline-block;' class='g-recaptcha' data-sitekey='" . $pubkey . "'></div>";
  104. }
  105. ?>