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!
Who is Participating?
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!";


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.