Code: Select all
<?php
require('db_connect.php'); // database connect script.
?>
<html>
<head>
<title>Register an Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(/top2.jpg);
}
.style3 {color: #FFFFFF; font-weight: bold; }
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
.style4 {
color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
}
.style5 {font-family: Arial, Helvetica, sans-serif}
.style6 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
}
-->
</style></head>
<body>
<?php
$rand = rand(10248765,99543547);
$chrctr = $_POST['chrctr'];
if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they supposed to, passwords matched, username
isn't already taken, etc. */
if(!$_POST['uname'] | !$_POST['email'] | $_POST['character']) {
die('You didn\'t complete the register form correctly.');
// check if username exists in database.
if(!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
$name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");
if(DB::isError($name_check)) {
die($name_check->getMessage());
$name_checkk = $name_check->numRows();
if($name_checkk != 0) {
die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.');
// check e-mail format
if(!preg_match("/.*\@.*\..*/", $_POST['email']) | preg_match("/(\<|\>)/", $_POST['email'])) {
die('Sorry the e-mail address you submitted was of invalid format.');
// no HTML tags in username, website, location, password
if(preg_match("/(\<|\>)/", $_POST['uname']) | preg_match("/(\<|\>)/", $_POST['passwd']) | preg_match("/(\<|\>)/")) {
die('Invalid input, no HTML tags are allowed.');
$_POST['passwd'] = md5($_POST['passwd']);
if(!get_magic_quotes_gpc()) {
$_POST['passwd'] = addslashes($_POST['passwd']);
$_POST['email'] = addslashes($_POST['email']);
mysql_connect("localhost", "(myusername)", "(mypassword)") or die(mysql_error());
mysql_select_db("users") or die(mysql_error());
$regdate = date('m d, Y');
$qry = "INSERT INTO users (username, password, regdate, email) VALUES ('".$_POST['uname']."', '".$rand."', '".$regdate."', '".$_POST['email']."')";
echo $qry;
mysql_query($qry) or die(mysql_error());
#$result = mysql_query($query) or die (mysql_error());
mysql_query("INSERT INTO stats('".$_POST['uname']."','$chrctr', '100', '2000', '001', '01', 000, '01', '01', '01', '1', '0', '00000000', '00000000', '00000000', '00000000')");
echo mysql_errno() . ": " . mysql_error() . "<br><br>";
mysql_close();
?>
<?php
$to = $_POST['email'];
$subject = "(subject)";
$body = "Your password is: ".$rand;
if (mail($to, $subject, $body))
?>
<h1 class="style4"><strong>Registered</strong></h1>
<p class="style3 style5">Thank you, you successfully registered, you may now <a href="/login.php" title="Login" target="_self">log in</a>.</p>
<span class="style4">
<?php
}
else { // if form hasn't been submitted
?>
</span>
<h1 class="style4">Register</h1>
<form action="<?=$HTTP_SERVER_VARS['file:///K|/HOMIES/PHP_SELF']?>" method="post">
<table border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999">
<tr><td class="style5"><span class="style3">Username*:</span></td>
<td class="style5"><input type="text" name="uname" maxlength="40"></td></tr>
<tr><td class="style5"><span class="style3">E-Mail*:</span></td>
<td class="style5"><input type="text" name="email" maxlength="100"></td></tr>
<tr></tr>
</table>
</form>
<p align="center" class="style5">
<?php
}
?>
</p>
<p align="center" class="style6">PICK A HOMIE</p>
<div align="center">
<table width="600" border="1">
<tr>
<td width="100"><img src="/characters/1.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/2.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/3.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/4.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/5.jpg" width="100" height="150"></td>
<td width="108"><div align="center"><img src="/characters/6.jpg" width="100" height="150"></div></td>
</tr>
<tr>
<td><div align="center">
<input type="radio" name="character" value="1">
<br>
</div></td>
<td><div align="center">
<input type="radio" name="character" value="2">
</div></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="3">
</div>
</form></td><td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="4">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="5">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="3">
</div>
</form></td>
</tr>
</table>
<p> </p>
<table width="600" border="1">
<tr>
<td width="100"><img src="/characters/7.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/8.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/9.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/10.jpg" width="100" height="150"></td>
<td width="100"><img src="/characters/11.jpg" width="100" height="150"></td>
<td width="108"><div align="center"><img src="/characters/12.jpg" width="100" height="150"></div></td>
<td width="108"><img src="/characters/13.jpg" width="100" height="150"></td>
</tr>
<tr>
<td><div align="center">
<input type="radio" name="character" value="7">
<br>
</div></td>
<td><div align="center">
<input type="radio" name="character" value="8">
</div></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="9">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="10">
</div>
</form></td>
<td>
<form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="11">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="12">
</div>
</form></td>
<td><form name="form1" method="post" action="">
<div align="center">
<input type="radio" name="character" value="13">
</div>
</form></td>
</tr>
</table>
<p> </p>
</div>
<div align="center">
<table width="200" border="1">
<tr>
<td>
<td colspan="2" align="right" class="style5"><div align="center">
<input type="submit" name="submit" value="Sign Up">
</div></td> </td>
</tr>
</table>
</div>
<p class="style5">
</p>
</body>
</html>