if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile)) && $_SERVER['REQUEST_URI'] != "login" || "thankyou" || "confirm")
Should this code work, operators wise and syntax wise?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This part won’t work as you (probably) want:
Firstly,
REQUEST_URIwill never be equal to any of these values – it will have at least an additional/. If your script is namedtest.php, REQUEST_URI will contain at least/test.php(see below what else it might contain). Take a look at theREQUEST_URIvariable to see how it is structured.Also,
REQUEST_URIis treacherous here: it will contain any additional query strings so it will be possible to confuse the comparison by adding an arbitrary?name=valueto the URL.Do a
phpinfo()to find something more fitting than REQUEST_URI, e.g.SCRIPT_NAME.Secondly, the “or” operations you are doing will be applied to the values before the comparison is done.
You probably want something like this: