Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_SESSION['user'])!="")
- {
- header("Location: http://www.skolahysing.com/nemendur/tindur/gso300/verkefni5/normal/index.php");
- }
- include_once $_SERVER['DOCUMENT_ROOT']. '/nemendur/tindur/include/db.inc.php';
- if (isset($_POST['btn-signup']))
- {
- $securepass = password_hash($_POST['pass'],PASSWORD_DEFAULT);
- try
- {
- $sql ='INSERT INTO users SET
- username = :uname,
- email =:email,
- password = :upass';
- $s = $pdo->prepare($sql);
- $s->bindValue(':uname', $_POST['uname']);
- $s->bindValue(':email', $_POST['email']);
- $s->bindValue(':upass', $securepass);
- $s->execute();
- }
- catch (PDOException $e)
- {
- $error = 'Error adding registering user.' . $e->getMessage();
- include $_SERVER['DOCUMENT_ROOT'] . '/nemendur/tindur/gso300/verkefni5/login/error.html.php';
- exit();
- }
- header('Location: . ');
- exit();
- }
- include 'register.html.php';
- ?>
- <!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=utf-8" />
- <title>Login & Registration System</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
- </head>
- <body>
- <center>
- <div id="login-form">
- <form method="post">
- <table align="center" width="30%" border="0">
- <tr>
- <td><input type="text" name="uname" placeholder="User Name" required /></td>
- </tr>
- <tr>
- <td><input type="email" name="email" placeholder="Your Email" required /></td>
- </tr>
- <tr>
- <td><input type="password" name="pass" placeholder="Your Password" required /></td>
- </tr>
- <tr>
- <td><button type="submit" name="btn-signup">Sign Me Up</button></td>
- </tr>
- <tr>
- <td><a href="../login/index.php">Sign In Here</a></td>
- </tr>
- </table>
- </form>
- </div>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement