"Is there a way for php to know that this session is expired becuase the site was left and auto issue a new id or simply redirect back to the index.php page"
No. HTTP is stateless.
Only the HTTP_REFERER field gives an indication of what the user was doing before he got to your site. You could chack that to see if the referer was a link on your site or not. But, HTTP_REFERER is not a mandatory field, not all browsers have to send it, and some browsers can disable it for privacy reasons.
If you scripts get messed up if someone enters an URL manually, then your design is wrong and you should rethink your methods.