//start session.
session_start();
define('IN_EBB', true);
/*
Filename: register.php
Last Modified: 1/3/2006
Term of Use:
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 2 of the License, or
(at your option) any later version.
*/
include "config.php";
require "header.php";
$page = new template($template_path ."/header.htm");
$page->replace_tags(array(
"TITLE" => "$title",
"PAGETITLE" => "$reg[register]",
"BGCOLOR" => "$bg_color",
"TEXTCOLOR" => "$text_color",
"LINKCOLOR" => "$link",
"VLINKCOLOR" => "$vlink",
"FONTFACE" => "$font"));
$page->output();
//check to see if the install file is stil on the user's server.
if (file_exists("install.php")){
if ($stat == "Admin"){
$error = $txt['installadmin'];
echo error($error, "error");
}
else{
$error = $txt['install'];
echo error($error, "general");
}
}
//check to see if this user is able to access this board.
echo check_ban();
//check to see if the board is on or off.
if ($board_status == "Off"){
$error = $off_msg;
echo error($error, "general");
if ($stat == "Admin"){
echo "
$menu[cp]";
}
}
//output top
if ($stat == "Admin"){
$page = new template($template_path ."/top-admin.htm");
$page->replace_tags(array(
"TITLE" => "$title",
"LANG-WELCOME" => "$txt[welcome]",
"LOGGEDUSER" => "$logged_user",
"LANG-LOGOUT" => "$txt[logout]",
"LANG-IM" => "$menu[launchim]",
"LANG-CP" => "$menu[cp]",
"TABLE1" => "$table1",
"ADDRESS" => "$address",
"LANG-HOME" => "$menu[home]",
"LANG-SEARCH" => "$menu[search]",
"LANG-FAQ" => "$menu[faq]",
"LANG-MEMBERLIST" => "$menu[members]",
"LANG-PROFILE" => "$menu[profile]"));
$page->output();
//check to see if user is marked as online, if not mark them as online.
$time = time();
$db->run = "select * from ebb_online where Username='$logged_user'";
$count_member = $db->num_results();
$db->close();
if ($count_member == 0){
//user seems to be just getting on.
$db->run = "insert into ebb_online (Username, time, location) values('$logged_user', '$time', '$_SERVER[PHP_SELF]')";
$db->query();
$db->close();
}
else{
//user is still here so lets up their time to let the script know the user is still around.
$db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where Username='$logged_user'";
$db->query();
$db->close();
}
}
if (($stat == "Member") OR ($stat == "Moderator")){
$page = new template($template_path ."/top-logged.htm");
$page->replace_tags(array(
"TITLE" => "$title",
"LANG-WELCOME" => "$txt[welcome]",
"LOGGEDUSER" => "$logged_user",
"LANG-LOGOUT" => "$txt[logout]",
"LANG-IM" => "$menu[launchim]",
"TABLE1" => "$table1",
"ADDRESS" => "$address",
"LANG-HOME" => "$menu[home]",
"LANG-SEARCH" => "$menu[search]",
"LANG-FAQ" => "$menu[faq]",
"LANG-MEMBERLIST" => "$menu[members]",
"LANG-PROFILE" => "$menu[profile]"));
$page->output();
//check to see if user is marked as online, if not mark them as online.
$time = time();
$db->run = "select * from ebb_online where Username='$logged_user'";
$count_member = $db->num_results();
$db->close();
if ($count_member == 0){
//user seems to be just getting on.
$db->run = "insert into ebb_online (Username, time, location) values('$logged_user', '$time', '$_SERVER[PHP_SELF]')";
$db->query();
$db->close();
}
else{
//user is still here so lets up their time to let the script know the user is still around.
$db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where Username='$logged_user'";
$db->query();
$db->close();
}
}
if ($stat == "guest"){
$page = new template($template_path ."/top-guest.htm");
$page->replace_tags(array(
"TITLE" => "$title",
"LANG-WELCOME" => "$txt[welcomeguest]",
"LANG-LOGIN" => "$txt[login]",
"LANG-REGISTER" => "$txt[register]",
"TABLE1" => "$table1",
"ADDRESS" => "$address",
"LANG-HOME" => "$menu[home]",
"LANG-SEARCH" => "$menu[search]",
"LANG-FAQ" => "$menu[faq]",
"LANG-MEMBERLIST" => "$menu[members]"));
$page->output();
//check to see if guest is marked as online, if not mark them as online.
$time = time();
$ip = $_SERVER["REMOTE_ADDR"];
$db->run = "select * from ebb_online where ip='$ip'";
$count_guest = $db->num_results();
$db->close();
if ($count_guest == 0){
$db->run = "insert into ebb_online (ip, time, location) values('$ip', '$time', '$_SERVER[PHP_SELF]')";
$db->query();
$db->close();
}
else{
//user is still here so lets up their time to let the script know the user is still around.
$db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where ip='$ip'";
$db->query();
$db->close();
}
}
//display register form.
switch ( $_GET['action'] )
{
case 'process':
//get values from form.
$email = stripslashes($_POST['email']);
$username = stripslashes($_POST['username']);
$password = $_POST['password'];
$vert_password = $_POST['vert_password'];
$time_zone = $_POST['time_zone'];
$time_format = $_POST['time_format'];
$im_notice = $_POST['im_notice'];
$style = $_POST['style'];
$default_lang = $_POST['default_lang'];
$msn_messenger = $_POST['msn_messenger'];
$aol_messenger = $_POST['aol_messenger'];
$yim = $_POST['yim'];
$icq = $_POST['icq'];
$location = $_POST['location'];
$sig = $_POST['sig'];
$site = $_POST['site'];
$agreecheck = $_POST['agreecheck'];
$number = $_POST['img_vert'];
$IP = $_SERVER['REMOTE_ADDR'];
//error checking.
if (($security_image == "On") AND ($number == "")){
$error = $reg['noimgvert'];
echo error($error, "error");
}
if (($tos == "On") AND ($agreecheck == "")){
$error = $reg['disagreetos'];
echo error($error, "error");
}
if ($style == ""){
$error = $reg['nostyle'];
echo error($error, "error");
}
if ($default_lang == ""){
$error = $reg['nolang'];
echo error($error, "error");
}
if ($time_zone == ""){
$error = $reg['notimezone'];
echo error($error, "error");
}
if ($time_format == ""){
$error = $reg['notimeformat'];
echo error($error, "error");
}
if ($im_notice == ""){
$error = $reg['noimnotify'];
echo error($error, "error");
}
if ($username == ""){
$error = $reg['nouser'];
echo error($error, "error");
}
if ($email == ""){
$error = $reg['noemail'];
echo error($error, "error");
}
if ($password == ""){
$error = $reg['nopass'];
echo error($error, "error");
}
if ($vert_password == ""){
$error = $reg['novertpass'];
echo error($error, "error");
}
if (ereg('[^A-Za-z0-9]', $username)){
$error = $reg['invalidchar'];
echo error($error, "error");
}
if ($vert_password !== $password){
$error = $reg['nomatch'];
echo error($error, "error");
}
//check to see if the user & email have already been used already.
$db->run = "SELECT Email FROM ebb_users WHERE Email='$email'";
$email_check = $db->num_results();
$db->close();
$db->run = "SELECT Username FROM ebb_users WHERE Username='$username'";
$username_check = $db->num_results();
$db->close();
if(($email_check > 0) || ($username_check > 0)){
if($email_check > 0){
$error = $reg['emailexist'];
echo error($error, "error");
}
if($username_check > 0){
$error = $reg['usernameexist'];
echo error($error, "error");
}
}
//see if a username/IP was banned.
echo check_ban();
if ($security_image == "On"){
$match_check = md5($number);
//see if the security image and the user's text match.
if ($match_check !== $_SESSION['image_random_value']){
$error = $reg['imgvertnomatch'];
echo error($error, "error");
}else{
//number correct, remove the random value from session.
session_destroy();
}
}
//perfrom query.
$pass = md5($password);
$time = time();
$db->run = "INSERT INTO ebb_users (Email, Username, Password, Status, Date_Joined, IP, MSN, AOL, Yahoo, ICQ, Location, Sig, WWW, Time_format, Time_Zone, IM_Notify, Style, Language) VALUES('$email', '$username', '$pass', 'Member', $time, '$IP', '$msn_messenger', '$aol_messenger', '$yim', '$icq', '$location', '$sig', '$site', '$time_format', '$time_zone', '$im_notice', '$style', '$default_lang')";
$db->query();
$db->close();
//send out email to remind user they created an account.
@mail($email, $register_subject, $register_message, "From: $title<$board_email>");
echo $reg['acctmade'];
break;
default:
if (($stat == "Admin") OR ($stat == "Member") OR ($stat == "Moderator")){
$error = $reg['alreadyreg'];
echo error($error, "error");
}
if($tos == "On"){
$tos_part = "