Пример #1
0
<body>
<div id="divQuizResults">
<h1><a href="/"><span class="fir">The Public Whip</span></a></h1>
<h2>How They Voted 2005</h2>
<h3>(...and so how you should)</h3>
<h4>Quick Election Quiz</h4>

<?php 
    $error = "";
    if (!$_POST['friendsemail'] || !$_POST['yourname'] || !$_POST['youremail']) {
        $error .= "Please enter all details. ";
    } else {
        if (!pw_validate_email($_POST['friendsemail'])) {
            $error .= "Enter a valid email address for your friend. ";
        }
        if (!pw_validate_email($_POST['youremail'])) {
            $error .= "Enter a valid email address for yourself. ";
        }
    }
    if ($error) {
        print "<p class=\"error\">\n                Form not complete, please correct and try again.  \n                {$error}\n                </p>";
        print_friends_form("a");
    } else {
        $message = <<<END
Your friend {$_POST['yourname']} <{$_POST['youremail']}> saw this
'how to vote' website and thought of you.

http://www.publicwhip.org.uk/election.php

The site asks your opinion on key issues (such as the Iraq war,
Hunting and Foundation Hospitals).  Then it compares your opinion
Пример #2
0
</form>
<?php 
        }
    }
    pw_footer();
    exit;
}
if (user_isloggedin()) {
    header("Location: /account/settings.php\n");
    exit;
}
$title = "Subscribe to Newsletter";
$ok = false;
if ($submit) {
    $token = auth_random_token();
    if (!pw_validate_email($email)) {
        $feedback = 'Please enter a valid email address';
    } else {
        $db->query("DELETE FROM pw_dyn_newsletter WHERE email='{$email}'");
        $query = "INSERT INTO pw_dyn_newsletter\n                    (email, token, confirm, subscribed) VALUES ('{$email}', '{$token}', 0, now())";
        $db->query($query);
        $message = "Follow this link to confirm your subscription: " . "\n\nhttp://www.publicwhip.org.uk/N/" . urlencode($token) . "\n\nYou will then receive the Public Whip newsletter," . "\nwhich is at most monthly.";
        mail($email, 'Confirm your subscripton to the Public Whip newsletter', $message, 'From: Public Whip <*****@*****.**>');
        $ok = true;
        $title = "Now check your email!";
        $feedback = 'Please click on the link in the email
        we have just sent you to complete your subscription.';
    }
}
$onload = "givefocus('email')";
pw_header();