Esempio n. 1
0
require_once "class.Mailer.php";
$session = new Session();
if ($session->isLoggedIn()) {
    header("Location: ../index.php");
}
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$od = new OwnerDAO($db);
$s = new SmartyThinkTank();
$s->caching = false;
if ($_POST['Submit'] == 'Send') {
    if ($od->doesOwnerExist($_POST['email'])) {
        $newpwd = rand(10000, 99999);
        $server = $_SERVER['HTTP_HOST'];
        $cryptpass = $session->pwdcrypt($newpwd);
        $od->updatePassword($_POST['email'], $cryptpass);
        $es = new SmartyThinkTank();
        $es->caching = false;
        $es->assign('apptitle', $THINKTANK_CFG['app_title']);
        $es->assign('email', $_POST['email']);
        $es->assign('newpwd', $newpwd);
        $es->assign('server', $server);
        $es->assign('site_root_path', $THINKTANK_CFG['site_root_path']);
        $message = $es->fetch('_email.forgotpassword.tpl');
        Mailer::mail($_POST['email'], "The " . $THINKTANK_CFG['app_title'] . " Account Details You Requested", $message);
        $successmsg = "Password recovery information has been sent to your email address. <a href=\"login.php\">Sign in.</a>";
    } else {
        $errormsg = "Account does not exist";
    }
}
if (isset($errormsg)) {
Esempio n. 2
0
}
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$od = new OwnerDAO($db);
if ($_POST['changepass'] == 'Change Password') {
    $originalpass = $od->getPass($_SESSION['user']);
    $origpass = $originalpass['pwd'];
    if (!$session->pwdCheck($_POST['oldpass'], $origpass)) {
        $errormsg = "Old password does not match or empty.";
    } elseif ($_POST['pass1'] != $_POST['pass2']) {
        $errormsg = "New passwords did not match. Your password has not been changed.";
    } elseif (strlen($_POST['pass1']) < 5) {
        $errormsg = "New password must be at least 5 characters. Your password has not been changed.";
    } else {
        $cryptpass = $session->pwdcrypt($_POST['pass1']);
        $od->updatePassword($_SESSION['user'], $cryptpass);
        $successmsg = "Your password has been updated.";
    }
}
$id = new InstanceDAO($db);
$od = new OwnerDAO($db);
$cfg = new Config();
$s = new SmartyThinkTank();
$s->caching = 0;
$owner = $od->getByEmail($_SESSION['user']);
$owner_instances = $id->getByOwner($owner);
$to = new TwitterOAuth($cfg->oauth_consumer_key, $cfg->oauth_consumer_secret);
/* Request tokens from twitter */
$tok = $to->getRequestToken();
$token = $tok['oauth_token'];
$_SESSION['oauth_request_token_secret'] = $tok['oauth_token_secret'];