Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. $result = pg_query("INSERT INTO users VALUES('','".$username."','".md5($password)."')");
  2.  
  3. $result = pg_query($pdo, "INSERT INTO users VALUES('','".$username."','".md5($password)."')");
  4.  
  5. <?php
  6. try
  7. {
  8. $pdo = new PDO('pgsql:host=localhost; port=5432; dbname=Website', 'postgres', '');
  9. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10. }
  11.  
  12. <html>
  13. <head>
  14. <title>Register - Friend System</title>
  15. <link rel='stylesheet' href="style.css" />
  16. <head>
  17. <body>
  18. <?php include 'connect.php';?>
  19.  
  20. <?php include 'functions.php' ?>
  21.  
  22. <?php include 'header.php' ?>
  23.  
  24. <div class='container'>
  25. <h3>Register a new account</h3>
  26. <form method='post'>
  27. <?php
  28. if(isset($_POST['submit'])){
  29. $username = $_POST['username'];
  30. $password = $_POST['password'];
  31.  
  32. if(empty ($username) or empty ($password)){
  33. $message = "Fields Empty, Please re-check the form";
  34. } else {
  35. $result = pg_query("INSERT INTO users VALUES('','".$username."','".md5($password)."')");
  36. $message = "Registration completed! You can now log in!";
  37. }
  38. echo "<div class='box'>$message</div>";
  39. }
  40. ?>
  41. User Name: <br/>
  42. <input type='text' name='username' autocomplete='off' />
  43. <br/><br/>
  44. Password: <br/>
  45. <input type='password' name='password' />
  46. <br/><br/>
  47. <input type='submit' name='submit' value='Register' />
  48. </form>
  49. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement