Hits: 41183
Try: ca/tecreations/ViewFile.php -- Online
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/Base.php";
$email = $pass = $conf = $email_err = $pass_err = $conf_err = "";
if (isset($_SERVER['QUERY_STRING'])) {
if (isset($_REQUEST['email']) && isset($_REQUEST['pass']) && isset($_REQUEST['conf'])) {
$email = $_REQUEST['email'];
if (empty($email)) $email_err = "Empty";
$pass = $_REQUEST['pass'];
if (empty($pass)) $pass_err = "Empty";
$conf = $_REQUEST['conf'];
if (empty($conf)) $conf_err = "Empty";
$user = new User();
$user->setDebug(false);
if ($user->exists($email)) $email_err = "User taken.";
if ($pass != $conf) $conf_err = "Confirmation different than password.";
if ($email_err == "" && $pass_err == "" && $conf_err == "" && $email != "" && $pass != "") {
if ($user->create($email,$pass)) {
$_SESSION['uid'] = $user->getUID($email);
$_SESSION['level'] = $user->getLevel($_SESSION['uid']);
$_SESSION['email'] = $email;
header("Location: $PREFIX_DIR/Login/ConfirmEmail.php?email=$email");
} else die("Unable to create user: $email Password: $pass");
}
} else if (!empty($_SERVER['QUERY_STRING'])) Unauthorized();
}
require_once $_SERVER['DOCUMENT_ROOT'] . "$PREFIX_DIR/start.php";
?>
<title>Register</title>
<style type="text/css">
.wrapper { width: 450px; padding: 25px; }
</style>
<script>
function ValidateForm() {
if (ValidateEmail(document.form1.email)) {
return true;
} else {
alert("You have entered an invalid email address!");
document.form1.email.focus();
return false;
}
}
function showPassword(cbox) {
var x = document.form1.pass;
var x2 = document.form1.conf;
if (cbox == x) x2.selected = cbox.selected;
if (cbox == x2) x.selected = cbox.selected;
if (x.type === "password") {
x.type = "text";
x2.type = "text";
} else {
x.type = "password";
x2.type = "password";
}
}
</script>
</head>
<body>
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . "/" . $PREFIX_DIR . "/header_start.php";
include_once $DOCROOT . "$PREFIX_DIR/menu/java.php";
include_once $DOCROOT . "$PREFIX_DIR/menu/apps.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/" . $PREFIX_DIR . "/menu/login.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/" . $PREFIX_DIR . "/menu/contact.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/" . $PREFIX_DIR . "/header_finish.php";
?>
<div class="wrapper">
<center><h2>Register</h2></center>
<p>Please fill out this form to create an account.</p>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" name="form1" method="get">
<div class="form-group <?php echo (!empty($email_err)) ? 'has-error' : ''; ?>">
<label>Email</label>
<input autocomplete=off type="text" name="email" class="form-control" value="<?php echo htmlspecialchars($email); ?>">
<span class="help-block"><?php echo $email_err; ?></span>
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else. I'm not selling data.</small>
<small id="confirmationRequired" class="form-text text-muted">You must confirm your email address.</small>
<small id="deleteHelp" class="form-text text-muted">You can delete anytime, and it's gone.</small>
</div>
<div class="form-group <?php echo (!empty($pass_err)) ? 'has-error' : ''; ?>">
<label>Password</label>
<input autocomplete=off type="password" name="pass" id="pass" class="form-control" value="<?php echo htmlspecialchars($pass); ?>">
<input type="checkbox" onclick="showPassword(this)">Show Password
<span class="help-block"><?php echo $pass_err; ?></span>
</div>
<div class="form-group <?php echo (!empty($conf_err)) ? 'has-error' : ''; ?>">
<label>Confirm Password</label>
<input autocomplete=off type="password" name="conf" id="conf" class="form-control" value="<?php echo htmlspecialchars($conf); ?>">
<span class="help-block"><?php echo $conf_err; ?></span>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Submit" onclick="return ValidateForm()">
<input type="reset" class="btn btn-default" value="Reset">
</div>
<p align="center">Already have an account? <a href="<?php echo $PREFIX_DIR; ?>/Login/Login.php">Login here</a>. <a href="<?php echo $PREFIX_DIR; ?>/Login/Forgot.php">Forgotten Password?</a></p>
</form>
</div>
<script src="/ca/tecreations/email-validation.js"></script>
<?php require_once "$DOCROOT$PREFIX_DIR/footer.html"; ?>