<?php require('framework/session.php'); ?>
<?php require('style/layout/header.php'); ?>
<div id="content_wrapper">
<div class="content">
<?php
if(!isset($_SESSION['signed_in'])) {
echo '<div class="left"><img src="style/images/worldmap.png" width="505" height="360" border="0"></div>';
echo '<div class="right"><h1 class="head_spacer">' . $lang['register'] . '</h1>' . $lang['signup_for_free'] . '
<div id="min_line"></div>';
if($_SERVER['REQUEST_METHOD'] != 'POST') {
echo '<form method="post" action="">
<p><label for="name">' . $lang['name'] . '</label><input type="text" class="textfields" name="name" required size="30"></p>
<p><label for="email">' . $lang['e_mail_adress'] . '</label><input type="text" class="textfields" name="email" required size="30"></p>
<p><label for="email_check">' . $lang['repeat_e_mail_adress'] . '</label><input type="text" class="textfields" name="email_check" required size="30"></p>
<p><label for="password">' . $lang['password'] . '</label><input type="password" class="textfields" name="password" required size="30" onkeyup="passwordStrength(this.value)"></p>
<p><label for="pass_check">' . $lang['repeat_passwort'] . '</label><input type="password" class="textfields" name="pass_check" required size="30"></p>
<p><label for="sex">' . $lang['i_am'] . '</label><select name="sex" id="sex" required class="dropdown"><option selected="selected">' . $lang['select_sex'] . '</option><option value="male">' . $lang['male'] . '</option><option value="female">' . $lang['female'] . '</option></select></p>
<p><label for="passwordStrength">' . $lang['password_strength'] . '</label><div id="passwordDescription"><span class="passwordDescription">' . $lang['password_not_entered'] . '</span></div><div id="passwordStrength" class="strength0"></div></p>
<p><input type="submit" name="submit" value="' . $lang['register'] . '" alt="' . $lang['register'] . '" class="register"></p>
</form>';
}else{
if(isset($_POST['email'])) {
$email = htmlentities($_POST['email'], ENT_QUOTES);
$sql_check = mysql_query("SELECT id FROM members WHERE email='" . mysql_real_escape_string($email) . "'") OR die(mysql_error());
if(intval(mysql_num_rows($sql_check))) {
echo '<p class="false">' . $lang['email_is_already_taken'] . ' - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
}else{
$errors = array();
if(isset($_POST['name'])) {
if(strlen($_POST['name']) > 30) {
$errors[] = $lang['not_be_longer'];
}
}else{
$errors[] = $lang['name_must_be_filled'];
}
if(isset($_POST['password'])) {
if(trim($_POST['password']) == "") {
$errors[] = $lang['enter_a_password'];
}
if($_POST['password'] != $_POST['pass_check']) {
$errors[] = $lang['repetition_does_not_match'];
}
}else{
$errors[] = $lang['pw_must_be_filled'];
}
if(isset($_POST['email'])) {
$email = mysql_escape_string($_POST['email']);
if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) {
$errors[] = $lang['invalid_syntax'];
}
if($_POST['email'] != $_POST['email_check']) {
$errors[] = $lang['email_does_not_match'];
}
}else{
$errors[] = $lang['email_must_be_filled'];
}
if(isset($_POST['sex'])) {
if(trim($_POST['sex']) == "") {
$errors[] = $lang['sex_must_be_filled'];
}
}else{
$errors[] = $lang['sex_must_be_filled'];
}
if(!empty($errors)) {
echo '<p class="false">' . $lang['not_filled_in_all_fields'] . ' - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
echo '<ul>';
foreach($errors as $key => $value) {
echo '<li>• ' . $value . '</li>';
}
echo '</ul>';
}else{
$hash = mt_rand(0, 1000);
$email = mysql_real_escape_string($_POST['email']);
$name = mysql_real_escape_string($_POST['name']);
$password = mysql_real_escape_string($_POST['password']);
$sql = "INSERT INTO
members(name, password, email ,date, level, hash, sex)
VALUES('" . mysql_real_escape_string($_POST['name']) . "',
'" . sha1($_POST['password']) . "',
'" . mysql_real_escape_string($_POST['email']) . "',
NOW(),
'0',
'" . mysql_real_escape_string($hash) . "',
'" . mysql_real_escape_string($_POST['sex']) . "')";
$result = mysql_query($sql) OR die(mysql_error());
if(!$result) {
echo '<p class="red_span">' . $lang['reg_could_not_be_completed'] . '</p>';
}else{
if($mailinfo == TRUE) {
$subject_reg = $lang['new_registration'];
$body = '' . $name . ' ' . $lang['just_registered'] . '';
$headers = 'From:' . $webmaster . '';
mail("$webmaster", "$subject_reg", "$body", "$headers");
}
$to = $email;
$subject = $lang['complete_your_registration'];
$message = '' . $lang['thank_you_for_registration'] . '
-------------------------------
' . $lang['name'] . ': ' . $name . '
' . $lang['password'] . ': ' . $password . '
-------------------------------
' . $lang['click_verify_link'] . ':
' . $url . 'verify.php?email=' . $email . '&hash=' . $hash . '
';
$headers = 'From:' . $webmaster . '';
mail("$to", "$subject", "$message", "$headers");
echo '<p class="green_span">' . $lang['registration_was_successful'] . '</p>
<p>' . $lang['activate_your_account'] . '</p>';
mysql_free_result($result);
}}}}}
echo '</div>';
echo '<div class="clear_long"></div>';
echo '<div class="features_left">';
echo '<p><span class="blue_bgl">' . $lang['do_you_know'] . '?</span></p>';
include_once('framework/class/rand_class.php');
print rand_members();
echo '</div>';
echo '<div class="stat_middle">';
echo '<p><span class="blue_bgl">' . $lang['our_newest_member'] . '</span></p>';
include_once('framework/class/newest_class.php');
print newest_members();
echo '</div>';
echo '<div class="stat_right">';
echo '<p><span class="blue_bgl">' . $lang['your_friend'] . '?</span></p>';
include_once('framework/class/rand_class.php');
print rand_members();
echo '</div>';
echo '<div class="spacer"></div>';
}else{
include('modules/index.inc.php');
}
?>
<?php require('style/layout/footer.php'); ?>