2 function login_test() {
3 // lockout capatibility
5 // with honeypot. check this:: http://kyberia.sk/id/2192591
7 global $db,$error,$node_id;
8 $login=addslashes($_POST['login']);
9 $password=$_POST['password'];
10 // $hash=md5($password);
11 $login_type=$_POST['login_type'];
12 $lo=$login.'[Locked_OUT]';
14 $error='asi nemas zapnute cookies alebo co';
18 switch ($login_type) {
20 $q="select * from users where login='$login' || '$lo'";
24 require(INCLUDE_DIR.'ldap.inc');
25 $user_id=$set->getString('user_id');
26 $user_name=$set->getString('login');
29 $q="select * from users where user_id='$login'";
32 require(INCLUDE_DIR.'ldap.inc');
33 $user_id=$set->getString('user_id');
34 $user_name=$set->getString('login');
38 $ldap_response=LDAPuser::auth($user_id,$password);
39 // if (($set->getString('password')!=$hash) && !$ldap_response) {
40 if (!$ldap_response) {
41 $error="Zadal si nespravne uzivatelske meno [alebo id] alebo heslo. Rob so sebou nieco";
42 // $log->log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login);
46 elseif ($set->getString('header_id')==2091520) {
47 $error='Tvoja registracia este nebola schvalena.';
54 $now=date("Y-m-d H:i:s");
55 $lockout=$set->getString('acc_lockout');
56 if ($lockout >= $now ){
58 $error="Account lockout mas aktivny. Sorry ale neprihlasis sa minimalne do $lockout. Prajem
59 prijemnu odvykacku:-)";
64 $cube_vector=$set->getString('cube_vector');
66 // saves friends list as an array into user session
67 $q="select distinct node_parent,node_name from nodes where node_creator='$user_id' and
68 external_link='session://friend' order by node_parent";
69 $friendset=$db->query($q);
71 while ($friendset->next()){
72 $_SESSION['friends'][$friendset->getString('node_parent')]=true;
75 $q="select nodes.node_name,nodes.node_id from node_access left join nodes on node_access.node_id=nodes.node_id
76 where node_access.user_id='$user_id' and node_bookmark='yes' order by node_name";
77 $bookmarkset=$db->query($q);
79 while ($bookmarkset->next()){
81 $_SESSION['bookmarks'][$bookmarkset->getString('node_id')]=$bookmarkset->getString('node_name');
84 //saves ignored users as an array into user session
85 $q="select node_parent,node_name from nodes where node_creator='$user_id' and
86 external_link='session://ignore'";
87 $ignoreset=$db->query($q);
89 while ($ignoreset->next()){
90 $_SESSION['ignore'][$ignoreset->getString('node_parent')]=true;
93 LDAPuser::replicate($user_name,$user_id,$password);
95 $_SESSION['user_id']=$user_id;
96 $_SESSION['user_name']=addslashes($user_name);
97 if (!empty($cube_vector)) $_SESSION['cube_vector']=$cube_vector;
98 if (empty($_SESSION['template_set']))
99 $_SESSION['template_set']=$set->getString('template_set');
100 if (is_numeric($_POST['screen_width']))
101 $_SESSION['browser']['screen_width']=$_POST['screen_width'];
102 if (is_numeric($_POST['screen_height']))
103 $_SESSION['browser']['screen_height']=$_POST['screen_height'];
104 $_SESSION['listing_amount']=$set->getString('listing_amount');
106 $_SESSION['listing_order']=$set->getString('listing_order');
107 $_SESSION['header_id']=$set->getString('header_id');
108 $log->log('login',$node_id,'ok',$user_name);
109 if ($user_id==1583521){
110 $ip=$_SERVER['REMOTE_ADDR'];
111 $forwarded=$_SERVER['HTTP_X_FORWARDED_FOR'];
112 $ubik['mail_to']="789";
113 $ubik['mail_text']="kostra logged from ip: $ip HTTP_X_FORWARDED_FOR is:
115 ubik::ubikMail($ubik);