
Originally Posted by
ShuraF
I can't find it the hell.
can someone post the release thread for me?
thanks in advance.
You Should really look harder. But this is the one I have always used
PHP Code:
<?php
/*
Original by Wizkid,
Captcha added by Phoenix,
Completely reworked by Aaron (zyberscape) with LegacyGamers.net
*/
$dns="GunzDB";
$user="sa";
$pass="abcc";
$connect = odbc_connect($dns, $user, $pass) or die ("Couldn't connect to the database...");
$select_db = odbc_exec($connect, "use GunzDB");
require_once "captcha/securimage.php";
function cleanup($info){
$info = stripslashes($info);
$info = htmlspecialchars($info);
return $info;
}
function doesUsernameExist($name){
$exit = FALSE;
$result = @odbc_exec($connect, "SELECT UserID FROM Account WHERE UserID='".$name."'");
if(odbc_num_rows($result) != 0){
$exit = TRUE;
}
else{
$exit = FALSE;
}
return $exit;
}
if(isset($_POST['register'])){
$securimage = new Securimage();
if(empty($_POST['username']) || strlen($_POST['username']) > 25){ //reasonable
$errormsg.="No username filled or too long.<br>";
}
if(empty($_POST['password']) || strlen($_POST['password']) > 25){ //set a reasonable limit
$errormsg.="No password filled or too long.<br>";
}
if(empty($_POST['email']) || strlen($_POST['email']) > 100){ //emails are odd, so lets do 100, anymore they are worthless to us
$errormsg.="No e-mail filled or too long.<br>";
}
if(empty($_POST['name']) || strlen($_POST['name']) > 50){ //again set a resonable limit..
$errormsg.="No name filled or name is FAR too long.<br>";
}
if(empty($_POST['age']) || !is_numeric($_POST['age']) || strlen($_POST['age']) > 2){ //no-one is going to be 90000e
$errormsg.="No age filled or age is not realisitic.<br>";
}
if(strlen(filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) == 0){
/*we could go even further make sure that the domain actually
has a mail server in it but I will skip that.*/
$errormsg.="Email adress is not a valid email.<br>";
}
if ($securimage->check($_POST['captcha_code']) == false){ //check if captcha is wrong
$errormsg.="The code you entered was incorrect. Go back and try again.";
}
//
if(!empty($errormsg)){
echo "<div>There were some problems while registering your account:<br>".$errormsg."</div>";
exit();
}
else {
$usercl = cleanup($_POST['username']);
$namecl = cleanup($_POST['name']);
if(doesUsernameExist($usercl)){ //username is taken
echo "<div style=\"font-weight: bold;\">Try a different name.</div>";
exit();
}
else {
$insert_account = odbc_exec($connect, "INSERT INTO Account (UserID, UGradeID, PGradeID, RegDate, Email, Age, Name) VALUES ('".$usercl."', '0', '0', '".date("Y-m-d H:i:s")."', '".$_POST['email']."', '".$_POST['age']."', '".$namecl."')");
$get_aid = odbc_fetch_array(odbc_exec($connect, "SELECT AID FROM Account WHERE UserID='".$usercl."'"));
$inster_login = odbc_exec($connect, "INSERT INTO Login (UserID, AID, Password) VALUES ('".$usercl."', '".$get_aid['AID']."', '".$namecl."')");
echo '<div align="center">Your account is succesfully created with the name '.$usercl.'!</div>';
exit();
}
}
}
?>
<!DOCTYPE html>
<head>
<title>GunZ Register Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div style="font-weight:bold;">You can register a GunZ account right here:<br></div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username" maxlength="25" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" maxlength="25" /></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" name="email" maxlength="100" /></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="name" maxlength="50" /></td>
</tr>
<tr>
<td>Age</td>
<td><input type="text" name="age" maxlength="2" /></td>
</tr>
<tr>
<td width="100">Security Code</td>
<td width="289"><input type="text" name="captcha_code" size="10" maxlength="6" /></td>
</tr>
<tr>
<td width="80"></td>
<td width="100"><img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /></td>
</tr>
<tr>
<td width="434" colspan="2"><hr color="#323232" width="96%"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="register" value="Register!" /></td>
</tr>
</table>
</form>
</body>
</html>