Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- require 'database.php' ;
- $message = '' ;
- $server = 'localhost' ;
- $username = 'root';
- $password = 'root';
- $database = 'auth';
- try { $conn = new PDO("mysql:host=$server; dbname=$database;", $username,$password);
- } catch(PDOException $e){
- die("Connection failed:". $e->getMessage());
- } */
- if (!empty($_POST['email']) && !empty($_POST['password'])) {
- //if ($_POST['confirm_password']=== $_POST['password']
- $sql = "INSERT INTO users (email,password) VALUES(:email,:password) "
- $stmt = $conn->prepare($sql) ;
- $stml ->blindParam(':email',$_POST['email']);
- $stml ->blindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT ));
- if( $stmt->execute() ):
- $message = "Successfully created new account";
- else:
- $message = "Fail" ;
- }
- ?>
- <! выше идут комментарии из-за того что я на могу присоединится к базе данных >
- <!DOCTYPE html>
- <html>
- <head>
- <link href='http//fonts.googleapis.com/css?family=Comfortaa'>
- <link rel="stylesheet" type="text/css" href="Assets\Style.css">
- <meta charset="utf-8">
- <title>Register</title>
- </head>
- <body>
- <div class="header">
- <a href="Site.php">Your app name</a>
- </div>
- <?php if(!empty($message)):
- echo "$message";
- ?>
- <h2>Register</h2>
- <span> or <a href="Login.php">Login</a></span>
- <form class="" action="Register.php" method="post">
- <input type="text" name="email" placeholder="Enter Your email">
- <input type="password" name="password" placeholder="Enter Your Password">
- <input type="password" name="confirm_password" placeholder="Confirm Your Password">
- <input type="submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement