Onbekend |
|
dus bij register.php zo toch?:
<?
error_reporting(0);
include("config.php");
if(!empty($cfg['register']))
{
if(!isset($_POST['reg_user']))
{
?>
<form method="POST">
<input type="hidden" value="1" name="reg_user">
<b>Username :</b><br>
<input type="text" name="user" maxlength="30"><br>
<b>Email :</b><br>
<input type="text" name="email" maxlength="125"><br>
<b>Password :</b><br>
<input type="password" name="pass" maxlength="12"> (At least 5 chars)<br>
<b>Password [Confirm] :</b><br>
<input type="password" name="pass2" maxlength="12"> (At least 5 chars)<br><br>
<input type="Submit" value="Register"><br><br>
<?
}
else
{
if(!empty($_POST['user']) AND !empty($_POST['email']) AND !empty($_POST['pass']) AND !empty($_POST['pass2']))
{
$result = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_users WHERE user_name = '" . $_POST['user'] . "'"),0);
if(!empty($result))
{
echo "<script>alert('Username already in use'); history.go(-1)</script>";
}
else
{
if(preg_match("/^([a-z0-9_\-]+\.)*?[a-z0-9_\-]+@([a-z0-9\-_]{2,})\.[a-z0-9\-_]*(\.[a-z0-9\-_]{2,})*$/i",$_POST['email']))
{
if(strlen($_POST['pass']) <= 4)
{
echo "<script>alert('Password too short.'); history.go(-1)</script>";
}
else
{
if($_POST['pass'] != $_POST['pass2'])
{
echo "<script>alert('Passwords are not the same.'); history.go(-1)</script>";
}
else
{
mysql_query("INSERT INTO tbl_users VALUES ('','" . $_POST['user'] . "','" . $_POST['email'] . "',NULL,'" . md5($_POST['pass']) . "',NOW(),'d-m-Y H:i:s',1,1,1,NULL,1,NULL,'" . $_ENV['REMOTE_ADDR'] . "')") or die(mysql_error());
echo "Successfully registered, you can now log in";
echo "<br><br><a href=\"index.php\">Log in</a>";
}
}
}
else
{
echo "<script>alert('Email address incorrect.'); history.go(-1)</script>";
}
}
}
else
{
echo "<script>alert('Please fill in all fields.'); history.go(-1)</script>";
}
}
}
else
{
echo "<script>alert('Registering of new user has been disabled by the site admin.'); history.go(-1)</script>";
}
?>
<? include("config.php"); if(!empty($cfg['register'])) { if(!isset($_POST['reg_user'])) { ?> <form method="POST"> <input type="hidden" value="1" name="reg_user"> <b>Username :</b><br> <input type="text" name="user" maxlength="30"><br> <b>Email :</b><br> <input type="text" name="email" maxlength="125"><br> <b>Password :</b><br> <input type="password" name="pass" maxlength="12"> (At least 5 chars)<br> <b>Password [Confirm] :</b><br> <input type="password" name="pass2" maxlength="12"> (At least 5 chars)<br><br> <input type="Submit" value="Register"><br><br> <? } else { if(!empty($_POST['user']) AND !empty($_POST['email']) AND !empty($_POST['pass']) AND !empty($_POST['pass2'])) { $result = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_users WHERE user_name = '" . $_POST['user'] . "'"),0); { echo "<script>alert('Username already in use'); history.go(-1)</script>"; } else { if(preg_match("/^([a-z0-9_\-]+\.)*?[a-z0-9_\-]+@([a-z0-9\-_]{2,})\.[a-z0-9\-_]*(\.[a-z0-9\-_]{2,})*$/i",$_POST['email'])) { if(strlen($_POST['pass']) <= 4) { echo "<script>alert('Password too short.'); history.go(-1)</script>"; } else { if($_POST['pass'] != $_POST['pass2']) { echo "<script>alert('Passwords are not the same.'); history.go(-1)</script>"; } else { mysql_query("INSERT INTO tbl_users VALUES ('','" . $_POST['user'] . "','" . $_POST['email'] . "',NULL,'" . md5($_POST['pass']) . "',NOW(),'d-m-Y H:i:s',1,1,1,NULL,1,NULL,'" . $_ENV['REMOTE_ADDR'] . "')") or die(mysql_error()); echo "Successfully registered, you can now log in"; echo "<br><br><a href=\"index.php\">Log in</a>"; } } } else { echo "<script>alert('Email address incorrect.'); history.go(-1)</script>"; } } } else { echo "<script>alert('Please fill in all fields.'); history.go(-1)</script>"; } } } else { echo "<script>alert('Registering of new user has been disabled by the site admin.'); history.go(-1)</script>"; } ?>
|