Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $result = pg_query("INSERT INTO users VALUES('','".$username."','".md5($password)."')");
- $result = pg_query($pdo, "INSERT INTO users VALUES('','".$username."','".md5($password)."')");
- <?php
- try
- {
- $pdo = new PDO('pgsql:host=localhost; port=5432; dbname=Website', 'postgres', '');
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
- <html>
- <head>
- <title>Register - Friend System</title>
- <link rel='stylesheet' href="style.css" />
- <head>
- <body>
- <?php include 'connect.php';?>
- <?php include 'functions.php' ?>
- <?php include 'header.php' ?>
- <div class='container'>
- <h3>Register a new account</h3>
- <form method='post'>
- <?php
- if(isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- if(empty ($username) or empty ($password)){
- $message = "Fields Empty, Please re-check the form";
- } else {
- $result = pg_query("INSERT INTO users VALUES('','".$username."','".md5($password)."')");
- $message = "Registration completed! You can now log in!";
- }
- echo "<div class='box'>$message</div>";
- }
- ?>
- User Name: <br/>
- <input type='text' name='username' autocomplete='off' />
- <br/><br/>
- Password: <br/>
- <input type='password' name='password' />
- <br/><br/>
- <input type='submit' name='submit' value='Register' />
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement