Guest User

Untitled

a guest
Feb 28th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.21 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('./includes/core.php');
  4. $data = new register_sql;
  5. $lang->addLocale("landing.register");
  6.  
  7. if(isset($_SESSION['username']))
  8. {
  9. header("Location: ".PATH."/");
  10. exit;
  11. }
  12.  
  13. $error = array();
  14. $failure = false;
  15. $error_box = '<div id="error-placeholder"></div>';
  16.  
  17. function RewriteError()
  18. {
  19. global $error_box, $error;
  20.  
  21. $error_box = '<div id="error-messages-container" class="cbb">
  22. <div class="rounded" style="background-color: #cb2121;">
  23. <div id="error-title" class="error">';
  24.  
  25. foreach ($error as $value)
  26. {
  27. $error_box .= $value."<br/>\r\n";
  28. }
  29.  
  30. $error_box .= '</div>
  31. </div>
  32. </div>';
  33. }
  34.  
  35. $step = 'age_gate';
  36. if (isset($_GET['step']))
  37. {
  38. $step = $_GET['step'];
  39. }
  40.  
  41. switch ($step)
  42. {
  43. case 'age_gate_submit':
  44.  
  45. $day = $input->FilterText($_POST['bean_day']);
  46. $month = $input->FilterText($_POST['bean_month']);
  47. $year = $input->FilterText($_POST['bean_year']);
  48.  
  49. $gender = $input->FilterText($_POST['bean_gender']);
  50.  
  51. $_year = date('Y');
  52. $_days = cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'));
  53. if ($day < 1 || $day > $_days || $month > 12 || $month < 1 || $year < ($_year -100) || $year > $_year)
  54. {
  55. $error[] = 'Type alsjeblieft een geldige datum';
  56. $failure = true;
  57. }
  58.  
  59. if ($year > ($_year -8))
  60. {
  61. header("Location: ".PATH."/register.php?step=age_limit");
  62. exit;
  63. }
  64.  
  65. if ($gender != 'male' && $gender != 'female')
  66. {
  67. $error[] = 'Ben je shemale?!';
  68. $failure = true;
  69. }
  70.  
  71. if (!$failure)
  72. {
  73. $_SESSION['register']['day'] = $day;
  74. $_SESSION['register']['month'] = $month;
  75. $_SESSION['register']['year'] = $year;
  76. $_SESSION['register']['gender'] = $gender;
  77.  
  78. header("Location: ".PATH."/register?step=email_password");
  79. exit;
  80. }
  81.  
  82. RewriteError();
  83.  
  84. require './templates/register_age_gate.php';
  85. break;
  86.  
  87. case 'age_limit':
  88. require './templates/register_age_limit.php';
  89. break;
  90.  
  91. case 'email_password':
  92.  
  93. if (!isset($_SESSION['register']['day']) && !isset($_SESSION['register']['gender']))
  94. {
  95. header('Location: '.PATH.'/register?step=age_gate');
  96. exit;
  97. }
  98.  
  99. $class_u = '';
  100. $class_e = '';
  101. $class_p = '';
  102. $class_p2 = '';
  103. $class_tos = '';
  104.  
  105. $field_username = (isset($_SESSION['register']['username'])) ? $_SESSION['register']['username'] : '';
  106. $field_email = (isset($_SESSION['register']['email'])) ? $_SESSION['register']['email'] : '';
  107. $field_password = (isset($_SESSION['register']['password'])) ? $_SESSION['register']['password'] : '';
  108. $field_password_retyped = (isset($_SESSION['register']['password'])) ? $_SESSION['register']['password'] : '';
  109. $field_tos = (isset($_SESSION['register']['tos'])) ? 'checked' : '';
  110.  
  111. $gender = $_SESSION['register']['gender'];
  112.  
  113. require './templates/register_email_password.php';
  114. break;
  115.  
  116. case 'email_password_submit':
  117.  
  118. if (empty($_POST))
  119. {
  120. header('Location: '.PATH.'/register?step=email_password');
  121. exit;
  122. }
  123.  
  124. $field_username = $username = $input->FilterText($_POST['bean_username']);
  125. $field_email = $email = $input->FilterText($_POST['bean_email']);
  126. $field_password = $password = $input->FilterText($_POST['bean_password']);
  127. $field_password_retyped = $password_retyped = $input->FilterText($_POST['bean_retypedPassword']);
  128.  
  129. $accpet_tos = (isset($_POST['bean_termsOfServiceSelection'])) ? $_POST['bean_termsOfServiceSelection'] : '';
  130. $accept_tos = filter_var($accpet_tos, FILTER_VALIDATE_BOOLEAN);
  131. $field_tos = ($accept_tos) ? 'checked' : '';
  132.  
  133. $newsletter = (isset($_POST['bean.marketing'])) ? $_POST['bean.marketing'] : 'false';
  134. $newsletter = ($newsletter == 'true') ? '1' : '0';
  135.  
  136. $filter = preg_replace("/[^a-z\d\-=\?!@:\.]/i", "", $username);
  137. $email_check = preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $email);
  138.  
  139. $class_u = '';
  140. $class_e = '';
  141. $class_p = '';
  142. $class_p2 =& $class_p;
  143. $class_tos = '';
  144.  
  145. // Name validation
  146. if(strlen($username) < 1)
  147. {
  148. $class_u = 'error';
  149. $error[] = 'Deze Doxnaam is te kort.';
  150. $failure = true;
  151. }
  152. elseif($serverdb->num_rows($serverdb->query("SELECT id,name,email FROM ".PREFIX."users WHERE name = '".$username."' LIMIT 1")) > 0)
  153. {
  154. $_SESSION['register']['username'] = $username;
  155. header('Location: '.PATH.'/register?step=dubplicateEmail');
  156. exit;
  157. }
  158. elseif($filter != $username)
  159. {
  160. $class_u = 'error';
  161. $error[] = 'Deze Doxnaam is niet toegestaan.';
  162. $failure = true;
  163. }
  164. elseif(strlen($username) > 24)
  165. {
  166. $class_u = 'error';
  167. $error[] = 'Deze Doxnaam is te lang.';
  168. $failure = true;
  169. }
  170.  
  171. // MOD- Names validation
  172. $first = substr($username, 0, 4);
  173. if (strnatcasecmp($first,"MOD-") == false) {
  174. $class_u = 'error';
  175. $error[] = 'Deze Doxnaam is niet toegestaan.';
  176. $failure = true;
  177. }
  178.  
  179. // Password validation
  180. if($password !== $password_retyped)
  181. {
  182. $class_p = 'error';
  183. $error[] = 'Wachtwoord is niet hetzelfde. Probeer het nog eens.';
  184. $failure = true;
  185. }
  186. elseif(strlen($password) < 6)
  187. {
  188. $class_p = 'error';
  189. $error[] = 'Het opgegeven wachtwoord is tekort.';
  190. $failure = true;
  191. }
  192.  
  193. // E-Mail validation
  194. if(strlen($email) < 6)
  195. {
  196. $class_e = 'error';
  197. $error[] = 'Het opgegeven mailadres is tekort.';
  198. $failure = true;
  199. }
  200. elseif($email_check !== 1)
  201. {
  202. $class_e = 'error';
  203. $error[] = 'Vul alsjeblieft een geldig mailadres in.';
  204. $failure = true;
  205. }
  206.  
  207. // Terms of Service validation
  208. if(!$accept_tos)
  209. {
  210. $class_tos = 'error';
  211. $error[] = 'De Algemene Voorwaarden moeten worden geaccepteerd om verder te kunnen.';
  212. $failure = true;
  213. }
  214.  
  215. if (!$failure)
  216. {
  217. $_SESSION['register']['username'] = $username;
  218. $_SESSION['register']['email'] = $email;
  219. $_SESSION['register']['password'] = $password;
  220. $_SESSION['register']['newsletter'] = $newsletter;
  221. $_SESSION['register']['tos'] = $accept_tos;
  222.  
  223. header('Location: '.PATH.'/register?step=captcha');
  224. exit;
  225. }
  226.  
  227. RewriteError();
  228.  
  229. $gender = $_SESSION['register']['gender'];
  230.  
  231. require './templates/register_email_password.php';
  232. break;
  233.  
  234. case 'dubplicateEmail':
  235.  
  236. $username = $_SESSION['register']['username'];
  237.  
  238. require './templates/register_dubplicateEmail.php';
  239. break;
  240.  
  241. case 'captcha':
  242.  
  243. if (!isset($_SESSION['register']['username']) && !isset($_SESSION['register']['tos']))
  244. {
  245. header('Location: '.PATH.'/register?step=email_password');
  246. exit;
  247. }
  248.  
  249. require './templates/register_captcha.php';
  250. break;
  251.  
  252. case 'captcha_submit':
  253.  
  254. if (empty($_POST))
  255. {
  256. header('Location: '.PATH.'/register?step=captcha');
  257. exit;
  258. }
  259.  
  260. if(($_SESSION['register-captcha-bubble'] == strtolower($_POST['bean_captchaResponse']) && !empty($_SESSION['register-captcha-bubble'])) || $settings->find("site_capcha") == "0") {
  261. unset($_SESSION['register-captcha-bubble']);
  262. } else {
  263. $error[] = 'De code die je in hebt getypt is ongeldig. Probeer het nog eens.';
  264. $failure = true;
  265. }
  266.  
  267. if (!$failure)
  268. {
  269. $day = $_SESSION['register']['day'];
  270. $month = $_SESSION['register']['month'];
  271. $year = $_SESSION['register']['year'];
  272.  
  273. $name = $_SESSION['register']['username'];
  274. $password = $_SESSION['register']['password'];
  275. $email = $_SESSION['register']['email'];
  276. $newsletter = $_SESSION['register']['newsletter'];
  277.  
  278. $gender = ($_SESSION['register']['gender'] == 'male') ? 'M' : 'F';
  279. $generator = new HoloFigureCheck();
  280. $figure = current($generator->generateFigure(false, $gender));
  281.  
  282. unset($_SESSION['register']);
  283.  
  284. $scredits = $settings->find("register_start_credits");
  285.  
  286. $dob = $day . "-" . $month . "-" . $year;
  287.  
  288. $password = $input->HoloHash($password, $name);
  289.  
  290. $data->insert1($name,$password,$dob,$figure,$gender,2500);
  291. $row = $serverdb->fetch_row($data->select3($name));
  292. $serverdb->query("INSERT INTO cms_users (id,name,lastvisit,online,newsletter,email_verified,show_home,email_friendrequest,email_minimail,email,show_online) VALUES ('".$row[0]."','".$row[1]."','".time()."','".time()."','".$newsletter."','0','1','1','1','".$email."','1')");
  293.  
  294. if($settings->find("email_verify_enabled") == "1"){
  295. $hash = "";
  296. $length = 8;
  297. $possible = "0123456789qwertyuiopasdfghjkzxcvbnm";
  298. $i = 0;
  299. while ($i < $length) {
  300. $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
  301. if (!strstr($hash, $char)) {
  302. $hash .= $char;
  303. $i++;
  304. }
  305. }
  306. $hash = sha1($hash);
  307. $num = $key;
  308. $db->query("INSERT INTO ".PREFIX."verify (id,email,key_hash) VALUES ('".$row[0]."','".$email."','".$hash."')");
  309. $lang->addLocale("email.confirmationemail");
  310. if($settings->find("email_verify_reward") != "0"){ $reward_text = $lang->loc['email.reward']." ".$settings->find("email_verify_reward")." ".$lang->loc['credits']; }else{ $reward_text = ""; }
  311. $subject = $lang->loc['email.subject']." ".SHORTNAME;
  312. $to = $email;
  313. $html =
  314. '<h1 style="font-size: 16px">'.$lang->loc['email.verify.1'].'</h1>
  315.  
  316. <p>
  317. '.$reward_text.'
  318. '.$lang->loc['email.verify.2'].' <a href="'.PATH.'/email?key='.$hash.'">'.$lang->loc['email.verify.2.b'].'</a>
  319. </p>
  320.  
  321. <p>
  322. '.$lang->loc['email.verify.3'].'
  323. </p>
  324.  
  325. <blockquote>
  326. <p>
  327. <b>'.$lang->loc['email.verify.4'].'</b> '.$name.'<br>
  328. <b>'.$lang->loc['email.verify.5'].'</b> '.$dob.'
  329. </p>
  330. </blockquote>
  331.  
  332. <p>
  333. '.$lang->loc['email.verify.6'].'
  334. </p>
  335.  
  336. <p>'.$lang->loc['email.verify.7'] .'<br><br>
  337. '.$lang->loc['email.verify.8'].'<p>
  338. '.PATH.'/</p>
  339.  
  340. <p>
  341. '.$lang->loc['email.verify.9'].' <a href="'.PATH.'/email?remove='.$hash.'">'.$lang->loc['email.verify.9.b'].'</a>.
  342. </p>
  343.  
  344. <p>
  345. '.$lang->loc['email.verify.11'].'<a href="'.PATH.'/help">'.$lang->loc['email.verify.12'].'</a>.
  346. </p>';
  347. $mailer = new HoloMail;
  348. $mailer->sendSimpleMessage($to,$subject,$html);
  349. }else{
  350. $serverdb->query("UPDATE ".PREFIX."users SET email_verified = '1' WHERE id = '".$row[0]."' LIMIT 1");
  351. }
  352.  
  353. // Referral
  354. if($refer == true){
  355. $data->update1($referrow[0],$settings->find("register_referral_rewards"));
  356. $db->query("INSERT INTO ".PREFIX."transactions (userid,time,amount,descr) VALUES ('".$referrow[0]."','".time()."','".$settings->find("register_referral_rewards")."','Referring a user.')");
  357. $data->insert2($row[0],$referrow[0]);
  358. $_SESSION['referral'] = $referrow[0];
  359. }
  360.  
  361. $user = new HoloUser($name,$password,true);
  362. $_SESSION['user'] = $user;
  363.  
  364. header("Location: ".PATH."/security_check?page=./me");
  365.  
  366. exit; // cut off the script
  367.  
  368. // And we're done!
  369. }
  370.  
  371. RewriteError();
  372.  
  373. require './templates/register_captcha.php';
  374. break;
  375.  
  376. case 'age_gate':
  377. default:
  378. require './templates/register_age_gate.php';
  379. break;
  380. }
  381.  
  382. ?>
Add Comment
Please, Sign In to add comment