PineSmokes Posted November 24, 2015 Share Posted November 24, 2015 Trying to simplify my code to something like: if($_SESSION['url'] != 'http://www.golden-wand.com/Pages/admin.php'||'http://www.golden-wand.com/Pages/admin-test.php') This is what works that I would like simplified: <!---------------------------------- ADMIN FUNCTIONS START -------------------------------> <?php if($_SESSION['admin']=='1'){ if($_SESSION['url'] != 'http://www.golden-wand.com/Pages/admin.php'){ if($_SESSION['url'] != 'http://www.golden-wand.com/Pages/admin-test.php'){ ?> <input type="button" value="Admin Page" class="button hvr-wobble-skew" onclick="location.href='http://www.golden-wand.com/Pages/admin.php'"> <?php }}} ?> <!----------------------------------- ADMIN FUNCTIONS END --------------------------------> Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted November 24, 2015 Share Posted November 24, 2015 if you want to test if a value is (or is not) one of several choices, define the different choices as elements in an array and use in_array() or !in_array() to perform the test. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 24, 2015 Share Posted November 24, 2015 if you want to test if a value is (or is not) one of several choices, define the different choices as elements in an array and use in_array() or !in_array() to perform the test.  Absolutely, separate the data from the logic. That way you can change the values being checked without ever having to change the actual code.   <?php  //List of admin urls - this can be defined elsewhere $admin_urls = array('http://www.golden-wand.com/Pages/admin.php', 'http://www.golden-wand.com/Pages/admin-test.php');  //One simple if() condition if($_SESSION['admin']=='1' && in_array(strtolower($_SESSION['url']), $admin_urls)) {   echo "<input type=\"button\" value=\"Admin Page\" class=\"button hvr-wobble-skew\" onclick=\"location.href='http://www.golden-wand.com/Pages/admin.php'\">\n"; }  ?> 1 Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 To be simple this is less lines and less work in my opinion but I did get the answer from you so thanks, I wasn't thinking about putting them inside parenthesizes that solved everything. Â Took a second to realize how to make it more simple than setting an array like I've seen in some posts or if that's what you meant exactly then you should have copied my code and corrected it because I wasn't sure exactly what you meant. Â It would be nice for anyone who saw this post in the future to also see the complete answer so they don't have to figure it out themselves. Â I'll like your answer but for best answer please simply add the code so I feel like the answer is complete: if($_SESSION['url'] != ('http://www.golden-wand.com/Pages/admin.php'xor'http://www.golden-wand.com/Pages/admin-test.php')) {} Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 (edited) Ended up needing to change the xor to || I guess it wasn't working and I thought it was if($_SESSION['url'] != ('http://www.golden-wand.com/Pages/admin.php'||'http://www.golden-wand.com/Pages/admin-test.php')){} Edit: And now I feel silly cuz it's still not working properly but it's working when I'm using == at the top of the page with the xor, but not down here with the != Edited November 24, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
Solution Psycho Posted November 24, 2015 Solution Share Posted November 24, 2015 (edited)   . . .  you should have copied my code and corrected it because I wasn't sure exactly what you meant.  It would be nice for anyone who saw this post in the future to also see the complete answer so they don't have to figure it out themselves.  I'll like your answer but for best answer please simply add the code so I feel like the answer is complete:  I gave you a complete, correct answer. But, since you apparently didn't understand it you dismissed it. What you are trying to do (include the URLs in the conditional logic) is a poor implementation. If you ever need to add/edit/remove any of the URLs used for this purpose you would need to modify the logic. Instead, I gave you a solution that allows you to modify the conditions (i.e. the URLs) without ever having to touch the logic. All you would ever need to do is modify the array "$admin_urls" to add/edit/delete any URLs you want used for the conditional check and the logic will work.  And simple does not mean less lines of code - it typically means more lines. I can cram a whole bunch of conditions, loops, whatever onto a single line. That makes it more complicated to read, debug, edit. A simple solution is one that removes complexity. Usually it means each line of code has a specific purpose.  EDIT: The only flaw I see in what I provided was that I read the logic as wanting to see if the session value was in the list of tested URLs. I now see that you wanted to verify it was not in that list of values. Simple enough change  //List of admin urls to test for $admin_urls = array('http://www.golden-wand.com/Pages/admin.php', 'http://www.golden-wand.com/Pages/admin-test.php');  //One simple if() condition if($_SESSION['admin']=='1' && !in_array(strtolower($_SESSION['url']), $admin_urls)) {   echo "<input type=\"button\" value=\"Admin Page\" class=\"button hvr-wobble-skew\" onclick=\"location.href='http://www.golden-wand.com/Pages/admin.php'\">\n"; } Edited November 24, 2015 by Psycho 1 Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 (edited) You can see I got confused, if you completed the code there wouldn't be anything to get confused about sorry if I'm asking too much but it's the simple things that seem to confuse me.  I did learn a few things from you, like the fact that it's easier to edit/add/delete data by doing what you stated.  The problem is I had not fully understood the array part yet, I did try it but I failed.  Is this the page with all the info regarding your answer?  I've been there and I'm doing something wrong with this code.  http://php.net/manual/en/language.operators.array.php  Took me a bit almost asked another question but here it is now it's working I wasn't using in_array(): $a = array("email1", "email2", "email3"); if(in_array($_SESSION['email'], $a)) { echo "Success"; } Edited November 24, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 Wow, see how much adding code helps? Â Holly crap, you solved something I've been DYING to know XD Â Totally not even part of my question but you NAILED IT I'm so happy now cuz by you showing me my button echoed out in php form not in html form I am now able to add all this to the top of the page where it should be $msg.="<input type=\"button\" value=\"Admin Page\" class=\"button hvr-wobble-skew\" onclick=\"location.href='http://www.golden-wand.com/Pages/admin.php'\">\n"; I was never able to add my button to a variable until NOW Â Every time I did it I would lose the onclick ability but now I see all I needed to do was to use a \ before the double quotes making it \" so happy you solved both problems, thanks again. Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 (edited) Why the strtolower on only the first variable $_SESSION['url']? What if the admin url's ever had a capital in them wouldn't it stop working? Â I understand if I'm just supposed to know to not put capitals but isn't it just a little more fool proof to do this or am I incorrect? if($_SESSION['admin']=='1' && !in_array(strtolower($_SESSION['url']), strtolower($admin_urls))) if($_SESSION['admin']=='1' && !in_array(strtolower($_SESSION['url']), $admin_urls)) Â You're answer is amazing Edited November 24, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 24, 2015 Share Posted November 24, 2015 Why the strtolower on only the first variable $_SESSION['url']? What if the admin url's ever had a capital in them wouldn't it stop working?  I understand if I'm just supposed to know to not put capitals but isn't it just a little more fool proof to do this or am I incorrect?  I put the strtolower() specifically because of a different post you made a day or two ago around this same code where you have a condition check where the values being compared had a difference in the case of one letter. You can prevent those problems from ever happening again if you:  1) create the array of values to validate against in all lower case. 2) use the strtolower() on the value being tested  However, I did make a mistake because I did not follow #1 above in the example code I provided. As my signature states, I do not always test the code I provide (especially if it would require me to create DB tables and add data) - it is provided as a guide for writing your own code. It should have been  //List of admin urls to test for $admin_urls = array('http://www.golden-wand.com/pages/admin.php', 'http://www.golden-wand.com/pages/admin-test.php');  Unless there are legitimate reasons, you should generally not have logic that is dependent upon the 'case' of the letters within strings. By forcing things to upper or lower case you will prevent a lot of potential bugs Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 25, 2015 Author Share Posted November 25, 2015 So does strtolower() lower case everything in the whole line making my command not only unnecessary but it causes an error. Â Does it lowercase both variables? It seems to have the first variable in parenthesize which seems like it would only do the one. Â I'm going to test this a bit later but while it was on my mind I wanted to post and ask for clarification. What I wrote is wrong: if($_SESSION['admin']=='1' && !in_array(strtolower($_SESSION['url']), strtolower($admin_urls))) //List of admin urls to test for $admin_urls = array('http://www.golden-wand.com/pages/admin.php', 'http://www.golden-wand.com/pages/admin-test.php'); Unless there are legitimate reasons, you should generally not have logic that is dependent upon the 'case' of the letters within strings. By forcing things to upper or lower case you will prevent a lot of potential bugs Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted November 25, 2015 Share Posted November 25, 2015 The strtolower() function expects a single ASCII-encoded string. You cannot apply it to an array (but you can use array_map() to apply a function to every element of an array). Â But why would you even want to make your array elements all-lowercase whenever you access the array? You should already store them this way. Simply write down the URLs with lowercase characters. 1 Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 25, 2015 Share Posted November 25, 2015 Step 1: Create an array of values to be compared against. This can be set at the top of the script, in an external file or even in a database. The key takeaway is that this is DATA and should be separated from the LOGIC. Since we don't want to have to worry about string values not comparing because of an errant character in a different case, the values should be create in a specific case (lower or upper):   /List of admin urls to test for $admin_urls = array('http://www.golden-wand.com/pages/admin.php', 'http://www.golden-wand.com/pages/admin-test.php');  Step 2: The condition:    if(   $_SESSION['admin']=='1'   &&   !in_array(   strtolower($_SESSION['url']),  $admin_urls   )  )  Comparisons work similar to mathematical order of operations: left to right with items in parenthesis worked inside out. The process is run to return an ultimate TRUE or FALSE response.  1. The first test checks to see if the session 'admin' value is 'loosely' equal to the string value '1' and results in a TRUE or FALSE for that partial comparison. 2. Next, there is an AND operator. If the first result was FALSE then the final result is FALSE and no further comparisons are needed. Since a FALSE AND any other result will be FALSE 3. strtolower() is run against the 'unknown' session value to convert it to all lower case. 4. the in_array() function then compares that lower case value to the array $admin_urls to see if the value is contained in one of the array elements. If it does exist in the array the partial result is TRUE, else it is FALSE 5. The "NOT" operator (!) is applied to the result of the above comparison - effectively switching the results. Therefore, if the value is NOT contained in the array the result will be TRUE - else it will be FALSE 6. THe results of the 'admin' comparison and the NOT in_array() comparison are tested. If both are TRUE, then the final result is TRUE. Else, the final result is FALSE.   I hope that helps. If not, put the bong down before you burn any more brain cells. Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 25, 2015 Author Share Posted November 25, 2015 (edited)    Their not burnt their just slower than yours, all still present I promise  I think I was just trying to learn the extents of those methods and you both covered them nicely I learned a quite a few helpful pointers and proper code methods.  I'm done with this area chapter closed.  I feel like most of the difficult ground work is now complete on my site I just have a few more things to work out but they aren't difficult I just put them off until last.  The site is 100% functional now and directs me where I need to be (the admin-test.php page for work) and the company owner (the admin.php page) then it directs the user nowhere and gives them a little green line on top saying they are logged in.  I have a full activation and now use the password_verify function instead of the homegrown method I had picked up along the way. Now that I can make users and log them in I'm going to add a comment box on the contact page that will only be allowed for logged in users otherwise the submit button will say something like Sign Up to Submit Comment.  I feel very successful and feel I have learned a lot this month.  http://www.golden-wand.com     This site would probably have take someone like you two a day or two to make, hah, am I right?  I am curious on how long some of you would take to make something like this.  I'm assuming it's not long.  I'm also assuming that I'll be getting up to a lot better speed with the next two jobs.  Each one teaches me something new.  I love coding, I'm about to start another site for another customer soon.  I'm not really charging them much, since I'm really still learning and it's taking me 10 times longer than a pro with a wide knowledge base.  Thanks for all the help off to my next task Nick  Edit: Also, I'm going to be changing the one issue /Pages/ to /pages/ in a few minutes, then I'll never have another upper lowercase issue again, I'll always use lowercase from now on, now I understand why it's so important Edited November 25, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 25, 2015 Share Posted November 25, 2015 Some feedback:  There is something wrong with your sign-up form. I think it is expecting an email address as the username, but then it has two other fields to enter an email and verify it. If I enter a value that doesn't look like an email in the username field it gives me errors that the email and username are not available. Huh? It also appears the value must be the same in all three fields. Plus, when there is an error the first password field is being repopulated - you should never repopulate a password field when there are errors.  If the email address will be the "username", then you don't need a username field. Just have the email and confirmation fields - but make it known that their email address will be used for their username.  I don't know what browser you are testing with, but in Chrome that custom cursor is an eyesore. Lastly, the buttons for Login and Sign Up are not acting like buttons. I can't click on the buttons - I have to click exactly on the text. Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 25, 2015 Share Posted November 25, 2015 Your site/server has several security issues and you are vulnerable to Click Jacking. You should also run your pages through an html validater. You have some code issues. The site is also not mobile friendly (Not responsive design). Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 27, 2015 Author Share Posted November 27, 2015 (edited) I thought the form was pretty good, I did realized the username was set to 16 characters so I set it to 25, also for some reason I can't explain Chrome, which is my testing browser, won't autofill the form correctly even though I set the fields correctly.  I understand not everyone verify's the email twice but I wanted to confirm it and the password so I got it and it seems to work.  I made all my test accounts with usernames like Pineapples and PineTrees and Penguins, all worked fine, but the form did try to autofill with my email so I just changed it to what I wanted my display name to be.  I'm using the username/display name for the comments section I'll be making and I wanted to add the option for users to log in with either their email or username, I like choices myself so, I figured so would everyone else.  I do not have to click just the text I just re-tested it and I noticed one thing.  When you click the button nothing happens, click it again and it reacts properly, it must have something to do with the way I ended up finding to get the buttons to display or something.  Also the cursor, I made it myself, it's not the best thing in the world but I've had good reviews so far, all I car about is the customer, if her and her dad like it, I'll keep it, I haven't heard their input.  It seems a bit much but these people are only going to be on the site for a minute to get a job submitted or something.  Do you think any type of cursor is an eyesore or just this one hah?  I could see how it could be an eyesore but it does kinda match the color of the page  And the sparkles seem kinda cool cuz they're pretty much the same color too.   I agree, it's not mobile friendly, but, it does work and it gets the job done at the moment.  I will keep developing the site to be more mobile friendly that just wasn't the main goal for the site yet, kinda just made a duplicate of the desktop site with an ok navigation bar, it seems to highlight the page when I click the buttons.  Also I'll be looking into the HTML Validation thanks, will that stop click jacking or why am I vulnerable to that.  Here it is if you wanna look it over:  HTML: <!--~~~~~~~~~~~~~~~~~~!!~~~~~~~~~~~~~~~~~~~~!! LOGIN & SIGN UP SECTION START !!~~~~~~~~~~~~~~~~~~!!~~~~~~~~~~~~~~~~~~~~--> <div id="FloatingForm" class="Form"> <!---------------------------------------- SIGNIN LOGIN BUTTONS & INPUT START ------------------------------------------> <div class="FloatingContainer"> <div class="<?php echo $_SESSION['LoginSignupDisplay']; ?>"> <button onClick="toggle('FloatingLoginForm')" class="button hvr-wobble-skew" type="button" id="Login" name="Login";>Login</button> <button onClick="toggle('FloatingSignUpForm')" class="button hvr-wobble-skew" type="button" id="Sign Up" name="Sign Up";>Sign Up</button> </div> <div> <form class="<?php echo $_SESSION['LogoutDisplay']; ?>" action="" method="POST"> <button class="button hvr-wobble-skew" id="Logout" name="Logout">Logout</button> </form> </div> </div> <!------------------------------------------ SIGNIN LOGIN BUTTONS & INPUT END ------------------------------------------> <!------------------------------------------------ FLOATING ** START --------------------------------------------------> <div class="FloatingContainer"> <!---------------------------------------- FLOATING SIGN UP FORM START --------------------------------------> <div id="FloatingSignUpForm" class="FloatingSignUpForm hide"> <div> <fieldset class="InsideFloatingSignUpForm"><legend align="center">Sign Up</legend> <form action="" method="POST"> <table width="430"> <tr> <td colspan="2" class="outterSignUpText">Name: </td> <td> <input type="text" size="15" placeholder="First name" name="firstname" value="<?php if(isset($_POST['firstname'])){ echo htmlentities($_POST['firstname']); }?>"> <input type="text" size="15" placeholder="Last name" name="lastname" value="<?php if(isset($_POST['lastname'])){ echo htmlentities($_POST['lastname']); }?>"> </td> </tr> <tr> <td colspan="2" class="outterSignUpText">User Name: </td> <td> <input type="text" size="35" placeholder="Also known as your display name" name="username" value="<?php if(isset($_POST['username'])){ echo htmlentities($_POST['username']); }?>"> </td> </tr> <tr> <td colspan="2" class="outterSignUpText">Email: </td> <td> <input type="email" size="35" name="email1" placeholder="Email will be kept anonymous" value="<?php if(isset($_POST['email1'])){ echo htmlentities($_POST['email1']); }?>"> </td> </tr> <tr> <td colspan="2" class="outterSignUpText">Confirm Email: </td> <td> <input type="email" size="35" name="email2" placeholder="Re-Enter Email"> </td> </tr> <tr> <td colspan="2" class="outterSignUpText">Password: </td> <td> <input type="password" size="35" placeholder="Password" name="password1"> </td> </tr> <tr> <td colspan="2" class="outterSignUpText">Confirm Password: </td> <td> <input type="password" size="35" placeholder="Re-Enter Password" name="password2"> </td> </tr> <tr> <td colspan="1" rowspan="2" class="outterSignUpText" style="text-align:center; width:75px"> Sign Up with Google </td> <td colspan="1" rowspan="2" class="outterSignUpText" style="text-align:center; width:75px"> Sign Up with Facebook </td> <td align="center"> <?php if(isset($_GET['SignUp'])){ ?><div class="success">Sign Up Complete</div><?php } ?> <div data-theme="light" class="g-recaptcha" data-sitekey="6Lfueg8TAAAAADgAEeIGZ-VCuAwgv0ayk99iJXv4"></div> </td> </tr> <tr> <td colspan="2" align="center"> <button name="SignUp" onClick="" class="button hvr-wobble-skew">Sign Up</button> <div class="fb-like hide" data-share="true" data-width="450" data-show-faces="true" style="display:none"> </div> </td> </tr> </table> </form> </fieldset> </div> </div> <!---------------------------------------- FLOATING SIGN UP FORM END --------------------------------------> <!---------------------------------------- FLOATING LOGIN FORM START --------------------------------------> <div id="FloatingLoginForm" class="FloatingLoginForm hide"> <div> <fieldset class="InsideFloatingLoginForm"><legend align="center">Log In</legend> <form action="" method="POST"> <table> <tr> <td colspan="1" class="outterSignUpText"> Email: <input type="text" name="email" class="center" value="<?php if(isset($_POST['email'])){ echo htmlentities($_POST['email']); }?>"><br> </td> </tr> <tr> <td colspan="1" class="outterSignUpText"> Password: <input type="password" name="password" class="center"><br><br> </td> </tr> <tr> <td colspan="2" align="center"> <button type="submit" name="Login" id="Login" class="button hvr-wobble-skew">Login</button> </td> </tr> </table> </form> </fieldset> </div> </div> <!---------------------------------------- FLOATING LOGIN FORM END --------------------------------------> </div> <!-------------------------------------------- FLOATING ** END --------------------------------------------> </div> <!--~~~~~~~~~~~~~~~~~~!!~~~~~~~~~~~~~~~~~~~~~!! LOGIN & SIGN UP SECTION END !!~~~~~~~~~~~~~~~~~~~!!~~~~~~~~~~~~~~~~~~~~--> If you actually don't mind looking over my PHP I attached that too but it seems long and I already fell like you're all over helping me  I love all the help though and will take as much as you'll give me  This is school to me, I stepped into this PHP with only base knowledge, just trying to grow as an individual.  I know I have some conditions inside my logic and it felt wrong when I was making it but it works at the moment it just needs me to fix it so it's all perfect for re-use in future sites.  I do want it to be top notch at some point just didn't expect to spit out a top notch script right off the bat.  Took me most of this month to come up with what I have so far, hah.  Just a small edit: Right after uploading the header.php I changed the $admin_urls to all lowercase to match the strtolower($_SESSION['url']) command: $admin_urls = array("http://www.golden-wand.com/pages/admin.php","http://www.golden-wand.com/pages/admin-test.php"); header.php Edited November 27, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 29, 2015 Author Share Posted November 29, 2015 (edited)    I fixed the buttons not working right away, they just needed to be set in the main html so they have a default value of block or none not in the CSS.  When I put it in the CSS it loads a different default value or something which requires two presses on the button.  I also noticed a problem on the booking page as the google recaptcha was not happy with two recaptcha's on the same page so I researched and solved the problem.  All my forms seem to be functional at the moment so problems solved there.  I'm looking into the html form validator now following these instructions https://validator.w3.org/docs/install_win.html I'm sure this is a good source but why not get opinions     Something I can't seem to figure out is when I zoom out of the page I would like the footer.php include to be positioned at the bottom of the page that way the page doesn't look short and stubby it stays filling the whole page.  This would help for the mobile view sometimes, one of my friends was telling me it looked a little wierd with the bottom bar right beneath the words instead of at the bottom of his phone.  I've been trying this out and made little progress by making my organization better but still haven't gotten the bar where I want it hah, I am trying though. This is my test page I have a footer bar to play with needs to be fixed. http://jsfiddle.net/PineSmokes/jxcgjuLu/3/ Edited November 29, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted November 29, 2015 Share Posted November 29, 2015 I'm looking into the html form validator now following these instructions https://validator.w3.org/docs/install_win.html  This is an HTML markup validator; it has nothing to do with form validation. Why would you want to install this on your server?  If you want to validate your markup, simply use the public W3C validator. Or even better: Learn HTML. Currently, you write tag soup. You claim to use XHTML (which is a very strict and very exotic XML-based language), but then you actually send tons of broken plain HTML. I suggest you forget about this XHTML stuff (you never used it in the first place) and write valid HTML: <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>Page title</title> </head> <body> <!-- content goes here --> </body> </html> Quote Link to comment Share on other sites More sharing options...
PineSmokes Posted November 30, 2015 Author Share Posted November 30, 2015 (edited) I wouldn't I guess hah, didn't really get into it yet for this reason exactly. Â I just read the post that said validator, I didn't do enough research yet so landed on the wrong link. Â I worked all day last evening on making my new layout and it's live now. Â It's not perfect yet but the site now has a fixed nav bar and header, the shadow looks a bit messed up on the left near the nav bar. Â I have NO idea how it looks rounded on the right but like a square block on the left, there isn't any setting to make it that way from what I can see but yet it is. Â And I say I use XHTML by what the code I posted? Â Is that by not including the head html code that exists on my actual live page? Â Pretty sure I don't write soup. Â Everything is always indented properly, I always use the proper tags at the head of a page. Â I thought it was unnecessary to include on this page seemed like extra code for no reason I could totally include it if it's really that necessary it's just a slightly different highlight job. Â I do know what an HTML page looks like I'm not totally stupid rofl. Â I was posting my form which apparently had issues but I'm sure it doesn't have many now. Â I slightly protected against clickjacking but it's still possible I have more work to do there I pretty sure. Â This is what I have so far I know I need more, it's in my header.php which is on every page: <script> if ( top != self ) { top.location=self.location; } if ( top != self ) { top.location=self.location; } </script> Â This is an HTML markup validator; it has nothing to do with form validation. Why would you want to install this on your server? Â If you want to validate your markup, simply use the public W3C validator. Or even better: Learn HTML. Currently, you write tag soup. You claim to use XHTML (which is a very strict and very exotic XML-based language), but then you actually send tons of broken plain HTML. I suggest you forget about this XHTML stuff (you never used it in the first place) and write valid HTML: <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>Page title</title> </head> <body> <!-- content goes here --> </body> </html> Â Â You can see in my services.php and index.php files below that I do use proper HTML and XHTML? Â Those pages represent every website I have created, pretty basic but not soup right, what isn't soup if mine is hah? header.php header.css services.php index.php styles.css Edited November 30, 2015 by PineSmokes Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted December 1, 2015 Share Posted December 1, 2015 Have you checked your HTML markup with the above W3C validator? It has 61 errors and triggers 134 warnings, so it's definitely not properly written.What I meant by XHTML is this: You use the XHTML 1.0 doctype, so your document is supposed to be an XHTML document. But instead of actually serving it as application/xhtml+xml, you serve it as text/html and degrade it to HTML. But it's not valid HTML either. It's tag soup.By the way: If you really used XHTML (which you don't), your website wouldn't even be displayed, because XML parsers are extremely strict and don't accept errors. The only reason why you see the page content at all is because it's processed as HTML, and HTML parsers accept pretty much everything.In any case: I strongly recommend that you choose one HTML flavor (I suggest plain HTML) and then fix your document accordingly. You currently have two head elements, so there's obviously something wrong with the way you generate the output with PHP. Avoid ancient attributes like align. Avoid cluttering your markup with inline styles and inline scripts. Use external files instead. And in the case of CSS, use selectors instead of styling every single element. Avoid (mis-)using tables for layout purposes. I understand that it's very convenient, but tables are meant for tabular data, not layouting (use CSS instead). The broken markup isn't necessarily top priority, but you should definitely fix it before the release. Don't rely on browsers to guess what you mean. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.