4 global $db,$error,$node_id;
5 $login=addslashes($_POST['login']);
6 $password=$_POST['password'];
8 $login_type=$_POST['login_type'];
11 $error='asi nemas zapnute cookies alebo co';
15 switch ($login_type) {
17 $q="select * from users where login='$login'";
20 require(INCLUDE_DIR.'ldap.inc');
21 $user_id=$set->getString('user_id');
25 $q="select * from users where user_id='$login'";
28 require(INCLUDE_DIR.'ldap.inc');
30 $user_name=$set->getString('user_name');
34 $ldap_response=LDAPuser::auth($user_id,$password);
35 if ($set->getString('password')!=$hash and !$ldap_response) {
36 $error="Zadal si nespravne uzivatelske meno alebo heslo. Rob so sebou nieco";
37 $log->log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login);
41 elseif ($set->getString('user_status')=='waiting') {
42 $error='Tvoja registracia este nebola schvalena.';
47 $user_id=$set->getString('user_id');
48 $cube_vector=$set->getString('cube_vector');
50 // saves friends list as an array into user session
51 $q="select distinct node_parent,node_name from nodes where node_creator='$user_id' and external_link='session://friend' order by node_parent";
52 $friendset=$db->query($q);
54 while ($friendset->next()){
55 $_SESSION['friends'][$friendset->getString('node_parent')]=true;
58 $q="select nodes.node_name,nodes.node_id from node_access left join nodes on node_access.node_id=nodes.node_id where node_access.user_id='$user_id' and node_bookmark='yes' order by node_name";
59 $bookmarkset=$db->query($q);
61 while ($bookmarkset->next()){
62 $_SESSION['bookmarks'][$bookmarkset->getString('node_id')]=$bookmarkset->getString('node_name');
65 //saves ignored users as an array into user session
66 $q="select node_parent,node_name from nodes where node_creator='$user_id' and external_link='session://ignore'";
67 $ignoreset=$db->query($q);
69 while ($ignoreset->next()){
70 $_SESSION['ignore'][$ignoreset->getString('node_parent')]=true;
73 LDAPuser::replicate($user_name,$user_id,$password);
75 $_SESSION['user_id']=$user_id;
77 $_SESSION['user_name']=$user_name;
78 if (!empty($cube_vector)) $_SESSION['cube_vector']=$cube_vector;
79 if (empty($_SESSION['template_set'])) $_SESSION['template_set']=$set->getString('template_set');
80 if (is_numeric($_POST['screen_width'])) $_SESSION['browser']['screen_width']=$_POST['screen_width'];
81 if (is_numeric($_POST['screen_height'])) $_SESSION['browser']['screen_height']=$_POST['screen_height'];
82 $_SESSION['listing_amount']=$set->getString('listing_amount');
84 $_SESSION['listing_order']=$set->getString('listing_order');
85 $_SESSION['header_id']=$set->getString('header_id');
86 $log->log('login',$node_id,'ok',$user_name);