/** * Now that we have an Access Token, we can discard the Request Token */ $_SESSION['TWITTER_REQUEST_TOKEN'] = null; /** * Record the Access Token if necessary and return to the appropriate page */ if (isset($_SESSION['TWITTER_ENTRY'])) { if ($_SESSION['TWITTER_ENTRY'] == 'user_login.php') { $iduser = $do_twitter->getOfuzUserID($tw_user_id); if ($iduser) { $do_user = new User(); $do_user->iduser = $iduser; $do_user->setSessionVariable(); $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit('Twitter'); header('Location: index.php'); exit; } else { $config = $do_twitter->getTwitterConfig(); $ofuz_twitter = new Ofuz_Service_Twitter($tw_user_id, $config, $token); $userdetail = $ofuz_twitter->userShow($tw_user_id); list($firstname, $lastname) = split(' ', $userdetail->name); $_SESSION['TWITTER_REGISTER'] = array('tw_user_id' => $tw_user_id, 'tw_screen_name' => $tw_screen_name, 'tw_token' => $tw_token, 'firstname' => $firstname, 'lastname' => $lastname); header('Location: tw_user_register.php'); exit; } header('Location: user_login.php'); } else { if ($_SESSION['TWITTER_ENTRY'] == 'settings_twitter.php') { $do_twitter->setAccessToken($tw_user_id, $tw_screen_name, $tw_token);
/** * event function to signout * @param object $evctl */ public function eventLogout(EventControler $evctl) { //do login audit $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit("Logout"); $this->setFree(); $this->free(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 42000, '/'); } // Finally, destroy the session. session_destroy(); $dis = new Display(NavigationControl::getNavigationLink("User", "login")); $evctl->setDisplayNext($dis); }
<?php /**COPYRIGHTS**/ // Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com /**COPYRIGHTS**/ /** * user auto signin * use session variable set during the payment process * to automatically sign in the new user. */ include "config.php"; if ($_SESSION['autologin_userid'] > 5 && $_SESSION['autologin_paid']) { $do_User = new User(); $do_User->getId($_SESSION['autologin_userid']); $do_User->setSessionVariable(); $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit(); $do_contact = $do_User->getChildContact(); if ($do_contact->getNumRows() > 1) { header("Location: /"); } else { header("Location: /import_contacts.php"); } } else { header("Location: /user_login.php"); }
function eventAutoSignIn(EventControler $eventControler) { if ($eventControler->doSave == "yes") { $this->setLog("\n (User) Registration Sign on " . date("Y/m/d H:i:s")); $fields = $eventControler->fields; $auth_username = $fields[$this->getUsernameField()]; $auth_password = $fields[$this->getPasswordField()]; $goto = $eventControler->goto; if (strlen($auth_username) > 0 && strlen($auth_password) > 0) { $this->setLog("\n(" . $this->getObjectName() . ") table:" . $this->getTable()); $this->query("select * from `" . $this->getTable() . "` \n where `" . $this->getUsernameField() . "`='" . $this->quote($auth_username) . "' \n and `" . $this->getPasswordField() . "`='" . $this->quote($auth_password) . "'"); $this->setLog("\n(User) Query executed for sign on:" . $this->sql_query); if ($this->getNumrows() == 1) { $userdata = array(); $userdata['id'] = $this->iduser; $userdata['firstname'] = $this->firstname; $userdata['lastname'] = $this->lastname; $userdata['email'] = $this->email; $userdata['username'] = $this->{$this->getUsernameField()}; if ($this->isadmin) { $userdata['isadmin'] = 1; } $userdata['user_table'] = $user_table; $_SESSION['userdata'] = $userdata; if (!$this->isPersistent()) { $this->sessionPersistent("do_" . $this->getObjectName(), "signout.php", 36000); } } $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit(); $eventControler->setUrlNext($eventControler->goto); } } }
/** * Event method to set the Identification after Twitter login and user details * verification * @param $evtcl -- Object */ function eventCheckIdentificationOnTwLogin(EventControler $evtcl) { setcookie('ofuz', '1', time() + 25920000); if ($evtcl->tw_user_id && $evtcl->tw_user_id != '' && $evtcl->tw_screen_name && $evtcl->tw_screen_name != '' && $evtcl->tw_token && $evtcl->tw_token != '') { if (strlen($evtcl->password_field) > 0) { $password_field = $evtcl->password_field; $this->setPasswordField($evtcl->password_field); } else { $password_field = $this->getPasswordField(); } if (strlen($evtcl->username_field) > 0) { $username_field = $evtcl->username_field; $this->setUsernameField($evtcl->username_field); } else { $username_field = $this->getUsernameField(); } $fields = $evtcl->fields; $auth_username = $fields[$username_field]; $auth_password = $fields[$password_field]; // Changes made to encrypt the password before looking in the DB $do_user_rel = new UserRelations(); $auth_password = $do_user_rel->encrypt($auth_password); $this->query("select * from `" . $this->table . "` \n where `username`='" . $this->quote($auth_username) . "' \n and `password`='" . $this->quote($auth_password) . "'"); if ($this->getNumrows() == 1) { if ($this->status == 'active') { $this->query("INSERT INTO twitter_account (iduser, tw_user_id, tw_screen_name, tw_token) VALUES (" . $this->iduser . ",'" . $evtcl->tw_user_id . "','" . $evtcl->tw_screen_name . "','" . $evtcl->tw_token . "')"); $this->setSessionVariable(); $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit('Twitter'); $evtcl->setUrlNext($evtcl->goto); } else { $err_disp = new Display($evtcl->errPage); $msg = _("Your account is not currently active, contact our tech support at " . $GLOBALS['cfg_ofuz_email_support']); $_SESSION['crdmsg'] = $msg; $err_disp->addParam("message", $msg); $eventControler->setDisplayNext($err_disp); } } else { $err_disp = new Display($evtcl->errPage); $msg = "Sorry! But there is no user found with the supplied details."; $err_disp->addParam("message", $msg); $evtcl->setDisplayNext($err_disp); } } else { $err_disp = new Display($evtcl->errPage); $msg = "Sorry! But seems like you are not connected to Twitter. Please connect first."; $err_disp->addParam("message", $msg); $evtcl->setDisplayNext($err_disp); } }