<?php
|
|
/**
|
|
* @package uForum
|
|
* @file register.php
|
|
* @version $Id$
|
|
* @copyright 2009(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/
|
|
* @license GNU GPL v3
|
|
**/
|
|
define('IN_uF', true);
|
|
//include files
|
|
include('./config.php');
|
|
include('./includes/constants.php');
|
|
include('./includes/db.php');
|
|
include('./includes/errors.php');
|
|
//connect to database
|
|
DataBase::db_connect();
|
|
include('./includes/sessions.php');
|
|
include('./includes/classes/class_user.php');
|
|
include('./common.php');
|
|
include('./includes/misc_functions.php');
|
|
include('./includes/classes/class_forum.php');
|
|
include('./includes/classes/class_posting.php');
|
|
include('./includes/classes/class_topic.php');
|
|
include('./includes/emailer.php');
|
|
include('./includes/classes/class_mod.php');
|
|
include('./includes/classes/secure.php');
|
|
$default_lang = DefaultLang();
|
|
include('./lngs/'.$default_lang.'/main.php');
|
|
include('./lngs/'.$default_lang.'/email.php');
|
|
$start = TimeGeneration();
|
|
SessDelInvalid();
|
|
SessRegister();
|
|
SessDeleteOld();
|
|
$default_skin = ViewSkinName();
|
|
$msg='';
|
|
if ($_SESSION['uid']>0)
|
|
{
|
|
message_forum($lng['youareexist'],'index.php');
|
|
}
|
|
foreach ($_POST as $name => $value)
|
|
{
|
|
if ($forum_config['use_censorlist'])
|
|
{
|
|
$_POST[$name] = Secure::UseCensorlist($value);
|
|
}
|
|
}
|
|
if (isset($_POST['email']))
|
|
{
|
|
if ( ereg ("^.+@.+\..+$", $_POST['email']))
|
|
{ $nick = $_POST['nick'];
|
|
if ($nick!='')
|
|
{
|
|
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information.');
|
|
$result = DataBase::fetch($query);
|
|
$result = $result['nick'];
|
|
if ($result!=$nick)
|
|
{
|
|
if ($_POST['password']!='')
|
|
{
|
|
if ($_POST['password']==$_POST['confirmpassword'])
|
|
{
|
|
if ($_POST['valid_match']==$_POST['valid_key'])
|
|
{
|
|
$_POST['nick']= addslashes(strip_tags($_POST['nick']));
|
|
$original_pass = $_POST['password'];
|
|
$_POST['password']=md5($_POST['password']);
|
|
User::CreateProfile($_POST['nick'],$_POST['password'], $_POST['email'],0,1,0,1,'','','');
|
|
$stop = TimeGeneration();
|
|
if ($forum_config['allow_send_email'])
|
|
{
|
|
SendRegisterEmail();
|
|
}
|
|
message_forum($lng['account_created'],'index.php');
|
|
}
|
|
else
|
|
{
|
|
$message = $lng['key_not_valid'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message=$lng['incorrect_password2'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message=$lng['empty_password'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message=$lng['user_is_exist'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message=$lng['empty_email'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$message=$lng['invalid_email'];
|
|
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$_POST['nick']='';
|
|
$_POST['email']='';
|
|
$_POST['interests']='';
|
|
$_POST['sig']='';
|
|
$_POST['avatar']='';
|
|
}
|
|
$match_array = Secure::generate_code();
|
|
//add skin variables
|
|
$skin = array(
|
|
//labels profile
|
|
'lnick' => $lng['user_name'],
|
|
'lpass' => $lng['lpassw'],
|
|
'lnewpass' => $lng['new_password'],
|
|
'lcpass' => $lng['confirm_password'],
|
|
'lemail' => 'E-mail',
|
|
'lgg' => $lng['gg_number'],
|
|
'lallow_gg' => $lng['allow_gg'],
|
|
'lallow_email' => $lng['allow_email'],
|
|
'lallow_qr' => $lng['allow_qr'],
|
|
'linterests' => $lng['luinterests'],
|
|
'lsig' => $lng['sig'],
|
|
'lavaddr' => $lng['picture_adress'],
|
|
'lmatch'=> $match_array[0].' + '.$match_array[1].' = ',
|
|
'valid_key' => $match_array[2],
|
|
'lovpr' => $lng['general_settings'],
|
|
'lupr' => $lng['profile_settings'],
|
|
'lspr' => $lng['signature_settings'],
|
|
'lapr' => $lng['avatar_settings'],
|
|
'lsubmit' => $lng['save'],
|
|
'lreset' => $lng['reset'],
|
|
'no' => $lng['no'],
|
|
'yes' => $lng['yes'],
|
|
'pa_link'=>''
|
|
);
|
|
$_POST['allow_gg']='1';
|
|
$skin = array_push_assoc($skin, GenerateHeader($lng['lregister'],'</a>> <a href="register.php" class="navigator">'.$lng['lregister']));
|
|
if ($msg=='')
|
|
{
|
|
$msg = './skins/'.$default_skin.'/blank.tpl';
|
|
}
|
|
//do it!
|
|
include('./skins/'.$default_skin.'/overall_header.tpl');
|
|
include('./skins/'.$default_skin.'/register_body.tpl');
|
|
$stop = TimeGeneration();
|
|
$skin['queries'] = ShowQueries($start, $stop);
|
|
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
?>
|