2 /* This program is free software. It comes without any warranty, to
3 * the extent permitted by applicable law. You can redistribute it
4 * and/or modify it under the terms of the Do What The Fuck You Want
5 * To Public License, Version 2, as published by Sam Hocevar. See
6 * http://sam.zoy.org/wtfpl/COPYING for more details. */
10 global $db,$error,$node_id;
11 $login=addslashes($_POST['login']);
12 $password=$_POST['password'];
16 $error='asi nemas zapnute cookies alebo co';
20 $q="select * from users where login='$login'";
24 require(SYSTEM_ROOT.'/inc/ldap.inc');
25 $user_id=$set->getString('user_id');
26 $ldap_response=LDAPuser::auth($user_id,$password);
27 if ($set->getString('password')!=$hash and !$ldap_response) {
28 $error="Zadal si nespravne uzivatelske meno alebo heslo. Rob so sebou nieco";
29 log::log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login);
33 elseif ($set->getString('user_status')=='waiting') {
34 $error='Tvoja registracia este nebola schvalena.';
40 $user_id=$set->getString('user_id');
41 $cube_vector=$set->getString('cube_vector');
43 // saves friends list as an array into user session
45 $q="select distinct node_parent,node_name from nodes where node_creator='$user_id' and external_link='session://friend' order by node_parent";
46 $friendset=$db->query($q);
47 while ($friendset->next()){
48 $_SESSION['friends'][$friendset->getString('node_parent')]=true;
52 $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";
53 $bookmarkset=$db->query($q);
54 while ($bookmarkset->next()){
55 $_SESSION['bookmarks'][$bookmarkset->getString('node_id')]=$bookmarkset->getString('node_name');
58 //saves ignored users as an array into user session
59 $q="select node_parent,node_name from nodes where node_creator='$user_id' and external_link='session://ignore'";
60 $ignoreset=$db->query($q);
61 while ($ignoreset->next()){
62 $_SESSION['ignore'][$ignoreset->getString('node_parent')]=true;
66 LDAPuser::replicate($login,$user_id,$password);
68 $_SESSION['user_id']=$user_id;
69 $_SESSION['user_name']=$login;
70 if (!empty($cube_vector)) $_SESSION['cube_vector']=$cube_vector;
71 if (empty($_SESSION['template_set'])) $_SESSION['template_set']=$set->getString('template_set');
72 if (is_numeric($_POST['screen_width'])) $_SESSION['browser']['screen_width']=$_POST['screen_width'];
73 if (is_numeric($_POST['screen_height'])) $_SESSION['browser']['screen_height']=$_POST['screen_height'];
74 $_SESSION['listing_amount']=$set->getString('listing_amount');
75 $_SESSION['listing_order']=$set->getString('listing_order');
76 $_SESSION['header_id']=$set->getString('header_id');
77 log::log('login',$node_id,'ok',$login);