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

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!
tunhienAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian BushSolutions ArchitectCommented:
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!";
}

?>

--brian

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.