2017-04-13 16 views
0

登録ユーザーのみがログインできるログインページを作成しようとしています。私は次のコードを試してみましたが、うまくいきません。私は私のストアドプロシージャと私のログインページコードを述べました。ログインページから登録ユーザーのみを受け入れる方法

create procedure cp(in username,in password,out yes_no) 
    BEGIN 
    SELECT count(*) INTO yes_no 
    FROM user1 u 
    WHERE u.USERNAME = username && u.PWD = password_p;   
    END 

<body> 

<h2>Login Form</h2> 

<form action="/action_page.php"> 


    <div class="container"> 
    <label><b>Username</b></label> 
    <input type="text" placeholder="Enter Username" name="uname" required> 

    <label><b>Password</b></label> 
    <input type="password" placeholder="Enter Password" name="psw" required> 

    <button type="submit">Login</button> 
    <input type="checkbox" checked="checked"> Remember me 
    </div> 

    <div class="container" style="background-color:#f1f1f1"> 
    <button type="button" class="cancelbtn">Cancel</button> 
    <span class="psw">Forgot <a href="#">password?</a></span> 
    </div> 
</form> 

</body> 
</html> 
<?php 
$connection = mysqli_connect("localhost", "root", "", "seb"); 
$result = mysqli_query($connection, 
"CALL cp") or die("Query fail: " . mysqli_error()); 

?> 

答えて

0

私は、最初の基本的な概念を理解しようとするストアドプロシージャ

ニキルを使用してログインページの検証を追加します。 Stored Procedureは、データを検証するためのものではなく、これを処理できるサーバー側のスクリプトです。これらの値を使用してストアドプロシージャを呼び出すと、ユーザーが入力した値を取得できるように、サーバーサイドスクリプトを作成し、有効な場合は別のルールで検証します。

関連する問題