SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /*-------------------------------------------------------+ | |
| 3 | | PHP-Fusion Content Management System | |
| 4 | | Copyright (C) 2002 - 2011 Nick Jones | |
| 5 | | http://www.php-fusion.co.uk/ | |
| 6 | +--------------------------------------------------------+ | |
| 7 | | Filename: register.php | |
| 8 | | Author: Hans Kristian Flaatten {Starefossen}
| |
| 9 | +--------------------------------------------------------+ | |
| 10 | | This program is released as free software under the | |
| 11 | | Affero GPL license. You can redistribute it and/or | |
| 12 | | modify it under the terms of this license which you | |
| 13 | | can read by viewing the included agpl.txt or online | |
| 14 | | at www.gnu.org/licenses/agpl.html. Removal of this | |
| 15 | | copyright header is strictly prohibited without | |
| 16 | | written permission from the original author(s). | |
| 17 | +--------------------------------------------------------*/ | |
| 18 | require_once "maincore.php"; | |
| 19 | require_once THEMES."templates/header.php"; | |
| 20 | require_once CLASSES."UserFields.class.php"; | |
| 21 | require_once CLASSES."UserFieldsInput.class.php"; | |
| 22 | include LOCALE.LOCALESET."user_fields.php"; | |
| 23 | ||
| 24 | if (iMEMBER || !$settings['enable_registration']) { opentable("1. bandymas");
| |
| 25 | echo "Prisivile blynai"; | |
| 26 | closetable(); | |
| 27 | } | |
| 28 | ||
| 29 | $errors = array(); | |
| 30 | if (isset($_GET['email']) && isset($_GET['code'])) {
| |
| 31 | if (!preg_check("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $_GET['email'])) {
| |
| 32 | redirect("register.php?error=activate");
| |
| 33 | } | |
| 34 | if (!preg_check("/^[0-9a-z]{40}$/", $_GET['code'])) { redirect("register.php?error=activate"); }
| |
| 35 | $result = dbquery( | |
| 36 | "SELECT user_info FROM ".DB_NEW_USERS." | |
| 37 | WHERE user_code='".$_GET['code']."' AND user_email='".$_GET['email']."' | |
| 38 | LIMIT 1" | |
| 39 | ); | |
| 40 | if (dbrows($result)) {
| |
| 41 | add_to_title($locale['global_200'].$locale['u155']); | |
| 42 | ||
| 43 | // getmequick at gmail dot com | |
| 44 | // http://www.php.net/manual/en/function.unserialize.php#71270 | |
| 45 | function unserializeFix($var) {
| |
| 46 | $var = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $var);
| |
| 47 | return unserialize($var); | |
| 48 | } | |
| 49 | ||
| 50 | $data = dbarray($result); | |
| 51 | $user_info = unserializeFix(stripslashes($data['user_info'])); | |
| 52 | $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
| |
| 53 | $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");
| |
| 54 | ||
| 55 | opentable($locale['u155']); | |
| 56 | if ($settings['admin_activation'] == "1") {
| |
| 57 | echo "<div style='text-align:center'><br />\n".$locale['u171']."<br /><br />\n".$locale['u162']."<br /><br />\n</div>\n"; | |
| 58 | } else {
| |
| 59 | echo "<div style='text-align:center'><br />\n".$locale['u171']."<br /><br />\n".$locale['u161']."<br /><br />\n</div>\n"; | |
| 60 | } | |
| 61 | closetable(); | |
| 62 | } else {
| |
| 63 | opentable("2. bandymas");
| |
| 64 | echo "Prisivile vafliai"; | |
| 65 | closetable(); | |
| 66 | ||
| 67 | } | |
| 68 | } elseif (isset($_POST['register'])) {
| |
| 69 | $userInput = new UserFieldsInput(); | |
| 70 | $userInput->validation = $settings['display_validation']; | |
| 71 | $userInput->emailVerification = $settings['email_verification']; | |
| 72 | $userInput->adminActivation = $settings['admin_activation']; | |
| 73 | $userInput->skipCurrentPass = true; | |
| 74 | $userInput->registration = true; | |
| 75 | $userInput->saveInsert(); | |
| 76 | $userInput->displayMessages(); | |
| 77 | $errors = $userInput->getErrorsArray(); | |
| 78 | unset($userInput); | |
| 79 | } | |
| 80 | ||
| 81 | if ((!isset($_POST['register']) && !isset($_GET['code'])) || (isset($_POST['register']) && count($errors) > 0)) {
| |
| 82 | opentable($locale['u101']); | |
| 83 | $userFields = new UserFields(); | |
| 84 | $userFields->postName = "register"; | |
| 85 | $userFields->postValue = $locale['u101']; | |
| 86 | $userFields->displayValidation = $settings['display_validation']; | |
| 87 | $userFields->displayTerms = $settings['enable_terms']; | |
| 88 | $userFields->showAdminPass = false; | |
| 89 | $userFields->showAvatarInput = false; | |
| 90 | $userFields->skipCurrentPass = true; | |
| 91 | $userFields->registration = true; | |
| 92 | $userFields->errorsArray = $errors; | |
| 93 | $userFields->displayInput(); | |
| 94 | closetable(); | |
| 95 | } | |
| 96 | ||
| 97 | require_once THEMES."templates/footer.php"; | |
| 98 | ?> |