Example #1
0
        $alert = '<p class="error-message"><strong>There was a problem signing in.</strong><br>
		It appears that you do not have cookies enabled.  You must enable cookies
		in order to use this site.</p>';
    } else {
        $alert = '<p class="error-message"><strong>There was a problem signing in.</strong><br>
		Please check your username and password again. If you do not know your
		password, contact your teacher or school administrator.</p>';
    }
}
if (isset($_REQUEST['signout'])) {
    $alert = '
	<p class="alert-message"><strong>Sign-out successful</strong><br>
	You may sign in again below</p>
	';
}
mystery_cookie('cookietest', 'yes');
// display the sign-in and registration links
echo '
<table width="95%">
<tr>
<td valign="top" width="50%">

<div class="left-column-container">
<div class="left-column-content">

	<h2>Already Signed Up?</h2>
	
	' . $alert . '
	
	<form action="/signin/process/" method="post">
	
Example #2
0
<?php

if (isset($_GET['lang'])) {
    $expire_seconds = 365 * 24 * 3600;
    mystery_cookie('lang', $_GET['lang'], $expire_seconds);
    $_COOKIE['lang'] = $_GET['lang'];
}
if (isset($_COOKIE['lang'])) {
    $portal_config['default_language'] = $_COOKIE['lang'];
}
// FIXME... add options here to parse the language file based on the default/selected language
Example #3
0
<?php

// now get rid of the session
session_destroy();
mystery_setup_default_session();
session_regenerate_id();
// get rid of any diy session
mystery_cookie($portal_config['diy_session_name'], '');
mystery_redirect('/signin/?signout');
function portal_setup_diy_session($username = '', $password = '')
{
    // This function will send the user's email and password to the diy site and setup a session cookie for them
    global $portal_config;
    $path = '/session';
    $data = array();
    if ($username == '') {
        $username = @$_SESSION['portal']['member_username'];
    }
    if ($password == '') {
        $password = strtolower(@$_SESSION['portal']['member_password_ue']);
    }
    $data['login'] = $username;
    $data['password'] = $password;
    $data['commit'] = 'Log in';
    //trigger_error('POST DATA: ' . var_export($data, true));
    list($headers, $content) = portal_post_to_diy($data, $path);
    //trigger_error('HEADERS: ' . var_export($headers, true));
    //trigger_error('CONTENT: ' . var_export($content, true));
    preg_match('~' . $portal_config['diy_session_name'] . '=([^;]+);~', $headers, $matches);
    $diy_session_id = $matches[1];
    mystery_cookie($portal_config['diy_session_name'], $diy_session_id);
}