Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REGISTER.PHP:
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="main.css">
- <?php
- require('connection.php');
- // If the values are posted, insert them into the database.
- if (isset($_POST['username']) && isset($_POST['password'])){
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $query = "INSERT INTO `accounts information` (username, password, email) VALUES ('$username', '$password', '$email')";
- $result = mysql_query($query);
- if($result){
- $msg = "User Created Successfully.";
- }
- }
- ?>
- </head>
- <body>
- <div class="register-form">
- <h1>Register</h1>
- <form action="" method="POST">
- <p><label>User Name : </label>
- <input id="username" type="text" name="username" placeholder="username" /></p>
- <p><label>E-Mail : </label>
- <input id="password" type="email" name="email"/></p>
- <p><label>Password : </label>
- <input id="password" type="password" name="password" placeholder="password" /></p>
- <a class="btn" href="login.php">Login</a>
- <input class="btn register" type="submit" name="submit" value="Register" />
- </form>
- </div>
- </body>
- </html>
- MAIN.CSS:
- margin: 0 auto;
- text-align: center;
- padding: 10px;
- color: #fff;
- background : #c4c4c4;
- border-radius: 10px;
- -webkit-border-radius:10px;
- -moz-border-radius:10px;
- }
- register-form form input{padding: 5px;}
- register-form.btn{background: #726E6E;
- 15
- padding: 7px;
- 16
- border-radius: 5px;
- 17
- text-decoration: none;
- 18
- width: 50px;
- 19
- display: inline-block;
- 20
- color: #FFF;}
- register-form .register{
- 23
- border: 0;
- 24
- width: 60px;
- 25
- padding: 8px;
- 26
- }
- CONNECTION.PHP:
- <?php
- $connection = mysql_connect('localhost', 'root', 'password');
- if (!$connection){
- die("Database Connection Failed" . mysql_error());
- }
- $select_db = mysql_select_db('login.');
- if (!$select_db){
- die("Database Selection Failed" . mysql_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement