I have three questions :
1) How to execuse an SQL query when a user clicks a specific link
2) How can i execuse an SQL query upon broswer window close
2) When a users logs into his page .. an attribute in his credentials record (named "logged" ) is changed to 1 to indicate that he's logged in now, what i need to do .. is to restrict access to all other pages based on the value of this attribute ..
in other words ..
When a user opens any page, do the following
SLELECT Logged FROM Credenials
Where id = $loginusername
If logged = 1
then Open page
If logged = 0
then go to Log-in.php