示例#1
0
 if (strlen($username) > 16 or strlen($username) < 4) {
     $error = true;
     $username_errors[] = 'The username must be between 4 and 16 characters long.';
 }
 if (preg_match('/^[a-z0-9]+$/', $username) == 0) {
     $error = true;
     $username_errors[] = 'Username may only contain alphanumeric characters.';
 }
 # Process full name
 $fullname = $_POST['fullname'];
 # Process group
 $group = $_POST['group'];
 # Check for valid email
 $email = $_POST['email'];
 if ($email != '') {
     if (!rgds_is_email($email)) {
         $error = true;
         $email_errors[] = 'Email address is not valid.';
     }
 }
 # Check for valid passwords
 $password1 = $_POST['password1'];
 $password2 = $_POST['password2'];
 if ($password1 != '' and $password2 != '') {
     if (strcmp($password1, $password2) != 0) {
         $error = true;
         $password_errors[] = 'The passwords do not match.  Please retype them.';
     } elseif (strlen($password1) > 16 or strlen($password1) < 4) {
         $error = true;
         $password_errors[] = 'The password must be between 4 and 16 characters long.';
     }
示例#2
0
$smarty->assign('indiv', $o);
# populate keyword array
keyword_push(gtc("Comments"));
keyword_push($o->full_name());
# assign other smarty variables
$smarty->assign('page_title', sprintf(gtc("Comments for %s"), $o->full_name()));
$smarty->assign('surname_title', sprintf(gtc("%s Surname"), $o->sname));
$content_title = $o->prefix . ' ' . $o->full_name();
if ($o->suffix) {
    $content_title .= ', ' . $o->suffix;
}
$smarty->assign('content_title', $content_title);
# If the form has been posted then let's validate the form variables
if (!empty($_POST)) {
    if (empty($_POST['email'])) {
        $form_errors['email'] = gtc("YOU MUST ENTER AN EMAIL ADDRESS");
    } elseif (!rgds_is_email(trim($_POST['email']))) {
        $form_errors['email'] = gtc("THE EMAIL ADDRESS YOU ENTERED IS NOT VALID");
    }
    if (empty($_POST['comment'])) {
        $form_errors['comment'] = gtc("PLEASE ENTER SOME TEXT");
    }
    $smarty->assign('form_errors', $form_errors);
    # The form validated ok, so now save the data
    if (!$form_errors) {
        insert_comment($g_indiv, $_POST['email'], $_POST['comment']);
        $comment_preview = rgds_parse_links($_POST['comment']);
        $smarty->assign('comment_preview', $comment_preview);
        $smarty->assign('SAVED', 1);
    }
}