{"id":1434,"date":"2018-01-19T19:22:50","date_gmt":"2018-01-19T19:22:50","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/check-data-page-4\/"},"modified":"2018-01-19T19:24:47","modified_gmt":"2018-01-19T19:24:47","slug":"check-data-page-4","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/check-data-page-4\/","title":{"rendered":"Check Data Page 4"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Spencer P<\/div>\n<div class=\"\">on November 3, 2000<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<h2>How To Access Your Data<\/h2>\n<div class=\"articlePara\">\nNow all your  code is cross-script proof and saving proper data.<br \/>\nTime to make your site public, right?  This is another time where you<br \/>\nshould think twice.  For example, your customers are logging into your site to use<br \/>\nyour two-click purchase (patent pending) fork-in-a-box (patent pending)<br \/>\ne-commerce site.  You do one of these for a front page:<\/div>\n<div class=\"example\">\n&lt;form method=&#8221;get&#8221; action=&#8221;account.php&#8221;&gt;<br \/>\nID: &lt;input type=&#8221;text&#8221; name=&#8221;id&#8221;&gt;<br \/>\nPassword: &lt;input type=&#8221;password&#8221; name=&#8221;password&#8221;&gt;<br \/>\n&lt;\/form&gt;\n<\/div>\n<div class=\"articlePara\">\nSee the first problem?  To submit to your account page, a URL is<br \/>\nconstructed to pass the variables, like so:<\/div>\n<div class=\"example\">\n&lt;http:\/\/www.forkinabox.com\/account.php?id=me&amp;password=ilikecheese&gt;\n<\/div>\n<div class=\"articlePara\">\nIn the worst case scenario, the password is sent in plain text, saved<br \/>\nin the browser&#8217;s history, sent to a proxy and saved in the proxy log,<br \/>\n<i>and<\/i> saved in the webserver&#8217;s access log.  Using the POST method<br \/>\nmakes things a little (not much) more secure, but someone who is<br \/>\npersistent enough can even fake a form using the POST method.<\/div>\n<div class=\"articlePara\">\nSince we are using the GET method to get the variables into PHP in the<br \/>\nprior example, anyone can try an infinite number of IDs and passwords.<br \/>\n(Microsoft suffered this one with their passport system a while back.)<br \/>\nInstead of GET, use $HTTP_POST_VARS[] for information that is vital for<br \/>\naccess or needs to be secure for other reasons.  The rest of the time<br \/>\nyou can use the GET method &#8212; most of the time a search term doesn&#8217;t<br \/>\nhave to be kept secret.<\/div>\n<div class=\"articlePara\">\nSince it is possible for someone in the network to be sniffing for<br \/>\nclear-text (non-encrypted) data, using https (SSL) will encrypt the remaining data to make<br \/>\nit more secure.  It is possible to break this kind of<br \/>\nencryption, but at present it takes someone with a <i>lot<\/i> of<br \/>\ncomputing power to decrypt your data and fake input to your forms.  [Insert<br \/>\nyour favorite conspiracy theory here.]<\/div>\n<div class=\"articlePara\">\nBut let&#8217;s say that we want to be slick and bypass PHP.  (That&#8217;s the<br \/>\nreason why we&#8217;re writing bad code, no?)  Checking with JavaScript for<br \/>\nvalid input or even a valid user and password has been done.  But then what<br \/>\nhappens when I turn off JavaScript?<\/div>\n<div class=\"articlePara\">\nDon&#8217;t depend on JavaScript for anything more important than user<br \/>\nconvenience.  You can cache data with it, make pretty things with it, use it to do<br \/>\nfast checks for invalid data, but <i>don&#8217;t depend on JavaScript to get<br \/>\nproper input to your server.<\/i>  As soon as the user turns it off,<br \/>\nyour authentication and data checking are out the door.  You can<br \/>\nspeed up the data checking and shave some processing time off the server,<br \/>\nbut, users can turn it off.  I know I do!<\/div>\n<div class=\"articlePara\">\nThis article may be in three parts,  but it has one point in mind:<br \/>\nNever trust anything that you don&#8217;t have control over.  Don&#8217;t trust the<br \/>\ninput to your functions, the data used to generate pages, nor the<br \/>\nnetwork.  This means check your input when it comes in, clean the input for<br \/>\nfurther use, and access it in a sane (and maybe even secure) fashion.<br \/>\nThe more authority you take, the less chance the user can be malicious.<\/div>\n<div class=\"articlePara\">\n&#8212; Spencer<\/div>\n<p><!-- new page end --><\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"sporty200011029ba9.html?page=3\">\u00ab Previous Page<\/a><\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"sporty20001102.html\">1<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"sporty200011024658.html?page=2\">2<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"sporty200011029ba9.html?page=3\">3<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">4<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>By Spencer P on November 3, 2000 How To Access Your Data Now all your code is cross-script proof and saving proper data. Time to make your site public, right? This is another time where you should think twice. For example, your customers are logging into your site to use&#8230; <a href=\"https:\/\/phpbuilder.com\/check-data-page-4\/\" class=\"readmore\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1434","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1434"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1434\/revisions"}],"predecessor-version":[{"id":3292,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1434\/revisions\/3292"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}