help with the WWW Class

Ok so I am making a login script that queries a database

it sends of the username and password in a WWWFORM via WWW(url, WWWForm);

how would I go about getting a return ie in php (return true; or return false;) depending on if the details are correct or not

also would this be a practical way about doing it?

Another question I guess I could ask while Im on here that companies it is, if I logged the user in like the above, and in the mysql user table have an isloggedin field which is set to 1 and every few minutes send out another www() to remind the server were still online then use a cron to run another php file every 5 minutes setting isloggedin to 0 that way itll only keep the isloggedin set to 1 if theyre actually on

(so they can log in at the same time, also potentially making a friends list?)

would the above be impractical or out of the question full stop in unity?

the database will be on a dedicated server and online gameplay will be no more than 6 players per match and the game server will be hosted via client only the lobby master server will be on our dedi box

anyway long question but hopefully someone can give me some advice or point me in the right direction!

thanks in advance

That all sounds doable.

In your php, simply echo some sort of code, eg:

(after checking db) if (user_ok) echo "ok"; else echo "no";

or use numbers or some other cryptic code if you worry about hacks.

In the www.text that comes back, you should see that "ok" or "no"

You can then periodically 'ping' the server with a keep-alive script. You might want to use a session id. In fact, you could return the session id if user is 'ok' (instead of just saying 'ok'), or 0 if not ok. Then have the periodic ping send back that session id so you can set the 'online' flag in the db.