За последние 24 часа нас посетил 22761 программист и 1208 роботов. Сейчас ищут 742 программиста ...

В чем проблема? Регистрация!

Тема в разделе "Сделайте за меня", создана пользователем Finn, 21 май 2019.

  1. Finn

    Finn Новичок

    С нами с:
    21 май 2019
    Сообщения:
    5
    Симпатии:
    0
    <?php
    $db = mysqli_connect("localhost" , "root" , "" , "reg") or die ("DataBase Erorr");
    ?>
    <!DOCTYPE html>
    <html lang="ru">
    <head>
    <title>Instagram</title>
    <meta charset="utf-8">
    <style type="text/css">
    </style>
    </head>
    <body>
    <?php
    if(!isset($_POST['send'])){
    ?>
    <div class="container">
    <form action="register.php" method="post">
    <input type="text" name="login" placeholder="Put ur login">
    <input type="password" name="password" placeholder="Put ur password">
    <input type="submit" name="send" value="Registration">
    </form>
    <?php
    }
    if (isset($_POST['send']) && !empty($_POST['login']) && !empty($_POST['password'])){
    $queryL = "select id from reg WHERE login = '".$_POST['login']."'";
    $resL = mysqli_query($db , $queryL) or die ("Server Error #1");
    if(mysqli_num_rows($resL)>0){
    echo "This login already used!";
    }
    else{
    $query = "insert into reg(login, password) VALUES ('".$_POST['login']."', SHA1('".$_POST['password']."'))";
    }
    mysqli_query($db, $query) or die ("Server Error #2");
    echo("Reg is success!");
    }
    else{
    echo "Reg is fail, try again!";
    }
    mysqli_close($db);
    ?>
    </div>
    </body>
    </html>