/********************************************************************** * uptimes.noctumdesign.com * Copyright (c) 2002 Ryan Grove . All rights reserved. * * This script 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 2 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA ********************************************************************** * newuser.php * * This is where users create new accounts. **********************************************************************/ require_once("lib/functions.php"); require_once("lib/ui.class.php"); $ui = new infoui; $op = getVar("op"); switch($op) { case "": $ui->header(); $ui->template_open(); $ui->message("Create an Account", "Fill out the form below to create your user account. The information you provide will never be used for any purpose other than keeping track of the uptime data you submit. None of this information will ever be sold or given to any third party, and we will never ever send you spam. We promise."); ?>
$ui->template_close(); $ui->footer(); break; case "newuser": $ui->header(); $ui->template_open(); // Simple data validation if (trim($_POST["user"]) == "" || trim($_POST["pass"]) == "" || trim($_POST["pass2"]) == "" || trim($_POST["email"]) == "") { $ui->message("Looks like you missed something...", "You didn't finish filling out the form, goofball. Go back and try again."); $ui->template_close(); $ui->footer(); exit; } if (ereg("[<>'\"]", $_POST["user"])) { $ui->message("Invalid Username", "The username ".sh($_POST["user"])." contains invalid characters. Please try another one."); $ui->template_close(); $ui->footer(); exit; } if (ereg("['\"]", $_POST["pass"])) { $ui->message("Invalid Password", "The password you chose contains invalid characters. Please choose another one."); $ui->template_close(); $ui->footer(); exit; } if ($_POST["pass"] != $_POST["pass2"]) { $ui->message("Mismatched Passwords", "Your passwords don't match. Go back and try again."); $ui->template_close(); $ui->footer(); exit; } if (!ereg("^([a-zA-Z0-9_.-]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", $_POST["email"])) { $ui->message("Invalid Email Address", "That looks like a fake email address to me. Go back and try again, cowboy."); $ui->template_close(); $ui->footer(); exit; } // Now we get to the fun stuff... $test = get_userinfo(trim($_POST["user"])); if ($test->id > 0) { // User already exists $ui->message("Duplicate Username", "There is already a user with the name ".trim(sh($_POST["user"])).". Please try another one."); $ui->template_close(); $ui->footer(); } else { // Yay! Create the account. addNewUser(trim($_POST["user"]), $_POST["pass"], trim($_POST["email"])); $ui->message("Account Created", "Your user account has been created. You can now login with the username and password you chose. Have fun!"); $ui->template_close(); $ui->footer(); } break; default: echo "Wow. You certainly should never see this. Something must have gone horribly wrong."; break; } ?>