Re: Login modification

posts: 2

Or you can create a file and take advantage of tikis login for example here I pass the username and pw and page wanted as header when trying to connect to this one.  if page wanted is empty the redirect takes to home. I left out some parts, but there is the most that you need.  And of course you need to verify that the user who wants to login actually exists. if not make either redirect or call die()

This actually works. 


include_once ('lib\tikilib.php'); if(isset($__POST("username","pwd"){ try{ authenticate($userName, $pwd) //not explaining this part should be straight forward redirect(); }else redirect to login.php } //look how this is function authenticate($userName, $pwd){ //from tikiuserlib $userlib = tikilib::lib($libraryname); $challenge = isset($_REQUEST['challenge']) ? $_REQUEST['challenge'] : false; $ret = $userlib->validate_user_tiki($userName, $password, $challenge, false); if (count($ret) == 3) { //echo 'loop'; $ret[] = null; } list($isvalid, $requestedUser, $error, $method) = $ret; $user = $requestedUser; $userInfo = $userlib->get_user_info($user); //activate the user TikiLib::lib('login')->activateSession($user); $userId = TikiLib::lib(get_user_id($user)); $secret = $userlib->create_user_cookie($userId); setcookie($user_cookie_site, $secret . '.' . $userId, $tikilib->now + $prefs['remembertime'], $prefs['cookie_path'], $prefs['cookie_domain']) ; //if everything went fine do a redirect }