<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-color: #0099CC;
}
.style1 {
	color: #F0F0F0;
	font-size: 36px;
}
.style3 {
	font-size: 24px;
	font-weight: bold;
}
-->
</style></head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3 align="center"><a href="file:///C|/xampp/htdocs/trials/login.php">LOGIN</a></h3>
<h3 align="center">Back to Home </h3>
<h1 align="center" class="style1">Registration Form</h1>
<form action="" method="POST">
  <div align="center">
    <p><span class="style3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="style3">Username:  
      <input type="text" name="user" >
      <br />
      <br/>
      Password:&nbsp;
      <input type="password" name="pass" >
        </span><br />
      <br/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="submit" type="submit" class="style3" value="Submit"/>
    </p>
  </div>
</form>
  
  <div align="center">
    <?php
  if(isset($_POST["submit"])){
  $user= $_POST['user'];
  $pass= $_POST['pass'];
  
  $con=mysql_connect('localhost','root','') or die(mysql_error());
  mysql_select_db('login') or die ("cannot select DB");
   
  $query = mysql_query ("Select * FROM userinformation WHERE Username='".$user."'");
  $numrows=mysql_num_rows($query);
  if ($numrows==0)
  
  {
  
  $sql="INSERT INTO userinformation(Username,Password) VALUES ('$user','$pass')";
  
  $result=mysql_query($sql);
  
  if($result){
  echo "Account Succesfully Created.  Please click LOGIN now!";
  } else {
  echo "Failure!";
  }
  
  } else {
  echo "That username already exist! Please try again with another.";
  }
  }
  
      ?>
    
  </div>
</body>
</html>
