Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(empty($pr)){
- if(isset($_GET['login']) && isset($_GET['password']) && $_GET['password'] == $_GET['confirm']){
- header("Location: index.php");
- }};
- ?>
- <form action = "" method = "GET">
- <input name="login" placeholder="Login"></br>
- <input type="password" name="password" placeholder="Password"></br>
- <input type="password" name="confirm" placeholder="Confirm pass"></br>
- <input type="date" name="date" placeholder="Birthday"></br>
- <input type="email" name="email" placeholder="Email"></br>
- <input type="submit">
- </form>
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "root";
- $name = "test";
- $link = mysqli_connect($host,$user,$pass,$name);
- if (!empty($_GET['login']) and !empty($_GET['password']) and $_GET['password'] == $_GET['confirm']){
- $conf = $_GET['confirm'];
- $login = $_GET['login'];
- $pass = $_GET['password'];
- $email = $_GET['email'];
- $birt = $_GET['date'];
- $today = date('Y-m-d');
- $qu = "SELECT * FROM users WHERE login='$login'";
- $res = mysqli_query($link,$qu);
- $pr = mysqli_fetch_assoc($res);
- if(empty($pr)){
- $query = "INSERT INTO users SET login='$login',password='$pass',Email='$email',birthday='$birt',today='$today'";
- $_SESSION['auto'] = true;
- mysqli_query($link,$query);
- $id = mysqli_insert_id($link);
- $_SESSION['id'] = $id;
- } else {
- echo "Логин занят";
- }
- } else {
- echo "Пароли не совпдаюат";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement