{"id":96,"date":"2008-07-28T11:11:28","date_gmt":"2008-07-28T15:11:28","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=96"},"modified":"2008-07-28T15:59:15","modified_gmt":"2008-07-28T19:59:15","slug":"php-web","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=96","title":{"rendered":"PHP Web"},"content":{"rendered":"<p>PHP Web<\/p>\n<p>\u00a7EGPCS Variables<\/p>\n<pre lang=\"php\">$HTTP_ENV_VARS\r\n$_ENV\r\n\r\n$HTT_GET_VARS\r\n$_GET\r\n\r\n$HTTP_POST_VARS\r\n$_POST\r\n\r\n$HTTP_POST_FILES\r\n$_FILES\r\n\r\n$HTTP_COOKIE_VARS\r\n$_COOKIE\r\n\r\n$HTTP_SERVER_VARS\r\n$_SERVER\r\n\r\n$_REQUEST \r\n\/\/when register_globals is on\r\n$_GET + $_POST + $_COOKIE\r\n\r\n$PHP_SELF\r\n<\/pre>\n<p>\u00a7Processinq Forms<br \/>\n\u2022Autoquotinq parameters<br \/>\n-set magic_quotes_qpc to true<\/p>\n<pre lang=\"php\">$value=init_get('magic_quotes_gpc') ? \r\nstripslashes($_GET['param']) : $_GET['param'];<\/pre>\n<p>\u2022Self processing<\/p>\n<pre lang=\"html\"><form action=\"<?php echo $_SERVER['PHP_SELF'] ?>\" \r\n  method=\"POST\"><\/pre>\n<p>\u2022Multivalued parameters<\/p>\n<pre lang=\"html\"><select name=\"language[]\"><\/pre>\n<p>\u2022File upload<br \/>\n-file limits<br \/>\nhard limit: upload_max_filesize<br \/>\nsoft limit: <\/p>\n<pre lang=\"html\"><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10240\"><\/pre>\n<p>-form<\/p>\n<pre lang=\"html\"><form enctype=\"multipart\/form-data\" action=\"<?= PHP_SELF ?>\" \r\n  method=\"POST\"><\/pre>\n<p>-Process<\/p>\n<pre lang=\"php\">if (is_uploaded_file( $_FILES['toProcess']['tmp_name']) {\r\n\t\/\/success\r\n}<\/pre>\n<p>\u2022Redirection<\/p>\n<pre lang=\"php\"><?php\r\nheader('location: http:\/\/url\/f.html');\r\nexit();\r\n?>\r\nor:\r\n<?php\r\necho \"<script>document.location.href='news.php'<\/script>\";\r\n?><\/pre>\n<p>\u2022Authentication<\/p>\n<pre lang=\"php\">$_SERVER['PHP_AUTH_USER'];\r\n$_SERVER['PHP_AUTH_PW'];<\/pre>\n<p>\u2022Cookie<\/p>\n<pre lang=\"php\"><?php\r\n$page_accesses=$_COOKIE['access'];\r\nsetcookie('accesses', ++$page_accesses);\r\n?><\/pre>\n<p>\u2022Sessions<\/p>\n<p>See <a href=\"http:\/\/www.php.net\/session\">PHP Manual<\/a><\/p>\n<pre lang=\"php\"><?php\r\n\r\nUse auto start\r\n-In php.ini set\r\nsession.auto_start = 1\r\n\r\nOtherwise use\r\nsession_start(); \r\n\/\/ This has to be the first line of the page\r\n\/\/ Unless you store object in the session \r\n\/\/ in which case, you need to include the class first.\r\n\r\nif (empty($_SESSION['count'])) {\r\n $_SESSION['count'] = 1;\r\n} else {\r\n $_SESSION['count']++;\r\n}\r\n?>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP Web \u00a7EGPCS Variables $HTTP_ENV_VARS $_ENV $HTT_GET_VARS $_GET $HTTP_POST_VARS $_POST $HTTP_POST_FILES $_FILES $HTTP_COOKIE_VARS $_COOKIE $HTTP_SERVER_VARS $_SERVER $_REQUEST \/\/when register_globals is on $_GET + $_POST + $_COOKIE $PHP_SELF \u00a7Processinq Forms \u2022Autoquotinq parameters -set magic_quotes_qpc to true $value=init_get(&#8216;magic_quotes_gpc&#8217;) ? stripslashes($_GET[&#8216;param&#8217;]) : $_GET[&#8216;param&#8217;]; &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=96\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[20],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-php"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1y","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":0,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}