Zubrag.com
December 15, 2018, 11:11:16 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: password script and xhtml validation  (Read 6968 times)
LarryKent
Newbie
*
Posts: 2


« on: September 04, 2011, 12:55:05 PM »

Putting the php include for password_protect.php in the very first line causes my page not to validate.  Anyone have an answer or solution to this?

I'm trying to validate as xhtml transitional.  The validator seems unhappy that the php include is the first line of the document rather than a doctype

Thanks.

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: September 04, 2011, 01:23:18 PM »

Validator does not know password, so it can only see/validate login form. So login form has to be fixed to be xhtml compliant. Find code starting with <html> and ending with </html> and replace with following code inside password_protect.php

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Please enter password to access this page</title>
  <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
  <meta http-equiv="PRAGMA" content="NO-CACHE" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <style type="text/css">
    input { border: 1px solid black; }
  </style>
</head>
<body>
  <div style="width:500px; margin-left:auto; margin-right:auto; text-align:center">
  <form method="post" action="#">
    <h3>Please enter password to access this page</h3>
    <font color="red"><?php echo $error_msg?></font><br />
<?php if (USE_USERNAME) echo 'Login:<br /><input type="text" name="access_login" /><br />Password:<br />'?>
<input type="password" name="access_password" /><p></p><input type="submit" name="Submit" value="Submit" />
  </form>
  <br />
  <a style="font-size:9px; color: #B0B0B0; font-family: Verdana, Arial;" href="http://www.zubrag.com/scripts/password-protect.php" title="Download Password Protector">Powered by Password Protect</a>
  </div>
</body>
</html>
Logged
LarryKent
Newbie
*
Posts: 2


« Reply #2 on: September 04, 2011, 01:44:56 PM »

Thanks!  This improved things.  I ran the validator again and got a "Congratulations" because "This document was Tentatively checked as XHTML 1.0 Transitional"  with two warnings, as follows:


FIRST WARNING:  No Character Encoding Found! Falling back to UTF-8.

 None of the standards sources gave any information on the character encoding labeling for this document. Without encoding information it is impossible to reliably validate the document. As a fallback solution, the "UTF-8" encoding was used to read the content and attempt to perform the validation, but this is likely to fail for all non-trivial documents.

SECOND WARNING:  No Character encoding declared at document level

No character encoding information was found within the document, either in an HTML meta element or an XML declaration. It is often recommended to declare the character encoding in the document itself, especially if there is a chance that the document will be read from or saved to disk, CD, etc.

[end of warnings]

If that's as close as we can get, I can live with it - the script seems to work. It's a curiosity, though.  Thanks again.
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #3 on: September 05, 2011, 03:03:53 PM »

I updated the form above a little, shoul now produce only one warning (Using Direct Input mode: UTF-8 character encoding assumed), which i had no chance to fix yet
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC