- Joined
- Jun 17, 2010
- Messages
- 30
- Reaction score
- 14
Hello, this is my first post so please be nice and no flaming.
If you don't want to make files below, you can download the files here.
Download :
Virus Scan (For people who think this is a virus) :
Antivir: Nothing found
ArcaVir: Nothing found
AVG: Nothing found
BitDefender: Nothing found
VirusBlokAda32: Nothing found
VirusBuster: Nothing found
Scanned by
Make a config.php file and put this in.
Make register.php and put this in.
Make register_process.php and put this in.
Make checkuser.php and put this in.
Make javascript.js and put this in.
Screenshot (Credits to billybombill):
If you don't want to make files below, you can download the files here.
Download :
You must be registered to see links
Virus Scan (For people who think this is a virus) :
Antivir: Nothing found
ArcaVir: Nothing found
AVG: Nothing found
BitDefender: Nothing found
VirusBlokAda32: Nothing found
VirusBuster: Nothing found
You must be registered to see links
Scanned by
You must be registered to see links
Make a config.php file and put this in.
PHP:
<?php
// Mysql Info:
$host = 'localhost'; // The host: usually localhost.
$dbuser = 'root'; // The username used to connect to MySQL.
$dbpass = ''; // The password used in conjunction with the username.
$dbname = 'odinms'; // The name of the database containing OdinMS (or any pServer with the same accounts table)
mysql_connect($host, $dbuser, $dbpass) or die(mysql_errno().mysql_error());
mysql_select_db($dbname) or die(mysql_errno().mysql_error());
$disallowednames = array(
'admin', 'gamemaster', 'supergm'
); // Has to be atleast one value otherwise it won't work. Simply seperate each value with a comma. This is case sensitive, so I'd use as little values as possible.
?>
Make register.php and put this in.
PHP:
<head>
<script type="text/javascript" language="javascript" src="javascript.js"> </script><!-- Feel free to remove this, if you want it to stop working. --></head>
<!-- Don't remove any divs or ids! -->
<div id="form">
<form method="post" action="register_process.php?njx=true">
Username: <input type="text" name="name" id="name" maxlength="13"><div id="check"><input type="button" onclick="checkname()" value="Check"></div> <div id="checkresponse"></div><br>
Password: <input type="password" name="pass" id="pass" maxlength="35"><br>
Verify Password: <input type="password" name="pass2" id="pass2" maxlength="35"><br>
Email: <input type="text" name="email" id="email" maxlength="50"><br>
D.O.B. (YYYY-MM-DD): <input type="text" name="dob" id="dob" maxlength="16"><br>
<div id="submit"><input type="button" value="Register!" onclick="register()"></div></form></div>
Make register_process.php and put this in.
PHP:
<?php if (isset($_REQUEST['njx'])) { ?>
<!-- The layout goes here -->
<!-- The space for the registration output - DONT GO INTO THE PHP! -->
<?php
include ('config.php');
$name = mysql_real_escape_string($_REQUEST['name']);
$pass = mysql_real_escape_string(sha1($_REQUEST['pass']));
$email = mysql_real_escape_string($_REQUEST['email']);
$dob = mysql_real_escape_string($_REQUEST['dob']);
$pass2 = mysql_real_escape_string(sha1($_REQUEST['pass2']));
$query = mysql_query("SELECT 'id' FROM accounts WHERE name='$name'");
if (empty($_REQUEST['name'])) {
echo 'There was no username filled in.';
die();
} elseif (in_array($_REQUEST['name'], $disallowednames)) {
echo 'Your name has been disallowed by the admin.';
die();
} elseif (!isset($_POST['userexists'])) {
if (mysql_num_rows($query) > 0) {
echo 'The selected user already exists.';
die();
}
} elseif ($pass == "") {
echo 'There was no password filled in.';
die();
} elseif ($_REQUEST['pass'] != $_REQUEST['pass2']) {
echo 'The passwords did not match.';
die();
} elseif ($email == "") {
echo 'There was no email filled in.';
die();
} elseif ($dob == "") {
echo 'There was no Date Of Birth filled in.';
die();
}
mysql_query("INSERT INTO accounts (name, password, email, birthday) VALUES('$name', '$pass', '$email', '$dob')") or
die('Error #' . mysql_errno() . ': ' . mysql_error());
echo 'Your account has been created, you can now login!';
?>
<!-- End registration output -->
<!-- Stop the layout! The rest of this is for the non-handicapped browsers! -->
<?php } else {
include ('config.php');
$name = mysql_real_escape_string($_REQUEST['name']);
$pass = mysql_real_escape_string(sha1($_REQUEST['pass']));
$email = mysql_real_escape_string($_REQUEST['email']);
$dob = mysql_real_escape_string($_REQUEST['dob']);
$pass2 = mysql_real_escape_string(sha1($_REQUEST['pass2']));
$query = mysql_query("SELECT 'id' FROM accounts WHERE name='$name'");
if (empty($_REQUEST['name'])) {
echo 'There was no username filled in.';
die();
} elseif (in_array($_REQUEST['name'], $disallowednames)) {
echo 'Your name has been disallowed by the admin.';
die();
} elseif (!isset($_POST['userexists'])) {
if (mysql_num_rows($query) > 0) {
echo 'The selected user already exists.';
die();
}
} elseif ($pass == "") {
echo 'There was no password filled in.';
die();
} elseif ($_REQUEST['pass'] != $_REQUEST['pass2']) {
echo 'The passwords did not match.';
die();
} elseif ($email == "") {
echo 'There was no email filled in.';
die();
} elseif ($dob == "") {
echo 'There was no Date Of Birth filled in.';
die();
}
mysql_query("INSERT INTO accounts (name, password, email, birthday) VALUES('$name', '$pass', '$email', '$dob')") or
die('Error #' . mysql_errno() . ': ' . mysql_error());
echo 'Your account has been created, you can now login!';
} ?>
Make checkuser.php and put this in.
PHP:
<?php
include ('config.php');
if (!isset($_REQUEST['name'])) {
echo 'You didn\'t enter the name';
die();
}
elseif (in_array($_REQUEST['name'], $disallowednames, true)) {
echo '<font style="color: red;">Your name has been disallowed by the admin.</font>';
die();
}
$name = mysql_real_escape_string($_REQUEST['name']);
$query = mysql_query("SELECT 'id' FROM accounts WHERE name='$name'");
if (mysql_num_rows($query) > 0) {
echo '<font style="color: red">The selected user exists</font><input type="hidden" name="userexists" value="1/' .
$_REQUEST['name'] . '" id="verified">';
exit();
} else {
echo '<font style="color: green">The user doesn\'t exist!</font><input type="hidden" name="userexists" value="0/' .
$_REQUEST['name'] . '" id="verified">';
}
?>
Make javascript.js and put this in.
PHP:
// Coded by SSJ5Goku. Thanks to DragoNero (Tizag) for looking over this :).
function createResponse(){
try {
request = new XMLHttpRequest();//Geko
} catch (trymicrosoft) {
try {
request = new ActiveXObject('Msxml2.XMLHTTP');//MS 1
} catch (othermicrosoft) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');//MS 2
} catch (failed) {
}
}
}
if (request == null){
alert("AJAX Doesn't work! Falling back to HTML...");
dooument.getElementById("check").innerHTML = ' ';
document.getElementById("submit").innerHTML = '<input type="submit" value="Register!">';
}
}
function checkname(){
createResponse();
var name = document.getElementById("name").value;
var url = 'checkuser.php?dummy=' + new Date().getTime() + '&name=' + escape(name);
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var name = document.getElementById("name").value;
request.send(null);
}
function register(){
createResponse();
var url = 'register_process.php';
var dob = document.getElementById("dob").value;
var name = document.getElementById("name").value;
var pass = document.getElementById("pass").value;
var pass2 = document.getElementById("pass2").value;
var email = document.getElementById("email").value;
var sent = "name=" + escape(name) + "&pass=" + escape(pass) + "&pass2=" + escape(pass2) + "&email=" + escape(email) + "&dob=" + escape(dob);
request.open("POST", url, true);
request.onreadystatechange = updateForm;
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(sent);
}
function updatePage(){
if(request.readyState == 4){
if(request.status == 200){
document.getElementById("checkresponse").innerHTML = request.responseText;
}else{
var message = request.getResponseHeader("Status");
if((message.length == null) || (message.length <= 0)){
alert("Error! The status of the request is " + request.status);
}else{
alert(message);
}
}
}
}
function updateForm(){
if(request.readyState == 4){
if(request.status == 200){
document.getElementById("form").innerHTML = request.responseText;
}else{
var message = request.getResponseHeader("Status");
if((message.length == null) || (message.length <= 0)){
alert("Error! The status of the request is " + request.status);
}else{
alert(message);
}
}
}
}
Screenshot (Credits to billybombill):
Last edited: