What is and is not in $_SESSION is basically under your control. Besides using some advanced materials, such as hacking the server and editing temporary PHP storage files, the browser has no control over this.
Almost every authentication depends on setting some variable in the SESSION array to track the current user. This can be considered safe. As long as you avoid special control over the browser with statements such as:
$_SESSION['id'] = $_POST['id']
or the like.
However, the rest of the answers that never build database queries when strings are concatenated are valid. Itβs good practice to always run things through mysql_real_escape_string() , therefore, as a good programmer, you use a function / wrapper class that automates this for you, so you will never go wrong.
Marijn van vliet
source share