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 7818887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:43:48+00:00 2026-06-02T06:43:48+00:00

Well guys, with the following code: $(document).ready(function() { $(.list-book-description).css(display, none); $(#user-panel-login).css(display, none); $(‘#login-form’).submit(function(e) {

  • 0

Well guys, with the following code:

$(document).ready(function() {
    $(".list-book-description").css("display", "none");
    $("#user-panel-login").css("display", "none");
    $('#login-form').submit(function(e) {
        e.preventDefault();
        var formUsername=$("#login-form #username").val();
        var formPassword=$("#login-form #password").val();
        if((formUsername.length<6))
        {
        $("#ajax-output").html("<div class='error'>Attenzione username troppo breve!</div>");
        }
        else if((formPassword.length<6))
        {
            $("#ajax-output").html("<div class='error'>Attenzione password troppo breve!</div>");
         }
    else
    {
        $.post(
            'index.php?module=login',
            {
                "username": formUsername,
                "password": formPassword,
            },
            function(data){
                $("#ajax-output").html(data);
            }
        );
    }
});
});

i tried to pass to ?index.php&module=login&function=1 username and password got by #login-form fields #username & #password to login() php function that uses setLogin(); function if data is into database to set a login session.

function Login()
 {
 if(!checkLogin())
    {
    $function=@stringEscape($_GET['function']);

    if($function==1)
    {
        $username=stringEscape($_POST['username']);
        $password=sha1(stringCrypt($_POST['password'], 'sha1').stringCrypt(DB_CRYPT, 'sha1'));
        if(setLogin($username, $password))
        {
            echo "<div class='ok'>Login effettuato con successo, tra pochi secondi verrai riportato alla homepage!</div>";
        }   
    }
}
else notfound();
}

function setLogin($username, $password, $time="")
{
if(!checkLogin())
{
    if((isset($username)) && (isset($password)))
    {
        $query=mysql_query("SELECT * FROM ".DB_PREF."users WHERE user_username='".$username."' AND user_password='".$password."'");
        if(mysql_num_rows($query))
        {
            $fetch=mysql_fetch_assoc($query);
            $_SESSION['logged_user_id']=$fetch['user_id'];
            $_SESSION['logged_user_username']=$fetch['user_username'];
            return true;
        }
        else
        {
            echo "<div class='error'>Dati non validi, ripeti la procedura di login o <a href='?index.php&module=registration'>registrati</a>!</div>";
        }
    }
}
else notfound();
}

Now i’ve a problem when i get the result of $.post() in my #ajax-input div submitting the login form, it doesn’t return just the result of login function, but the index page+login function result.

If i try to set “json” parameter into $.post function and echo json_encode() in php function it doesn’t work at all. So, what could be the problem?

  • 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-06-02T06:43:49+00:00Added an answer on June 2, 2026 at 6:43 am

    you make a request for a full page here, I think.you could make a parameter, post or get, you decide, and if that is for example true, then you return the full page, and he it’s false you only return a JSON string or something like that. I believe it is even possible to determine if the request is from ajax or not! That could be your second option. Just add a simple if-statement, I think.

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

Sidebar

Related Questions

Well I am using the following code to take any old image into a
Well guys, I'm trying to get that MongoDB feature working for hours: http://www.mongodb.org/display/DOCS/Http+Interface I
Well guys, I have three tables here, menu, user and access. For simplifying let's
hi all i need some help from you guys.. well here's the description Guys
Hey guys i am building a geolocation application. The following is the code which
jQuery(document).ready(function(){ jQuery('.breadcrumbs').text(function (i, old) { return old .replace('Your-Space', 'Your Space') }); }); I have
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Guys I'm new to xml in Java. I have the following task. I need
I have the following code. I want to get hold of the outer class
Hi guys got a wired problem (well I find it a wired problem :P)

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.