Example #1
0
function person_signon($template_data, $email = null, $name = null, $person_if_signed_on_function = null)
{
    $P = person_already_signed_on($email, $name, $person_if_signed_on_function);
    if ($P) {
        return $P;
    }
    /* Get rid of any previous cookie -- if user is logging in again under a
     * different email, we don't want to remember the old one. */
    person_signoff();
    if (headers_sent()) {
        err("Headers have already been sent in person_signon without cookie being present");
    }
    if (array_key_exists('instantly_send_email', $template_data)) {
        $send_email_part = "&SendEmail=1";
        unset($template_data['instantly_send_email']);
    } else {
        $send_email_part = '';
    }
    /* No or invalid cookie. We will need to redirect the user via another
     * page, either to log in or to prove their email address. */
    $st = stash_request(rabx_serialise($template_data), $email);
    db_commit();
    if ($email) {
        $email_part = "&email=" . urlencode($email);
    } else {
        $email_part = "";
    }
    if ($name) {
        $name_part = "&name=" . urlencode($name);
    } else {
        $name_part = "";
    }
    header("Location: /login?stash={$st}{$send_email_part}{$email_part}{$name_part}");
    exit;
}
Example #2
0
<?php

/*
 * logout.php:
 * Log user out.
 * 
 * Copyright (c) 2005 UK Citizens Online Democracy. All rights reserved.
 * Email: chris@mysociety.org; WWW: http://www.mysociety.org/
 *
 * $Id: logout.php,v 1.1 2005/07/15 23:20:52 matthew Exp $
 * 
 */
require_once '../phplib/page.php';
require_once '../../phplib/person.php';
if (person_if_signed_on(true)) {
    person_signoff();
    header("Location: /logout");
    exit;
}
page_header(_('Logged out'));
?>
<div class="main">
  <div class="head"></div>
  <div class="body">
    <p>You are now logged out.</p>
    <p>Thanks for using the site!</p>

    <a href="/">Home page</a>
  </div>
  <div class="foot"></div>
</div> <!-- end main -->