A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
4.5 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file register.php
  5. * @version 1.0.x, 27-01-2007, 11:22
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  8. * @license GNU GPL v3
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. include('./config.php');
  13. include('./includes/constants.php');
  14. include('./includes/class_db.php');
  15. include('./includes/class_error.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. include('./includes/sessions.php');
  19. include('./includes/class_user.php');
  20. include('./common.php');
  21. include('./includes/class_overall.php');
  22. include('./includes/class_forum.php');
  23. include('./includes/class_posting.php');
  24. include('./includes/class_topic.php');
  25. include('./includes/class_email.php');
  26. include('./includes/class_mod.php');
  27. include('./includes/classes/secure.php');
  28. $default_lang = Over::DefaultLang();
  29. include('./lngs/'.$default_lang.'/main.php');
  30. include('./lngs/'.$default_lang.'/email.php');
  31. $start = Over::TimeGeneration();
  32. sess_del_invalid($_SESSION['uid']);
  33. sess_register($_SESSION['uid']);
  34. sess_delete_old();
  35. $default_skin = Over::ViewSkinName();
  36. $msg='';
  37. if ($_SESSION['uid']>0)
  38. {
  39. message_forum($lng['youareexist'],'index.php');
  40. }
  41. foreach ($_POST as $name => $value)
  42. {
  43. if ($forum_config['use_censorlist'])
  44. {
  45. $_POST[$name] = Secure::UseCensorlist($value);
  46. }
  47. }
  48. if (isset($_POST['email']))
  49. {
  50. if ( ereg ("^.+@.+\..+$", $_POST['email']))
  51. { $nick = $_POST['nick'];
  52. if ($nick!='')
  53. {
  54. $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
  55. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
  56. $result = mysql_fetch_array($query);
  57. $result = $result['nick'];
  58. if ($result!=$nick)
  59. {
  60. if ($_POST['password']!='')
  61. {
  62. if ($_POST['password']==$_POST['confirmpassword'])
  63. {
  64. if ($_POST['valid_match']==$_POST['valid_key'])
  65. {
  66. $_POST['nick']= addslashes(strip_tags($_POST['nick']));
  67. $original_pass = $_POST['password'];
  68. $_POST['password']=md5($_POST['password']);
  69. User::CreateProfile($_POST['nick'],$_POST['password'], $_POST['email'],0,1,0,1,'','','');
  70. $stop = Over::TimeGeneration();
  71. if ($forum_config['allow_send_email'])
  72. {
  73. Email::SendRegisterEmail();
  74. }
  75. message_forum($lng['account_created'],'index.php');
  76. }
  77. else
  78. {
  79. $message = $lng['key_not_valid'];
  80. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  81. }
  82. }
  83. else
  84. {
  85. $message=$lng['incorrect_password2'];
  86. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  87. }
  88. }
  89. else
  90. {
  91. $message=$lng['empty_password'];
  92. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  93. }
  94. }
  95. else
  96. {
  97. $message=$lng['user_is_exist'];
  98. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  99. }
  100. }
  101. else
  102. {
  103. $message=$lng['empty_email'];
  104. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  105. }
  106. }
  107. else
  108. {
  109. $message=$lng['invalid_email'];
  110. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  111. }
  112. }
  113. else
  114. {
  115. $_POST['nick']='';
  116. $_POST['email']='';
  117. $_POST['interests']='';
  118. $_POST['sig']='';
  119. $_POST['avatar']='';
  120. }
  121. $match_array = Secure::generate_code();
  122. //add skin variables
  123. $skin = array(
  124. //labels profile
  125. 'lnick' => $lng['user_name'],
  126. 'lpass' => $lng['lpassw'],
  127. 'lnewpass' => $lng['new_password'],
  128. 'lcpass' => $lng['confirm_password'],
  129. 'lemail' => 'E-mail',
  130. 'lgg' => $lng['gg_number'],
  131. 'lallow_gg' => $lng['allow_gg'],
  132. 'lallow_email' => $lng['allow_email'],
  133. 'lallow_qr' => $lng['allow_qr'],
  134. 'linterests' => $lng['luinterests'],
  135. 'lsig' => $lng['sig'],
  136. 'lavaddr' => $lng['picture_adress'],
  137. 'lmatch'=> $match_array[0].' + '.$match_array[1].' = ',
  138. 'valid_key' => $match_array[2],
  139. 'lovpr' => $lng['general_settings'],
  140. 'lupr' => $lng['profile_settings'],
  141. 'lspr' => $lng['signature_settings'],
  142. 'lapr' => $lng['avatar_settings'],
  143. 'lsubmit' => $lng['save'],
  144. 'lreset' => $lng['reset'],
  145. 'no' => $lng['no'],
  146. 'yes' => $lng['yes'],
  147. 'pa_link'=>''
  148. );
  149. $_POST['allow_gg']='1';
  150. $skin = array_push_associative($skin, Over::generate_header($lng['lregister'],'</a>&gt; <a href="register.php" class="navigator">'.$lng['lregister']));
  151. if ($msg=='')
  152. {
  153. $msg = './skins/'.$default_skin.'/blank.tpl';
  154. }
  155. //do it!
  156. include('./skins/'.$default_skin.'/overall_header.tpl');
  157. include('./skins/'.$default_skin.'/register_body.tpl');
  158. $stop = Over::TimeGeneration();
  159. $skin['queries'] = Over::ShowQueries($start, $stop);
  160. include('./skins/'.$default_skin.'/overall_footer.tpl');
  161. ?>