As stated in the title, When I’m trying to write into the database… Nothing is being written for some reason…
[php]
Register - Shock Hosting <?php error_reporting (E_ALL ^ E_NOTICE); session_start(); $userid = $_SESSION['userid']; $username = $_SESSION['username']; ?><?php
if ($username && $userid)
{
header('Location: ./Index.php');
}
else
{
$form= "<form action=' ./Register.php' method='post'>
<table>
<tr>
<td>Desired Username:</td>
<td><input type='text' name='user'/></td>
</tr>
<tr>
<td>Desired Password:</td>
<td><input type='text' name='password'/></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type='text' name='email'/></td>
</tr>
<tr>
<td></td>
<td><input type='submit' name='loginbtn' value='Login'/></td>
</tr>
</table>
</form>";
if ($_POST['loginbtn']) {
$user = $_POST['user'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($user){
if($password){
require("connect.php");
$password = md5(md5("afasg".$password."D123Id"));
//connects to database
$query = mysql_query("SELECT * FROM Users WHERE Username = '$user'");
$numrows = mysql_num_rows($query);
$query2 = mysql_query("SELECT * FROM Users WHERE Email = '$email'");
$numrows2 = mysql_num_rows($query2);
if ($numrows == 1)
{
echo "The desired username is currently taken.";
}
else
{
if ($numrows2 == 1)
{
echo "The email address you are trying to use is currently taken.";
}
else
{
$regquery = mysql_query("INSERT INTO Users (Username,Password,Email,active) VALUES ('$username','$password','$email','0'");
}
}
mysql_close();
}
else
{
echo "You must enter your password. $form";
}
}
else
{
echo "You must enter your username. $form";
}
}
else
echo "$form";
}
?></div></div>
<div id="footer">
© 2012 Fleming Hosting</div>
</body>
[/php]
