How can server side understand an AJAX request is sent from whom!

Posted on 2006-03-25
Last Modified: 2012-08-13
As I asked above if I have a site alow user login and can be login multi user on a computer (it's mean that don't use cookie) and when I send request to server site file "respond.php" if I'm a loged in user then respond the text: "You're login!" if not respond "Sorry! you have to login before!"

Thanks for your read and waiting for your guide!
Question by:tunhien
    1 Comment
    LVL 6

    Accepted Solution

    When a user is succesfully authenticated,
    you can set a SESSION variable and use it
    to verify login status.

    <?php session_start();

    $_user = login($user); // where login is a user defined method to authenticate and returns username on success

    if ($_user) {
        $_SESSION["login"] = $_user;
    } else {
        $_SESSION["login"] = "";

    Then on any page that you want to verify login status:
    <?php session_start();

    if ($_SESSION["login"]) {
        echo "You are logged in!";
    } else {
        echo "Sorry! You must login first!";



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to dynamically set the form action using jQuery.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now