1 (edited by Scripter 2007-11-30 21:31)

Topic: validation question

<?php
 
// Show login if not logged in
if($pun_user['is_guest'])
{
    if(!isset($focus_element) || (isset($focus_element) && !in_array('login', $focus_element)))
    {
 
    // Load the language files
    require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
    require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
 
    // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
    $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
 
    $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);
 
?>
                  <div class="block">
 
<h2><span>Login</span></h2>
<div id="login" class="box">
<div class="inbox">             
        <div class="logintop">
            <form id="login" name="login" name="qpost" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
<div style="text-align: center" class="inform">
 
 
 
 
 
 
 
                <p>
                    <input type="hidden" name="form_sent" value="1" />
                    <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
                     <?php echo $lang_common['Username'] ?><br />
                    <input type="text" name="req_username" size="16" maxlength="25" /><br /><br />
                     <?php echo $lang_common['Password'] ?><br />
 
 <input type="password" name="req_password" size="16" maxlength="16" wrap="virtual" onkeypress="if(event.keyCode==13) document.login.submit()" /><br /><br />
<input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /><br /><br />
                    <a href="register.php"><?php echo 'Register Now!'; ?></a>
                </p>
 
</div>
            </form>
        </div>
</div>
</div>
</div>
<?php
    }
}

How do I valid this login script.

The errors:

#  Error  Line 100, Column 22: ID "login" already defined.

            <form id="login" name="login" name="qpost" method="post" action="log

?

An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
# Info Line 97, Column 9: ID "login" first defined here.

<div id="login" class="box">

# Error Line 100, Column 34: there is no attribute "name".

            <form id="login" name="login" name="qpost" method="post" action="log

?

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
# Error Line 100, Column 47: duplicate specification of attribute "name".

?  <form id="login" name="login" name="qpost" method="post" action="login.php?

?

You have specified an attribute more than once. Example: Using the "height" attribute twice on the same "img" tag.
# Error Line 116, Column 74: there is no attribute "wrap".

?sword" size="16" maxlength="16" wrap="virtual" onkeypress="if(event.keyCode==

?

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
# Error Line 154, Column 78: document type does not allow element "script" here.

?s.com/urchin.js" type="text/javascript">

?

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
# Error Line 156, Column 30: document type does not allow element "script" here.

<script type="text/javascript">

?

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
# Error Line 100, Column > 80: XML Parsing Error: Attribute name redefined.

?ame="qpost" method="post" action="login.php?action=in" onsubmit="return proce?
[img]http://img90.imageshack.us/img90/746/scripter8ko.png[/img]
http://openwings.co.cc

Re: validation question

Stick to one thread, will you?

Re: validation question

What Bekko said smile
Closed