Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7670241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:46:37+00:00 2026-05-31T15:46:37+00:00

Hey im trying to write code for a login system, this is my first

  • 0

Hey im trying to write code for a login system, this is my first time and i used a tutorial online. The initial Javascript works fine and the errors show up when the inputs are left empty. However when i enter text in the inputs and click sign in, nothing happens. It seems to me like it is not calling the PHP file but i can’t see any reason why it wouldnt as it is referenced correctly? Any help would greatly appreciated!

<?php
    include ("Includes/dbConnect.php");
    $u=$_POST['u'];
    $p=$_POST['p'];

    //Strip slashes
    $u = stripslashes($u);
    $p = stripslashes($p);

    //Strip tags 
    $u = strip_tags($u);
    $p = strip_tags($p);


    $check = mysqli_query("SELECT * FROM Login WHERE login_user ='$u' AND login_pass='$p'")      or die(mysqli_error());
    $check = mysqli_num_rows($check);
    if($check !=="0"){
    $results = mysqli_query("SELECT * FROM Login WHERE login_user = '$u'") or die(mysqli_error());
        while ($row = mysqli_fetch_assoc($results)) {
            $login_user=$row['login_user'];
            session_register('login_user');
            $_SESSION['login_user'] = $Login_user;
            echo "1";
    }
    }
?>

and here’s the javascript

<script type="text/javascript">
    $(document).ready(function () {
        $(".sign_b_btn").live("click", function () {
            var u = $("#u").val();
            var p = $("#p").val();

            if (u == "") {
                $("#u").css("border-color", "red");
                $("#un").css("color", "red");
                $(".error").show().html("Please enter your username!");
                $("#p").css("border-color", "#606060");
                $("#up").css("color", "#333333");
            } else if (p == "") {
                $("#u").css("border-color", "#606060");
                $("#un").css("color", "#606060");
                $(".error").show().html("Please enter your Password!");
                $("#p").css("border-color", "red");
                $("#up").css("color", "red");
            } else {

                dataString = 'u=' + u + '&p=' + p;
                $.ajax({
                    type: "POST",
                    url: "Ajax/login_php.php",
                    data: dataString,
                    cache: false,
                    success: function (html) {
                        if (html == "") {
                            $(".error").show().html("The username or password you entered is incorrect!");
                            $("#p,#u").css("border-color", "red");
                            $("#up,#un").css("color", "red");
                        } else if (html == "1") {
                            $(".error").fadeOut(1000);
                            $("#u").css("border-color", "#606060");
                            $("#un").css("color", "#333333");
                            $("#p").css("border-color", "#606060");
                            $("#up").css("color", "#333333");
                            $(".center").animate({
                                opacity: 0.25,
                                left: '+=900',
                                height: 'toggle'
                            }, 5000, function () {
                                $(".done").slideDown(200).html("Welcome " + u);
                                setTimeout(function () {
                                    var u = $("#u").val("");
                                    var p = $("#p").val("");
                                    window.location = "index.php";
                                }, 5000);
                            });
                        }
                    }
                });
            }
        });
    });
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:46:39+00:00Added an answer on May 31, 2026 at 3:46 pm

    Answer to your session problem:

    edit your php code so that your script starts off with a call to session_start();

    eg:

    <?php session_start();
     //rest of your php code
    

    replace the lines :

    session_register('login_user');
    $_SESSION['login_user'] = $Login_user;
    

    with:

    $_SESSION['login_user'] = $Login_user;
    

    You were getting the error that you mentioned because the function session_register(); has been deprecated in PHP version 5.3.0 and REMOVED from PHP version 5.4.0. $_SESSION is a global array that is available for you after session_start(); call.

    Happy programming 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone i am trying to write this code and I am having problems
Hey i'm just trying to write some code in DrScheme: ((function (x) (* x
Hey guys, I have a problem (again). This time I am trying to use
Hey, I am trying to write a command to print todays date on the
Hey there. I'm trying to write a small program that will read the four
Hey I'm new to java servlets and I am trying to write one that
Hey guys i am trying to automate my system at work for sending artwork
Hey all i am trying to figiure out why my code is not triggering
edited. Hey, I am trying to write an NSMutableArray to a plist. The compiler
Hey, I currently am having trouble trying to get this to work. Here's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.