{"id":205,"date":"2007-02-21T01:39:59","date_gmt":"2007-02-21T06:39:59","guid":{"rendered":"http:\/\/journal2.alanv.org\/?p=205"},"modified":"2012-10-09T21:40:18","modified_gmt":"2012-10-10T01:40:18","slug":"accomplished","status":"publish","type":"post","link":"https:\/\/journal2.alanv.org\/?p=205","title":{"rendered":"Accomplished!"},"content":{"rendered":"<p>I&#8217;ve spent the past 5 hours pounding my head against the desk trying to self-teach myself everything about PHP sessions, objects, and MySQL accesses all at the same time by building the login\/registration portion of my webapps final project. But hey, it was all worth it, because I understand them now!<\/p>\n<p>The more I do webapps stuff, the more I think this is what I want to do with my life. I can&#8217;t identify what it is about writing PHP (or, to a certain extent, JSP or Java Servlet) code that is so addicting&#8230; but once I start, I just can&#8217;t stop. I can&#8217;t tell you how many times I&#8217;ve found myself sitting at my computer until $late_hour writing webapp code&#8230; and that rarely happens with any other kind of program.<\/p>\n<p>So yeah, I spent a while trying to fix mistakes that came about from misunderstandings about PHP (trying to teach yourself 3 new things at once doesn&#8217;t make it easier to learn any one of them)&#8230;<br \/>\n-The header() function doesn&#8217;t automatically dispatch. You must call exit afterwards if you want to immediately dispatch the headers (ex: redirect to a new page).<br \/>\n-Starting a session (with session_start()) automatically calls in all saved session variables, overriding any existing variables. I couldn&#8217;t figure out why the hell $username was being overridden until I realized I hadn&#8217;t lost my previous session (which contained a duplicate $username variable), and it was loading the variables.<br \/>\n-You cannot use session_unset() if you set variables through $_SESSION<br \/>\n-If a function returns either an object or false, you cannot do testing with !$variable, you must do $variable!=false (but you can do that with functions that return either true or false).<br \/>\n-Defining things with define() in an if statement doesn&#8217;t carry over into the global scope (although this problem might have stemmed from one of the previous misunderstandings).<br \/>\n-The general hash() and hash_hmac() functions are only in PHP5, and my server only has PHP4.<br \/>\nBut hey, I got everything working&#8230; now I can start on the fun part.<\/p>\n<p>I really should be asleep given that I have class tomorrow at 7:30 followed by an exam. Blah at that.<\/p>\n<p>It&#8217;s a Todd! For some reason I like this picture a lot.<br \/>\n<img decoding=\"async\" src=\"http:\/\/journal2.alanv.org\/images\/todd2.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent the past 5 hours pounding my head against the desk trying to self-teach myself everything about PHP sessions, objects, and MySQL accesses all at the same time by building the login\/registration portion of my webapps final project. But &hellip; <a href=\"https:\/\/journal2.alanv.org\/?p=205\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=205"}],"version-history":[{"count":0,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions"}],"wp:attachment":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}