get('uid_l')) { if ($sess->get('view_type') == "1") { header ("Location: main.php"); } else { header ("Location: calendar_view.php"); } } // get post data $inpLogin = strtolower($_POST['inpLogin']); $inpPass = $_POST['inpPass']; if ($wo_sess || $inpLogin || $inpPass) { // set attepts in cookies if ($_COOKIE["auth_attempt"]=="") { // show captcha anyway if user comes for the first time or have disabled cookies setcookie("auth_attempt",1,time()+600); $auth_attempt = "3"; } else{ $auth_attempt = $_COOKIE["auth_attempt"] + 1; settype($auth_attempt,"string"); // if it is not numeric let set it to some high value if (!ctype_digit($auth_attempt)) { $auth_attempt = "100"; } setcookie("auth_attempt",$auth_attempt,time()+600); } // on 3rd attempt - check captcha if ($auth_attempt >= "3") { $resp = recaptcha_check_answer(CAPTCHA_PRIVATE, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { unset($inpPass); unset($inpLogin); $html->system_message($wrong_data2[$lang]); } } } if ($_GET['act']==="logout") { if ($db->get_user_id(TOKEN) === true) { if($db->result->user_id) { $db->set_user_id($db->result->user_id); $db->set_logger("2","1",$rem_adre); } } $sess->finish(); header("Location: index.php"); exit; } else { if ($inpLogin!="" || $inpPass!="") { $ejabberd_rpc->set_user($inpLogin,$inpPass); if ($ejabberd_rpc->auth() === true) { $sess->set('login',$inpLogin); $sess->set('uid_l',$inpLogin); $sess->set('uid_p',$enc->crypt_url("single=$inpPass")); $sess->set('vhost',XMPP_HOST); // remember user choice setcookie("fav_host", XMPP_HOST,time()+2592000); setcookie("auth_attempt",0,time()+2592000); // Get user_id if it is possible if ($db->get_user_id($sess->get('uid_l')) === true) { $ui = $db->result->user_id; $db->set_user_id($ui); $db->is_log_enabled(); $ret_v = $db->result->is_enabled; } else { $ret_val = null; } if ($ret_v === true OR $ret_v === false) { $sess->set('log_status',$ret_v); $db->set_logger("1","1",$rem_adre); // get preferences, if not set, fallback to standard view. $db->get_jorge_pref(); $pref_res = $db->result; foreach ($pref_res as $res_pref) { if ($res_pref[pref_id]=="1") { if ($res_pref[pref_value] == "2") { $view_type = "2"; $tmp_v = "calendar_view.php"; } elseif($res_pref[pref_value] == "1") { $view_type = "1"; $tmp_v = "main.php"; } $sess->set('view_type',$view_type); } if ($res_pref[pref_id] == "2") { // Check if language is supported, return value if it is $check_language = is_language_supported($res_pref[pref_value],$language_support,1,true); // function can return true/false/value, in this case we need value and not false if ($check_language !== false) { // set language according to database setup setcookie("jorge_language",$check_language,time()+2592000); $sess->set('language',$check_language); } else{ // this is where language was not found in settings, so use default setcookie("jorge_language",$language_support[default_language][1],time()+2592000); $sess->set('language',$check_language); } } } if ($tmp_v=="") { $sess->set('view_type',2); $tmp_v="calendar_view.php"; } header("Location: $tmp_v"); exit; // lets break script at this point... } else { $sess->set('log_status',null); header("Location: not_enabled.php"); exit; } } if (no_vhost === true) { $html->system_message($vhost_not_selected[$lang]); } else{ $html->system_message($wrong_data[$lang]); } $db->get_user_id($inpLogin); $ui_fail = $db->result->user_id; // Workaround, if user_id is not know, do not alter login attempts if ($ui_fail) { $db->get_last_attempt($ui_fail); $row = $db->result->cnt; } else{ $row="0"; } // bump log_level if more then 3 log attempts in one minute if ($row > "3") { $log_level = "3"; } else { $log_level = "2"; } if ($ejabberd_rpc->check_account() === true) { $db->set_user_id($ui_fail); $db->set_logger("3",$log_level,$rem_adre); } } } $html->set_body(' '); $html->set_body('

Branding logo
'.$welcome_1[$lang].'


'); // display captcha on 3rd attempt... $check_cookie = $_COOKIE["auth_attempt"]; settype($check_cookie,"string"); if (!ctype_digit($check_cookie) OR $check_cookie=="") { $cookie_failed = true; } else{ $cookie_failed = false; } if ($check_cookie >= "2" OR $cookie_failed === true) { $html->set_body(''); } $html->set_body('
'.$login_w[$lang].'  '); // vhost support $vhost_count = count($vhosts); if ($vhost_count>1) { $html->set_body(''); } else{ // There is only one vhost configured, so do not display select box $html->set_body('@'.key($vhosts).''); } $html->set_body('
'.$passwd_w[$lang].' 
'.recaptcha_get_html(CAPTCHA_PUBLIC,$error = null, $use_ssl = true).'
'); require_once("footer.php"); ?>