|
|
- <?php
- /**
- * @package uForum
- * @file register.php
- * @version $Id$
- * @copyright 2009(c) PioDer <pioder@wp.pl>
- * @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/class_db.php');
- include('./includes/class_error.php');
- //connect to database
- DataBase::db_connect();
- include('./includes/sessions.php');
- include('./includes/class_user.php');
- include('./common.php');
- include('./includes/class_overall.php');
- include('./includes/class_forum.php');
- include('./includes/class_posting.php');
- include('./includes/class_topic.php');
- include('./includes/class_email.php');
- include('./includes/class_mod.php');
- include('./includes/classes/secure.php');
- $default_lang = Over::DefaultLang();
- include('./lngs/'.$default_lang.'/main.php');
- include('./lngs/'.$default_lang.'/email.php');
- $start = Over::TimeGeneration();
- sess_del_invalid($_SESSION['uid']);
- sess_register($_SESSION['uid']);
- sess_delete_old();
- $default_skin = Over::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 = mysql_fetch_array($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 = Over::TimeGeneration();
- if ($forum_config['allow_send_email'])
- {
- 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_associative($skin, Over::generate_header($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 = Over::TimeGeneration();
- $skin['queries'] = Over::ShowQueries($start, $stop);
- include('./skins/'.$default_skin.'/overall_footer.tpl');
- ?>
|