Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ($_SERVER['REQUEST_METHOD'] === 'GET') { ?>
- <!DOCTYPE HTML>
- <head>
- <title>Email Registration Form</title>
- <style>
- li {list-style: none;}
- </style>
- <link rel="stylesheet" href="form.css" type="text/css" />
- </head>
- <body>
- <h2>Enter details regarding your email creation</h2>
- <ul>
- function validateform() {
- var e = document.forms["insert"]["email"].value;
- if (e == "") {
- alert("Email field is empty");
- return false;
- }
- var n = document.forms["insert"]["Password"].value;
- if (n == "") {
- alert("Password cannot be blank");
- return false;
- }
- var rn = document.forms["insert"]["realname"].value;
- if (rn == "") {
- alert("Please enter your name");
- return false;
- }
- <form name="insert" action="register.php" onsubmit="return validateForm()" method="POST" >
- <li>Email:</li><li><input type="text" name="email" placeholder="example@darkorderofchaos.com" /></li>
- <li>Password:</li><li><input type="text" name="password" placeholder="Password" /></li>
- <li>Name:</li><li><input type="text" name="realname" placeholder="John Doe" /></li>
- <li><input type="submit" value="Create Email" /></li>
- <input type="reset" value="Reset Form">
- </form>
- </ul>
- </body>
- </html>
- <?php } else
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $db = pg_connect("host=localhost port=5432 dbname=mail user=mailreader password=**********") or die('pg_last_error()');
- $result = pg_query_params($db, "insert into users(email, password, realname, maildir) values ($1,$2,$3,$1 || '/')",
- array($_POST["email"], hash('SHA512',$_POST["password"]), $_POST["realname"]));
- print($result);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement