Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function registerusers(){
- $username =$_POST['username'];
- $password =$_POST['password'];
- $error = "Your Login Name or Password is invalid";
- echo "$username";
- $sql = "SELECT id FROM users WHERE username = '$username' and password = '$password'";
- $result = mysqli_query($conn,$sql);
- $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
- $count = mysqli_num_rows($result);
- if($count == 1) {
- ?>
- <script type="text/javascript">
- $("div#ack").html("Successfully");
- </script>
- <?php
- }else {
- ?>
- <script type="text/javascript">
- $("div#ack").html("Invalid user and password");
- </script>
- <?php
- }
- }
- registerusers()
- $("button#submit").click( function() {
- if( $("#username").val() == "" || $("#password").val() == "" ){
- $("div#ack").html("Please enter both username and password");
- }else{
- $.post( $("#myForm").attr("action"),
- $("#myForm :input").serializeArray(),
- function(data) {
- $("div#ack").html(data);
- });
- $("#myForm").submit( function() {
- return false;
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement