<?php require_once('includes/requirepost.inc.php'); require_once('includes/mailcertify.inc.php'); if ($_SESSION['uniwits.inputcache.domain']!='member') { purge_array_by_key_prefix($_SESSION,"uniwits.inputcache."); header("Location: ./"); } $micache=$_SESSION['uniwits.inputcache.data']; $mbinfo=$micache; unset($mbinfo['passwd']); $mbinfo['mb_pswdhash']=password_hash($micache['passwd']); $mbinfo['mb_timestamp']=db_date(); $mbinfo['mb_status']='VALID'; if (!$mbinfo['mb_timezone_minutes']) $mbinfo['mb_timezone_minutes']=get_user_time_zone(); if ($_SESSION['uniwits.inputcache.okas']=='new') { $DBConn->connect(); $DBConn->begin(true); $mb_id=false; $certifyemailsent=false; try { $mb_id=db_insert_login($DBConn,$mbinfo); db_set_member($DBConn,$mb_id,$mbinfo); db_set_member_info($DBConn,$mb_id,$mbinfo); db_set_member_emails($DBConn,$mb_id,$mbinfo['EMAIL']); db_set_member_phones($DBConn,$mb_id,$mbinfo['PHONE']); foreach ($mbinfo['EMAIL'] as $em) { mailcertify_send_request_email($DBConn,$mb_id,$mbinfo['mb_nickname'],$em); $certifyemailsent=true; } member_login($DBConn,$micache['mb_login'],$micache['passwd']); } catch (DBException $e) { $DBConn->rollback(); if (db_count_login($DBConn,$mbinfo['mb_login'])) { $_SESSION['uniwits.inputcache.errorareas']=array('ERROR-LOGIN-EXISTS'=>array(0)); header("Location: ./register?op=revise"); } else { echo $e->getMessage(); throw $e; } } $DBConn->commit(); if ($mb_id) { purge_array_by_key_prefix($_SESSION,"uniwits.inputcache."); if ($certifyemailsent) header("Location: ./register.success?op=cert.sent"); else header("Location: ./register.success"); if ($Config->EnableLog) { $LogDBConn->connect(false); db_insert_log($LogDBConn,'register.member',$mb_id); } } } else { purge_array_by_key_prefix($_SESSION,"uniwits.inputcache."); header("Location: ./"); } ?>