get_results(“SELECT PersionID FROM $table_name WHERE ScreenName LIKE ‘$screen'”);
if (count($res) > 0) {
$screenBad = ‘The Screen Name you have entered is already being used by someone else.’;
}
}
if (empty($password)) {
$passwordBad = ‘Please enter a password.’;
} else if (4 > strlen($password)) {
$passwordBad = ‘Password must be at least 4 characters long.’;
} else if ($password != $confPassword) {
$passwordBad = ‘Confirmation Password does not match.’;
}
if (empty($_POST[’email’])) {
$emailBad = ‘Your E-Mail address can\’t be empty.’;
} else {
if (!filter_var($_POST[’email’], FILTER_VALIDATE_EMAIL)) {
$emailBad = ‘The E-Mail address you have entered is invalid.’;
} else {
$res = $wpdb->get_results(“SELECT PersionID FROM $table_name WHERE eMail LIKE ‘$email'”);
if (count($res) > 0) {
$emailBad = ‘The E-Mail address you have entered is already in our records.’;
}
}
}
if (!$firstBad && !$lastBad && !$screenBad && !$passwordBad && !$emailBad) {
$sql = “CREATE TABLE IF NOT EXISTS `” . $table_name . “` (
`PersionID` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`FirstName` VARCHAR( 50 ) NOT NULL ,
`LastName` VARCHAR( 50 ) NOT NULL ,
`ScreenName` VARCHAR( 50 ) NOT NULL ,
`Password` VARCHAR( 23 ) NOT NULL ,
`eMail` VARCHAR( 50 ) NOT NULL ,
`BlogOptIn` TINYINT( 1 ) UNSIGNED NOT NULL ,
`EventsOptIn` TINYINT( 1 ) UNSIGNED NOT NULL ,
`ContestOptIn` TINYINT( 1 ) UNSIGNED NOT NULL ,
`DateJoined` TIMESTAMP NULL DEFAULT NULL ,
`DateLastTouch` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`DateUnsubscribe` TIMESTAMP NULL DEFAULT NULL ,
PRIMARY KEY ( `PersionID` ))”;
$wpdb->query($sql);
$rows_affected = $wpdb->insert($table_name, array(‘FirstName’ => $first, ‘LastName’ => $last, ‘ScreenName’ => $screen, ‘Password’ => MD5($password), ‘eMail’ => $email, ‘BlogOptIn’ => ($blog ? 1: 0), ‘EventsOptIn’ => ($event ? 1: 0), ‘ContestOptIn’ => ($contest ? 1: 0), ‘DateJoined’ => date(‘Y-m-d H:i:s’), ‘DateLastTouch’ => date(‘Y-m-d H:i:s’)));
if ($blog) {
$rows_affected2 = $wpdb->insert(‘wp_subscribe2′, array(’email’ => $email, ‘active’ => 1, ‘ip’ => $_SERVER[‘REMOTE_ADDR’], ‘date’ => date(‘Y-m-d’)));
}
$first = ”;
$last = ”;
$screen = ”;
$password = ”;
$conPassword = ”;
$email = ”;
$registered = true;
echo ‘
‘;
}
}
if (!$registered) {
?>