// If the user is already logged in, send them to the Activity Hub
if ($user_is_logged_in) {
    metarefresh(0, "{$code_url}/activity_hub.php");
}
// login.php loads this page with an error_code parameter to indicate what
// went wrong. Here we change this into a user-visible string.
$login_failures = array('no_username' => _("You did not supply a username."), 'no_password' => _("You did not supply a password."), 'auth_failure' => _("Unable to authenticate. The username/password may be incorrect or your account may be locked."), 'reg_mismatch' => sprintf(_("You are registered with the forum software, but not with %s."), $site_abbreviation));
$error = @$login_failures[@$_GET['error_code']];
if (!$error) {
    $error = _("An undefined error occurred while attempting to log you in.");
}
$title = _("Login Failed");
output_header($title);
echo "<br>\n";
echo "<b>{$error}</b>\n";
echo "<p>" . _("Please attempt again to log in above. If problems persist, review the following possible fixes:") . "</p>";
echo "<ol>";
if ($testing) {
    echo "<li>" . _("Register! (Note that this is a test site, and has a separate database from the production site, so you need to register separately.)") . "</li>\n";
}
echo "<li>" . _("Type your username in the exact same way as when you registered.") . "</li>\n";
echo "<li>" . sprintf(_("<a href='%s'>Reset</a> your password."), get_reset_password_url()) . "</li>\n";
echo "<li>" . _("Enable Javascript.") . "</li>\n";
echo "<li>" . sprintf(_("Accept cookies (at least from us at %s)."), $_SERVER["HTTP_HOST"]) . "</li>\n";
echo "<li>" . sprintf(_("Allow popup windows (at least from us at %s)."), $_SERVER["HTTP_HOST"]) . "</li>\n";
echo "<li>" . _("Caching set to off (or: refresh page every visit).") . "</li>\n";
echo "<li>" . _("Ensure your PC clock is set to the correct date &amp; time.") . "</li>\n";
echo "</ol>";
echo "<p>" . sprintf(_("If all of this fails, contact the <a href='%s'>site manager</a>."), "mailto:{$site_manager_email_addr}") . "</p>";
echo "<p>" . sprintf(_("Note: If you have just registered, you will need to wait for the welcome mail to arrive to your mailbox. Once it does, please click the activation link to complete the registration (this is to prevent others from signing you up to the site without your knowledge). If you have waited for an hour or so and have still not received any mail from us (please check any spam filters!), it is likely that you misentered your email-address. Please contact the <a href='%s'>site manager</a> to solve the problem."), "mailto:{$site_manager_email_addr}") . "</p>";
// vim: sw=4 ts=4 expandtab
Example #2
0
function echo_general_tab()
{
    global $uid, $pguser, $userP;
    global $u_n;
    $options = get_locale_translation_selection_options();
    $u_intlang_options[""] = BROWSER_DEFAULT_STR;
    $u_intlang_options = array_merge($u_intlang_options, $options);
    $i_stats_privacy = array(PRIVACY_PUBLIC => _("Public"), PRIVACY_ANONYMOUS => _("Anonymous"), PRIVACY_PRIVATE => _("Private"));
    $user = new User($pguser);
    echo "<tr>\n";
    show_preference(_('Name'), 'real_name', 'name', $user->real_name, 'textfield', array('20', ''));
    show_blank();
    echo "</tr>\n";
    // Check for DP/forum email mismatch, warn user if not the same
    $bb_user_info = get_forum_user_details($pguser);
    $email_warning = '';
    if ($bb_user_info["email"] != $user->email) {
        $edit_url = get_url_to_edit_profile();
        $email_warning = "<p><b>" . sprintf(_("Warning: The email in your <a href='%s'>forum profile</a> is different."), $edit_url) . "</b><br>";
        $email_warning .= _("Please update if necessary to ensure you receive messages as intended.") . "</p>\n";
    }
    echo "<tr>\n";
    show_preference(_('E-mail'), 'email', 'email', $user->email, 'textfield', array('26', $email_warning));
    show_preference(_('Interface Language'), 'u_intlang', 'intlang', $userP['u_intlang'], 'dropdown', $u_intlang_options);
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('E-mail Updates'), 'email_updates', 'updates', $userP['email_updates'], 'radio_group', array(1 => _("Yes"), 0 => _("No")));
    $theme_options = array();
    $result = mysql_query("SELECT * FROM themes");
    while ($row = mysql_fetch_array($result)) {
        $option_value = $row['unixname'];
        $option_label = $row['name'];
        $theme_options[$option_value] = $option_label;
    }
    show_preference(_('Theme'), 'i_theme', 'theme', $userP['i_theme'], 'dropdown', $theme_options);
    echo "</tr>\n";
    echo "<tr>\n";
    show_link_as_if_preference(_('Password'), 'password', get_reset_password_url(), _("Reset Password"));
    show_preference(_('Statistics Bar Alignment'), 'u_align', 'align', $userP['u_align'], 'radio_group', array(1 => _("Left"), 0 => _("Right")));
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Statistics'), 'u_privacy', 'privacy', $userP['u_privacy'], 'dropdown', $i_stats_privacy);
    show_preference(_('Show Rank Neighbors'), 'u_neigh', 'neighbors', $userP['u_neigh'], 'dropdown', $u_n);
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Credits Wanted'), NULL, 'creditswanted', NULL, 'credits_wanted_adhoc', NULL);
    show_blank();
    echo "</tr>\n";
    echo "<tr>\n";
    show_preference(_('Credit Name'), NULL, 'creditname', NULL, 'credit_name_adhoc', NULL);
    show_blank();
    echo "</tr>\n";
    echo_bottom_button_row();
}
<?php

$relPath = "./../pinc/";
include_once $relPath . 'base.inc';
include_once $relPath . 'maybe_mail.inc';
include_once $relPath . 'misc.inc';
include_once $relPath . 'forum_interface.inc';
// check that caller is localhost or bail
if (!requester_is_localhost()) {
    die("You are not authorized to perform this request.");
}
$old_date = time() - 13176000;
// 30 days less than 1/2 a year.
$reset_password_url = get_reset_password_url();
$result = mysql_query("SELECT * FROM `users` WHERE t_last_activity < {$old_date} AND active ='yes'");
$numrows = mysql_num_rows($result);
$rownum = 0;
while ($rownum < $numrows) {
    $username = mysql_result($result, $rownum, "username");
    $real_name = mysql_result($result, $rownum, "real_name");
    $email = mysql_result($result, $rownum, "email");
    $email_updates = mysql_result($result, $rownum, "email_updates");
    if ($email_updates) {
        maybe_mail("{$email}", "{$site_name}: Inactive Account {$username}", "Hello {$real_name},\n\n" . "This is an automated message and your only e-mail reminder that your account on the\n {$site_name} site ({$code_url}/) has been inactive\nfor over 5 months now. In order to show a valid number of active members for our\nsite, we will be marking this account as inactive a month from today if you do not\nlog into the site.\n\n\nIf you wish to receive no more mailings from us, you need to do nothing else and\nthis account will be marked as inactive. If you have forgotten your password,\nvisit ({$reset_password_url}) to have\nit reset. We hope you care to join us, much has changed since you last saw us.\n\n\n{$site_signoff}");
    }
    $rownum++;
}
if ($numrows) {
    echo "notify_users.php attempted to email {$numrows} users with a 5 month inactivity warning";
}