server-side

What is the difference between client-side and server-side programming?

吃可爱长大的小学妹 提交于 2019-11-25 21:29:29
问题 I have this code: <script type=\"text/javascript\"> var foo = \'bar\'; <?php file_put_contents(\'foo.txt\', \' + foo + \'); ?> var baz = <?php echo 42; ?>; alert(baz); </script> Why does this not write \"bar\" into my text file, but alerts \"42\"? NB: Earlier revisions of this question were explicitly about PHP on the server and JavaScript on the client. The essential nature of the problem and solutions is the same for any pair of languages when one is running on the client and the other on

How to detect server-side whether cookies are disabled

扶醉桌前 提交于 2019-11-25 18:51:45
How can I detect on the server (server-side) whether cookies in the browser are disabled? Is it possible? Detailed explanation: I am processing an HTTP request on the server. I want to set a cookie via the Set-Cookie header. I need to know at that time whether the cookie will be set by the client browser or my request to set the cookie will be ignored. Send a redirect response with the cookie set; when processing the (special) redirected URL test for the cookie - if it's there redirect to normal processing, otherwise redirect to an error state. Note that this can only tell you the browser