I have this written at the very first line on every page of my website.
include(\"restd.php\");
and restd.php contains the following lines
You still don't even answer where you SET $_SESSION['id']. $pid = $_SESSION['id'] does not set the session variable. session_start() comes before ANYTHING session related, it's not shown before your include.
$pid = $_SESSION['id']
session_start()