كود PHP:
<!--- Support shits --->
<?php include_once "./pages/_support.php"; ?>
<!--- Support shits ending -->
<!--- Where am I senpai? --->
<ul class="breadcrumb" itemprop="breadcrumb">
<li><a href="index.php" itemprop="url">Index</a></li>
<li>Register</li>
</ul>
<!--- Ending --->
<section class="suppLandingSection">
<h2><span>You must fill all the fields in order to successfully</span>Register</h2>
</section>
<section class="suppLandingSection secondSuppLandingSection">
<div class="supportAbstractContainer">
<?php
$date = date('m/d/Y h:i:s a', time());
# Make sure that they logged out
if(empty($_SESSION['username'])) {
# Check post
if(isset($_POST['register_now'])) {
# Check capthca code
if(isset($_POST['verif_code']) AND !Empty($_POST['verif_code'])) {
if($_POST['verif_code'] != $_SESSION['aleat_nbr'])
# Wrong captch acode
$error[] = "Wrong captcha code";
} else {
# Captcha code empty
$error[] ="Please fill captcha input.";
}
# Clean Username
$user_id = $sec->secure($_POST['user_id']);
# Clean Mail
$mail = $sec->secure($_POST['user_mail']);
# Clean password(s)
$cleanpw = $sec->secure($_POST['user_pw']);
$cleanpw_2 = $sec->secure($_POST['confirm_pw']);
# Clean secret code(s)
$secs = $sec->secure($_POST['secret']);
$secs_2 = $sec->secure($_POST['secret2']);
# Verification code
$code = rand(1,255);
$code .= rand(24,243);
$code .= rand(49,325);
$code .= rand(100,999);
$code .= rand(242,429);
$code .= rand(1337,34532);
$code .= rand(3000,9000);
# Controll username
if(empty($user_id)) {
$error[] = "Username cannot be left behind!";
} else {
if(strlen($user_id) < 4) $error[] = "Username too short.";
if(strlen($user_id) > 16) $error[] = "Username too long.";
if(!ctype_alnum($user_id)) $error[] = "Username should be Characters and Numbers only.";
}
# Closed register
if($register_open == 0) {
$error[] = "You may not register yet.";
}
# Mail security
if(empty($mail)) {
$error[] = "Mail cannot be left behind!";
} else {
if(!filter_var($mail, FILTER_VALIDATE_EMAIL)) $error[] = "Mail is not valid";
}
# Password security
if(empty($cleanpw)) {
$error[] = "Password cannot be left behind!";
} else {
if(strlen($cleanpw) < 4) $error[] = "Password too short.";
if(strlen($cleanpw) > 32) $error[] = "Password too long.";
}
# Confirm password security
if(empty($cleanpw_2)) {
$error[] = "Confirm password cannot be left behind!";
} else {
if(strlen($cleanpw_2) < 4) $error[] = "Confirm password too short.";
if(strlen($cleanpw_2) > 32) $error[] = "Confirm password too long.";
}
# Check if passwords match
if(md5($cleanpw) != md5($cleanpw_2)) {
$error[] = "Password(s) doesn't match.";
}
# Secret code security
if(empty($secs)) {
$error[] = "Secret code cannot be left behind!";
} else {
if(strlen($secs) < 4) $error[] = "Security code too short.";
if(strlen($secs) > 32) $error[] = "Security code too long.";
}
# Confirm secret code security
if(empty($secs_2)) {
$error[] = "Confirm secret code cannot be left behind!";
} else {
if(strlen($secs_2) < 4) $error[] = "Confirm secret code too short.";
if(strlen($secs_2) > 32) $error[] = "Confirm secret code too long.";
}
# Check if secret code match
if(md5($secs) != md5($secs_2)) {
$error[] = "Secret code(s) doesn't match.";
}
# Count errors
if (@count($error) > 0) {
for($e=0;$e<count($error);$e++) {
echo '<div class="errorMessage">
'.$error[$e].'
</div>';
}
# No errors found, continue...
} else {
# Check if account exist already
$check = mssql_query("use SRO_VT_ACCOUNT SELECT JID from TB_User where StrUserID = '".($user_id)."'") or die("Something went wrong, contact web administrator!");
if(mssql_num_rows($check) > 0) {
echo '<div class="warningMessage">The account does already exist or the username is blacklisted!</div>';
# Error, username taken.
# No error, continue.
} else {
# Insert into DB
mssql_query("use SRO_VT_ACCOUNT INSERT INTO tb_user (StrUserID, is_activated, password, password_d, secret, secret_d, reg_ip, reg_date, activation_code, need_update,Email)
VALUES('".($user_id)."','1',
'".md5($cleanpw_2)."', '".($cleanpw_2)."', '".md5($secs_2)."',
'".($secs_2)."', '".($_SERVER['REMOTE_ADDR'])."', '$date', 'done', 0 ,'$mail')")
OR DIE("Something went wrong, contact web administrator!");
# Send mail.
$subject = "Thank you for joining us | Account activation";
",
Please press/copy the URL(in ur browser) in order to activate your account below this text:
# Activation url
http://?page=verify&code=".$code."
Sincerely,
PachaSro - Support team
--- Request sent by ---
".$_SERVER['REMOTE_ADDR'];
# Send the mail
echo " <div class='successMessage' > Your account is Register completed !!!=".$code."\"><font color='#FFFF00'><b><h1>Register completed</h1></b></font></a></div>";
}
}
} #END POST
?>
<div class="supportAbstract">
<div>
<form method="POST">
<div class="middlePart">
<div class="LoginForm" autocomplete="off">
<div class="login">
<input type="text" id="user_id" placeholder="Username" class="Username placeholder NoPlaceholder text" title="Username" name="user_id" maxlength="16" />
<input type="text" id="user_mail" placeholder="Mail" class="Username placeholder NoPlaceholder text" title="Mail" name="user_mail" />
<input type="password" id="user_pw" placeholder="Password" class="Password placeholder NoPlaceholder password" name="user_pw" title="Password" maxlength="32" />
<input type="password" id="confirm_pw" placeholder="Retype password" class="Password placeholder NoPlaceholder password" name="confirm_pw" title="Password" maxlength="32" />
</div>
</div>
</div>
<!--- Register button --->
<div class="btnWrap " id="globalLoginFormLogIn">
<div class="btn">
<div class="btnRight">
<input type="submit" style="text-align:center;" value="> REGISTER <" id="register_now" name="register_now" />
</div>
</div>
</div>
<!--- Register button ending --->
</div>
<div id="resultado"></div>
</div>
<div class="supportAbstract">
<div>
<!--- Captcha code --->
<div class="middlePart">
<div class="LoginForm">
<div class="login">
<input type="text" id="secret" placeholder="Secret code" class="Username placeholder NoPlaceholder text" title="Secret code" name="secret" maxlength="32" />
<input type="text" id="secret2" placeholder="Retype secret code" class="Username placeholder NoPlaceholder text" title="Retype secret code" name="secret2" maxlength="32" />
<input type="text" id="verif_code" placeholder="Enter captcha code" class="Username placeholder NoPlaceholder text" title="Enter captcha code" name="verif_code" autocomplete="off"/>
</div>
<div id="reCAPTCHA">
<br>
<img src="item/verif_code_gen.php" alt="Captcha verification code" />
</div>
</div>
</div>
<!--- Captcha code ending --->
</div>
</form>
</div>
</div>
</section>
<section class="suppLandingSection">
<h2 class="serviceStatusTitle"><font color="red">Attention!</font></h2>
<ul>
<li><span>Remember to save your registered accounts "<strong>SECRET CODE</strong>" and too never share the "<strong>SECRET CODE</strong>" with anyone.</span></li>
<li><span>Remember to save your registered accounts "<strong>Email</strong>" and too never share the "<strong>Email</strong>" with anyone.</span></li>
</ul>
</section>
<?php
# Tell them to logout.
} else {
echo '<br><br><h4 class="serviceStatusTitle"><font color="red">You must be logged out in order to create an account!</font></h2><br><br>';
}
?>
</div>
</div>
</div>
<!--- Footer --->
<?php include_once "./pages/_footer.php"; ?>
<!--- Footer end --->