File: /home/httpd/html/baretube.com/signup.php
<?
session_start();
include('admin/db.php');
if($_POST[signup_username] && $_POST[signup_password] && $_POST[signup_email]) {
$_POST = mysql_real_escape_array($_POST);
$errors = array();
$thisusername = htmlentities($_POST[signup_username]);
$thispassword = md5(htmlentities($_POST[signup_password]));
$thisemail = htmlentities($_POST[signup_email]);
$result = mysql_query("SELECT * FROM users WHERE username LIKE '%$thisusername%'");
if(mysql_num_rows($result) > 0) {
$errors[] = "This username already exists in our system.";
}
if(!ctype_alnum($thisusername)) {
$errors[] = "Username contains invalid characters. Please use only A-Z and 0-9, no spaces are special characters";
}
if(strlen($thisusername) < 6) {
$errors[] = "Username must be at least 6 characters long";
}
if(strlen($thispassword) < 6) {
$errors[] = "Password must be at least 6 characters long";
}
$result = mysql_query("SELECT * FROM users WHERE email = '$thisemail'");
if(mysql_num_rows($result) > 0) {
$errors[] = "This email address already exists in our system.";
}
if(!filter_var($thisemail, FILTER_VALIDATE_EMAIL)) {
$errors[] = "Invalid Email Address";
}
if($enable_signup_captcha) {
if(strtolower($_POST[captchaaa]) != strtolower($_SESSION[captcha])) {
$errors[] = "Incorrect CAPTCHA Response";
}
}
if(!$errors) {
if($require_account_confirmation) {
$validationCode = substr(number_format(time() * rand(),0,'',''),0,20);
}
$time;
mysql_query("INSERT INTO users (username,password,email,last_ip,validate,lastlogin) VALUES ('$thisusername','$thispassword','$thisemail','$_SERVER[REMOTE_ADDR]','$validationCode','$time')");
header("Location: signup_thankyou.php");
if($require_account_confirmation) {
$subject = "$sitename Account Verification";
$body = "
You must verify your account at $sitename before you can login!
Please click the link below, or paste it into your browsers address bar.
$basehttp/validateAccount.php?id=$validationCode
";
$to = $thisemail;
$from = "From: $sitename <$admin_email>";
mail($to,$subject,$body,$from);
}
exit();
}
}
$title = 'Signup';
$headertitle = 'Sign up for your FREE account';
if($isMobile) {
include($basepath.'/templates/mobile.overall_header.php');
}
else {
include($basepath.'/templates/template.overall_header.php');
}
?>
<div class="forms-wrapper">
<div class="forms">
<div class="forms-intro">
Sign up for a personal account to save videos, leave comments and utilize other advanced features!
<!-- class="forms-intro" --></div>
<? if($errors) { ?>
<div class="forms-error">
<strong>The following errors have occured:</strong><br>
<?
foreach($errors as $i) {
echo "• $i<br>";
}
?>
<!-- class="forms-error" --></div>
<? } ?>
<form id="form1" name="form1" method="post" action="">
<div class="form-label">Username</div>
<div class="form-field"><input class="text" id="signup_username" name="signup_username" type="text" maxlength="255" value="<? echo $thisusername; ?>"></div>
<div class="clear"></div>
<div class="form-label">Password</div>
<div class="form-field"><input class="text" id="signup_password" name="signup_password" type="text" maxlength="35"></div>
<div class="clear"></div>
<div class="form-label">Email</div>
<div class="form-field"><input class="text" id="signup_email" name="signup_email" type="text" maxlength="35" value="<? echo $thisemail; ?>"></div>
<div class="clear"></div>
<? if($enable_signup_captcha) { ?>
<div class="form-label">Human?</div>
<div class="form-field"><img src="/captcha.php" class="captcha"><input class="text" id="signup_email" name="captchaaa" type="text" size="10" value=""></div>
<div class="clear"></div>
<? } ?>
<div class="form-label"></div>
<div class="form-field"><input class="submit" id="button" type="submit" name="button" value="Sign Up"></div>
<div class="clear"></div>
<div class="form-label"></div>
<div class="form-field">Note: All fields are mandatory.</div>
<div class="clear"></div>
</form>
<!-- class="forms" --></div>
<!-- class="forms-wrapper" --></div>
<?
if($isMobile) {
include($basepath.'/templates/mobile.overall_footer.php');
}
else {
include($basepath.'/templates/template.overall_footer.php');
}
?>