Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Register.php UBERCMS:
- <?php
- /*=======================================================================
- | UberWeb - Lightweight site system for Uber
- | #######################################################################
- | Copyright (c) 2009, Roy 'Meth0d'
- | http://www.meth0d.org
- | #######################################################################
- | This program is free software: you can redistribute it and/or modify
- | it under the terms of the GNU General Public License as published by
- | the Free Software Foundation, either version 3 of the License, or
- | (at your option) any later version.
- | #######################################################################
- | This program is distributed in the hope that it will be useful,
- | but WITHOUT ANY WARRANTY; without even the implied warranty of
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- | GNU General Public License for more details.
- \======================================================================*/
- require_once "global.php";
- if (mysql_num_rows(mysql_query("SELECT * FROM users WHERE ip_last = '" . $_SERVER["REMOTE_ADDR"] . "'")) > 19)
- {
- die('<h1>Hold up!</h2><hr>You have way too many accounts. You are not allowed any more.');
- }
- if (LOGGED_IN)
- {
- header("Location: " . WWW . "/me");
- exit;
- }
- $tpl->SetParam('error-messages-holder', '');
- $tpl->SetParam('post-name', '');
- $tpl->SetParam('post-pass', '');
- $tpl->SetParam('post-tos-check', '');
- $tpl->SetParam('post-mail', '');
- if (isset($_GET['doSubmit']))
- {
- if (isset($_POST['checkNameOnly']) && $_POST['checkNameOnly'] == 'true')
- {
- //$name = $_POST['bean_avatarName'];
- $name = filter($_POST['bean_avatarName']);
- echo ' <div class="field field-habbo-name">
- <label for="habbo-name">Username</label>
- <input type="text" id="habbo-name" size="32" value="' . clean($name) . '" name="bean.avatarName" class="text-field" maxlength="32"/>
- <a href="#" class="new-button" id="check-name-btn"><b>Check</b><i></i></a>
- <input type="submit" name="checkNameOnly" id="check-name" value="Check"/>
- <div id="name-suggestions">';
- if ($users->IsNameTaken($name))
- {
- echo '<div class="taken"><p>Sorry, the name <strong>' . clean($name) . '</strong> is taken!</p></div>';
- }
- else if ($users->IsNameBlocked($name))
- {
- echo '<div class="taken"><p>Sorry, that name is reserved or disallowed.</p></div>';
- }
- else if (!$users->IsValidName($name))
- {
- echo '<div class="taken"><p>Sorry, that name is invalid. Your name can contain lowercase, uppercase letters, and numbers.</p></div>';
- }
- else
- {
- echo '<div class="available"><p>The name <strong>' . clean($name) . '</strong> is available.</p></div>';
- }
- echo ' </div>
- <p class="help">Your name can contain lowercase and uppercase letters and numbers.</p>
- </div>';
- exit;
- }
- else if (isset($_POST['bean_avatarName']))
- {
- $registerErrors = Array();
- $name = filter($_POST['bean_avatarName']);
- $password = $_POST['bean_password'];
- $password2 = $_POST['bean_retypedPassword'];
- $email = filter($_POST['bean_email']);
- $tpl->SetParam('post-name', $name);
- $tpl->SetParam('post-pass', $password);
- $tpl->SetParam('post-mail', $email);
- if (strlen($name) < 1 || strlen($name) > 32)
- {
- $registerErrors[] = "Your username must be 1 - 32 characters in length.";
- }
- if ($users->IsNameTaken($name))
- {
- $registerErrors[] = "Sorry, that name is taken.";
- }
- else if ($users->IsNameBlocked($name))
- {
- $registerErrors[] = "Sorry, that name is reserved or disallowed.";
- }
- else if (!$users->IsValidName($name))
- {
- $registerErrors[] = "Sorry, that name is invalid. Your name can contain lowercase, uppercase letters, and numbers.";
- }
- if (strlen($password) < 6)
- {
- $registerErrors[] = "Your password must be at least 6 characters long.";
- }
- if ($password != $password2)
- {
- $registerErrors[] = "Your passwords do not match. Please try again.";
- }
- if (!$users->IsValidEmail($email))
- {
- $registerErrors[] = "Invalid e-mail address.";
- }
- if (!isset($_POST['bean_tos']) || $_POST['bean_tos'] != "accept")
- {
- $registerErrors[] = "You need to accept the Rules and Terms and Conditions to create an account.";
- }
- else
- {
- $tpl->SetParam('post-tos-check', 'checked');
- }
- if (count($registerErrors) <= 0)
- {
- // Add user
- $users->add($name, $users->UserHash($password, $name), $email, 1, 'hd-180-1.ch-210-66.lg-270-82.sh-290-91.hr-100-', 'M');
- mysql_query("UPDATE users SET newcrypto = '1' WHERE username = '" . $name . "'");
- // Log user in
- $_SESSION['SHOW_WELCOME'] = true;
- $_SESSION['UBER_USER_N'] = $name;
- $_SESSION['UBER_USER_H'] = $users->UserHash($password, $name);
- // Redirect user to welcome page
- header("Location: /client");
- exit;
- }
- else
- {
- $errResult = '<div class="error-messages-holder">
- <h3>Please fix the following problems and resubmit the form.</h3>
- <ul>';
- foreach ($registerErrors as $err)
- {
- $errResult .= '<li><p class="error-message">' . $err . '</p></li>';
- }
- $errResult .= '</ul></div>';
- $tpl->SetParam('error-messages-holder', $errResult);
- }
- }
- }
- $tpl->Init();
- //$tpl->AddGeneric('head-init');
- //$tpl->AddIncludeSet('register');
- $tpl->WriteIncludeFiles();
- $tpl->AddGeneric('head-bottom');
- //$tpl->AddGeneric('page-register');
- //$tpl->AddGeneric('footer');
- $tpl->SetParam('page_title', 'Register your account!');
- $tpl->Output();
- ?>
- Page-Register.tpl :
- <head>
- <title>Zone Hotel : Register</title>
- <link rel="stylesheet" type="text/css" href="http://localhost/web-gallery/index/css/960_12_col.css">
- <link rel="stylesheet" type="text/css" href="http://localhost/web-gallery/index/css/index.css?1">
- </head>
- <body>
- <div class="container_12" style="margin-top:50px;">
- <div style="margin-bottom:20px;">
- <div class="grid_4" style="height:1px;">
- </div>
- <div style="height: 70px;width: 190px;background-image: url('http://localhost/web-gallery/images/v3/logoween.png');float: left;margin-left: -316px;background-repeat: no-repeat;"></div>
- <div class="grid_4" style="height:1px;">
- </div>
- <div class="grid_4">
- <div>
- <div id="onlinecount" style="float:left;margin-left:140px;">
- <div style="font-weight:bold;">%hotel_status%</div>
- </div>
- </div>
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="grid_12">
- </div>
- <div class="grid_8" style="position:relative;height:1px;">
- <div class="box diabox" style="position:relative;background: url(http://localhost/web-gallery/index/img/promo.png) 50% 83%;border:none;box-shadow:inset 0px 0px 1px rgba(0,0,0,0.5)">
- <div class="diainfo">
- <h1 style="margin-top: -5px;">Thank you for joining!</h1>
- This community is something you never experinced before, there is no drama all good vides and fun!
- </div>
- </div>
- </div>
- <div class="grid_4">
- <div class="box" style="height:auto;padding:10px;margin-bottom:20px;" id="loginBox">
- <div class="title"><b>Create your account</b></div>
- <div style="padding:10px;">
- <div id="login">
- <form method="post" action="submit" id="next">
- <div class="label">Username</div>
- <input type="text" class="textbox" name="bean.avatarName" value="%post-name%">
- <div class="label" style="margin-top:15px;">Email <i>( Activation required! )</i></div>
- <input type="text" class="textbox" name="bean.email" value="%post-mail%">
- <div class="label" style="margin-top:20px;">Password</div>
- <input type="password" class="textbox" name="bean.password" value="%post-pass%">
- <div class="label" style="margin-top:25px;">Confirm Password</div>
- <input type="password" class="textbox" name="bean.retypedPassword" value="">
- <br>
- <br><br><br>
- <div style="width:100%;padding:20px;position:absolute;bottom:0px;left:0px;margin-top:50px;">
- <input type="submit" id="registerBtn" class="area" style="width:100%;" value="Register">
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <div style="clear:both;"></div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement