Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts

    i need some help in php registration form

    hello there,
    I have a site its a mobile site actually.The thing is when i try to valid my page with validator its showing error.

    Registration page
    Code:
    <?
    
    if(isset($_POST['action']))
    {
    session_id("".$_POST['sid']."");
    session_name('sid');
    session_start();
    }
    else
    {
    session_name('sid');
    session_start();
    $number = rand(1000, 9999);
    $_SESSION['code'] = $number;
    }
    
    
    //include "session.php";
    include "dgm.php";
    include "ad2.php";
    $r = rand(1000, 9999);
    
    wml_header();
    
    
    if($action=="")
    {
    echo "<card title=\"Registration\">";
    echo "<p align=\"left\">";
    echo "<small>";
    echo "<u>Registration Form:</u><br/>";
    echo "Username*:<br/>\n";
    echo '<input type="text" name="login'.$r.'"/><br/>';
    echo "Password*:<br/>\n";
    echo '<input type="text" name="pass'.$r.'"/><br/>';
    //echo "Re-type Password*:<br/>\n";
    //echo "<input type=\"text\" name=\"pass2$r\" maxlength=\"20\"/><br/>\n";
    echo "Security Code*:<br/>\n";
    echo '<input type="text" name="security'.$r.'" maxlength="15"/><br/>';
    echo "Email*:<br/>";
    echo '<input type="text" name="email'.$r.'" value="@" maxlength="30" emptyok="true"/><br/>';
    echo "<small>Sex*:</small><br/>";
    echo "<select name=\"sex$r\" title=\"sex\"><option value=\"Male\">male</option><option value=\"Female\">female</option></select><br/>\n";
    echo "<small>Date Of Birth: (DD-MM-YYYY)</small><br/>
    <input size=\"2\" name=\"bday$r\" maxlength=\"2\" format=\"NN\"/>-<input size=\"2\" name=\"bmonth$r\" maxlength=\"2\" format=\"NN\"/>-<input size=\"4\" name=\"byear$r\" maxlength=\"4\" format=\"NNNN\"/><br/>";
    echo "Location:<br/>\n";
    echo '<input type="text" name="live'.$r.'" maxlength="40"/><br/>';
    echo "Real Name:<br/>\n";
    echo '<input type="text" name="name'.$r.'" maxlength="10"/><br/>';
    echo "<img src=\"img.php?sid=".session_id()."\" alt=\"img\"/><br/>\n";
    echo "Enter The Code Shown*:<br/>\n";
    echo '<input type="text" name="ref'.$r.'" maxlength="10"/><br/>';
    echo "</small>";
    echo "<small><anchor>&#187;Register";
    echo "<go method=\"post\" href=\"register.php\">";
    echo "<postfield name=\"login\" value=\"$(login$r)\"/>";
    echo "<postfield name=\"security\" value=\"$(security$r)\"/>";
    echo "<postfield name=\"pass\" value=\"$(pass$r)\"/>";
    echo "<postfield name=\"pass2\" value=\"$(pass2$r)\"/>";
    echo "<postfield name=\"name\" value=\"$(name$r)\"/>";
    echo "<postfield name=\"live\" value=\"$(live$r)\"/>";
    echo "<postfield name=\"sex\" value=\"$(sex$r)\"/>";
    echo "<postfield name=\"email\" value=\"$(email$r)\"/><postfield name=\"byear\" value=\"$(byear$r)\"/>
    <postfield name=\"bday\" value=\"$(bday$r)\"/>
    <postfield name=\"bmonth\" value=\"$(bmonth$r)\"/>";
    echo "<postfield name=\"sid\" value=\"".session_id()."\"/>\n";
    echo "<postfield name=\"ref\" value=\"$(ref$r)\"/>\n";
    echo "<postfield name=\"number\" value=\"$number\"/>\n";
    echo "<postfield name=\"action\" value=\"registered2\"/>\n";
    echo "</go>";
    echo "</anchor><br/>";
    echo "<a href=\"index.php?time=".time()."\">&#171;Back</a><br/>";
    
    wml_foot();
    @mysql_close();
    ob_end_flush();
    ?>

    The validating errors i get
    Code:
    Line 4, Column 38: document type does not allow element "input" here 
    <input type="text" name="login69724"/><br/>Password*:<br/>
    
    ✉ 
    
    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). 
     Line 5, Column 32: document type does not allow element "input" here 
    <input type="text" name="pass"/><br/>Security Code*:<br/>
    
    ✉ 
    
    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). 
     Line 6, Column 51: document type does not allow element "input" here 
    …ext" name="security" maxlength="15"/><br/>Email*:<br/><input type="text" name
    
    ✉ 
    
    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).

    but in my login page its same but not showing any validate error at all


    my login page

    Code:
    echo "<card title=\"Login\">\n";
    echo "<p align=\"$align\">\n";
    
    echo '<small><b>Username:</b></small><br/>';
    echo '<input type="text" name="login'.$nocache.'"/><br/>';
    echo '<small><b>Password:</b></small><br/>';
    echo '<input type="password" name="pass'.$nocache.'"/><br/>';
    echo "<anchor>Login\n";
    echo "<go method=\"post\" href=\"hall.php\">\n";
    echo "<postfield name=\"login\" value=\"$(login$nocache)\"/>\n";
    echo "<postfield name=\"pass\" value=\"$(pass$nocache)\"/>\n";
    echo "<postfield name=\"act\" value=\"auth\"/>\n";
    echo "</go>\n";
    echo "</anchor><br/>\n";
    echo "<small><a href=\"forget.php?nocache=$nocache&amp;".SID."\">Forget Password</a><br/>";
    echo "<a href=\"index.php?nocache=$nocache&amp;".SID."\">Back</a>\n";

    So my problems:
    1.Registration pproblem shows error when try to validate.
    2.My website is a mobile site.If i registration from pc it is ok.
    3.Some mobile phones shows errors like : no gateway or invalid format and i got so many complains about same thing.
    4.They can login to my login page as well even i registered them by my self when they try to enter registration page they face problem like no gateway but trying login page its working fine for them.
    5.Login page validate is okey results without any error.


    So , therefor i need help so if anybody can help me or suggest me what to do that will be so great full to me.I have tried a lot but i am failed.I am actually dont get what is the problem.

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Line 4, Column 38: document type does not allow element "input" here
    Inputs should be children of forms. I don't see your form tags. For that matter, neither of the code blocks posted has doctype, html, or body tags.
    Are you a Help Vampire?

  • #3
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts
    but in my login page its same but i am not having any error in login page but why registration page validate error also users dont get bad gateway in that page but only in registration page

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    You didn't post your entire login page, so I can't tell you why that validates but the registration page does not.
    Are you a Help Vampire?

  • #5
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts
    ok here is my full login page please someone help me becuase i am facin this problem and a lot of users cant register .but they can login and login page is working fyn.

    Code:
    <?
    
    if(isset($_POST['action']))
    {
    session_id("".$_POST['sid']."");
    session_name('sid');
    session_start();
    }
    else
    {
    session_name('sid');
    session_start();
    $number = rand(1000, 9999);
    $_SESSION['code'] = $number;
    }
    
    
    //include "session.php";
    include "dgm.php";
    include "ad2.php";
    $r = rand(1000, 9999);
    
    wml_header();
    
    
    
    $rst=mysql_fetch_array(mysql_query("SELECT regst FROMset WHERE id='1'"));
    if($rst[0]<>'1')
    {
    echo "<card id=\"error\" title=\"Error\"><p align=\"left\">\n";
    echo "<small>Registration is temporarily closed.$reg_status[0]</small><br/>\n";
    echo "<a href=\"index.php\">$sitename</a><br/>\n";
    echo "</p></card></wml>";
    ob_end_flush();
    exit();
    }
    
    
    if($action=="")
    {
    echo "<card title=\"Registration\">";
    echo "<p align=\"left\">";
    echo "<small>";
    echo "<u>Registration Form:</u><br/>";
    echo "Username*:<br/>\n";
    echo '<input type="text" name="login'.$r.'"/><br/>';
    echo "Password*:<br/>\n";
    echo '<input type="text" name="pass'.$r.'"/><br/>';
    //echo "Re-type Password*:<br/>\n";
    //echo "<input type=\"text\" name=\"pass2$r\" maxlength=\"20\"/><br/>\n";
    echo "Security Code*:<br/>\n";
    echo '<input type="text" name="security'.$r.'" maxlength="15"/><br/>';
    echo "Email*:<br/>";
    echo '<input type="text" name="email'.$r.'" value="@" maxlength="30" emptyok="true"/><br/>';
    echo "<small>Sex*:</small><br/>";
    echo "<select name=\"sex$r\" title=\"sex\"><option value=\"Male\">male</option><option value=\"Female\">female</option></select><br/>\n";
    echo "<small>Date Of Birth: (DD-MM-YYYY)</small><br/>
    <input size=\"2\" name=\"bday$r\" maxlength=\"2\" format=\"NN\"/>-<input size=\"2\" name=\"bmonth$r\" maxlength=\"2\" format=\"NN\"/>-<input size=\"4\" name=\"byear$r\" maxlength=\"4\" format=\"NNNN\"/><br/>";
    echo "Location:<br/>\n";
    echo '<input type="text" name="live'.$r.'" maxlength="40"/><br/>';
    echo "Real Name:<br/>\n";
    echo '<input type="text" name="name'.$r.'" maxlength="10"/><br/>';
    echo "<img src=\"img.php?sid=".session_id()."\" alt=\"img\"/><br/>\n";
    echo "Enter The Code Shown*:<br/>\n";
    echo '<input type="text" name="ref'.$r.'" maxlength="10"/><br/>';
    echo "<anchor>Register\n";
    echo "<go method=\"post\" href=\"register.php\">\n";
    echo "<postfield name=\"login\" value=\"$(login$r)\"/>";
    echo "<postfield name=\"security\" value=\"$(security$r)\"/>";
    echo "<postfield name=\"pass\" value=\"$(pass$r)\"/>";
    echo "<postfield name=\"pass2\" value=\"$(pass2$r)\"/>";
    echo "<postfield name=\"name\" value=\"$(name$r)\"/>";
    echo "<postfield name=\"live\" value=\"$(live$r)\"/>";
    echo "<postfield name=\"sex\" value=\"$(sex$r)\"/>";
    echo "<postfield name=\"email\" value=\"$(email$r)\"/><postfield name=\"byear\" value=\"$(byear$r)\"/>
    <postfield name=\"bday\" value=\"$(bday$r)\"/>
    <postfield name=\"bmonth\" value=\"$(bmonth$r)\"/>";
    echo "<postfield name=\"sid\" value=\"".session_id()."\"/>\n";
    echo "<postfield name=\"ref\" value=\"$(ref$r)\"/>\n";
    echo "<postfield name=\"number\" value=\"$number\"/>\n";
    echo "<postfield name=\"action\" value=\"registered2\"/>\n";
    echo "</go>\n";
    echo "</anchor><br/>\n";
    echo "<a href=\"index.php?time=".time()."\">«Back</a><br/>";
    echo "Registration problem call now:01715631188.<br/>";
    echo "<br/>$copyright";
    }
    
    if($action=="registered2")
    {
    
    
    if($reg_status[0]<>'1')
    {
    echo "<card id=\"error\" title=\"Error\"><p align=\"left\">\n";
    echo "<small>Registration is temporarily closed.</small><br/>\n";
    echo "<a href=\"index.php\">$sitename</a><br/>\n";
    echo "</p></card></wml>";
    ob_end_flush();
    exit();
    }
    
    
    
    
    
    
    echo "<card title=\"Creating account..\">";
    echo "<p align=\"$align\">";
    echo "<small>";
    
    $login=htmlspecialchars(stripslashes(trim($login)));
    $login=substr($login,0,20);
    $pass=htmlspecialchars(stripslashes(trim($pass)));
    $name=htmlspecialchars(stripslashes(trim($name)));
    $sex=htmlspecialchars(stripslashes(trim($sex)));
    $rs=htmlspecialchars(stripslashes(trim($rs)));
    $email=htmlspecialchars(stripslashes(trim($email)));
    $email=substr($email,0,50);
    $about=htmlspecialchars(stripslashes(trim($about)));
    $aboutme=htmlspecialchars(stripslashes(trim($aboutme)));
    $photo=htmlspecialchars(stripslashes(trim($photo)));
    $live=htmlspecialchars(stripslashes(trim($live)));
    $wapsite=htmlspecialchars(stripslashes(trim($wapsite)));
    $security=htmlspecialchars(stripslashes(trim($security)));
    $login = str_replace("#","S",$login);
    $real = -($byear - 2008);
    if($_POST['ref'] != $_SESSION['ref']) $error .= "You Have Entered Wrong Image Verification Please Go Back And Put The Code Shown In Image.<br/>\n";
    if($number != $_SESSION['code']) $error .= BAD_SID."<br/>\n";
    $login = str_replace("#","s",$login);
    $query_users_login = @mysql_query("select * from `chat_users` where login='".$login."';");
    $users_login = @mysql_fetch_array($query_users_login);
    if (empty($login)) $error='NickName Needed!<br/>';
    if ($byear<1900 || $byear>2008) $error='You are  '.$real.' years old not possbile go back and change it!<br/>';
    if (empty($pass)) $error=$error.'Must have to full password field<br/>';
    //if (empty($name)) $error=$error.'Must have to fill name.<br/>';
    if (empty($security)) $error=$error.'security code Needed!<br/>';
    if (empty($sex))$error=$error.'Are You Male or Female!<br/>';
    if (empty($email))$error=$error.'Email address Needed!<br/>';
    if (strlen($email) < 4)$error.='The E-mail address you entered is not valid!<br/>';
    if (strlen($pass) < 4)$error.='Minimum 4 characters in Password!<br/>';
    if (strlen($security) < 4)$error.='Minimum 4 characters in Security code!<br/>';
    if (strlen($login) > 10)$error.='You Can Not Register Nick More Then 10 charactors.<br/>';
    if (strlen($login) < 2)$error.='Your nick is too small.<br/>';
    if (strlen($ref) < 4)$error.='Please retype the image verification.<br/>';
    if (preg_match("/[^\da-zA-Z-@#!_]+/",$login)) $error.='Nick Already in used!<br/>';
    if (preg_match("/[^\da-zA-Z_]+/",$pass)) $error.='Pass Is Invalid!<br/>';
    $db_login = $users_login['login'];
     
    
    
    
    //if (strcmp($_POST['pass'],$_POST['pass2']) || empty($_POST['pass']) )
    //	{ 
    
    //	$error="Password fields does not match or empty.";
    
    //	}
    
    
    
    
    $uipp = mysql_query("SELECT ip FROM `chat_users` WHERE `ipban` = '1' LIMIT 1;");
    if($uipp=="$ipadd")
    
    	{ 
    
    	$error="You are banned from this chat site.";
    
    	}
    
    
    
    $cou = mysql_fetch_array(mysql_query("SELECT `soft` FROM `chat_users` order by id desc LIMIT 1"));
    
    
    if($cou[0]=="$browser") { 
    
    $error="You are not allowed to register.Try again after some times.";
    
     }
    
    
    $coppa = mysql_fetch_array(mysql_query("SELECT `email` FROM `chat_users`"));
    
    
    if($coppa[0]=="$email") { 
    
    $error="This email address is already registered.";
    
     }
    
    
    if(stristr($HTTP_USER_AGENT,"Windows NT"))
    {
    $cou1 = mysql_fetch_array(mysql_query("SELECT `ip` FROM `chat_users` order by id desc LIMIT 1"));
    
    
    if($cou1[0]=="$ipadd") { 
    
    $error="You are not allowed to register.Try again after some times.";
    
     }
    }
    
    
    if (empty($error)) {
    if (strtolower($login) != strtolower($db_login)) {
    $query= "INSERT INTO `chat_users` SET login='".delhtml($login)."', pass='$pass', email='".delhtml($email)."', name='".delhtml($name)."', sex='".delhtml($sex)."', byear='".intval($_POST['byear'])."', bday='".intval($_POST['bday'])."', bmonth='".intval($_POST['bmonth'])."',ip='".$ipadd."', soft='".$browser."', rtime='".time()."', photo='member.jpg', wapsite='$wapsite',about='".delhtml($about)."',live='".delhtml($live)."',security='$security',aboutme='".delhtml($aboutme)."',per='1'";
    
    
    
    $result = mysql_query($query) or die(mysql_error());
    if($result){
    $query_to = mysql_query("select * from `chat_users` where moder>=1;");
    $id = mysql_insert_id();
    $welcomemsg=" $login signed up at: " . $time . "";
     while($data = @mysql_fetch_array($query_to)){ 
    $sendto = $data['id'];
    $adf ="$login";
    $id = "4870";
    $sql = mysql_query("INSERT INTO `chatmsg` VALUES(0, '" . $id . "', '" . $adf . "', '" . $welcomemsg . "', '$sendto', '" . $time . "'," . time() . ", '', '1');");
    }
    
    
    
    
    echo "Thank you registration is complete your username and password is as follows!!<br/>\n";
    echo"User name:  $login <br/>\n Password:  $pass<br/>\n";
    echo"Account Security Code : $security<br/>\n";
    echo"Please remember the security code.It will be needed to change profile and password.<br/>\n";
    echo"Update photo album photo profile privacy profile information details in settings.<br/>";
    echo "<a href=\"./hall.php?login=$login&amp;pass=$pass&amp;act=auth\">Enter</a> <br/>\n <br/>";
    }
    } else echo "The username you are trying is already taken, try another one! <br/>";
    
    }if ($error) {
    echo "$error <br/>\n";
    print "<a href=\"./register.php?time=".time()."\">Register</a><br/>";
    
    echo "<a href=\"index.php?time=".time()."\">«Back</a>";
    echo "<br/>$copyright";
    echo "</small></p></card></wml>";
    ob_end_flush();
    exit();				
    }
    }
    
    wml_foot();
    @mysql_close();
    ob_end_flush();
    ?>

    i have fixed the registration page/.....


    but now having another problem with another page :

    Code:
    echo "Search Title:\n";
    echo "<input type=\"text\" name=\"tz$r\" maxlength=\"30\"/><br/>\n";
    echo "What To Search:";
    echo "<select name=\"sex$r\" title=\"sex\"><option value=\"login\">Username</option><option value=\"name\">Name</option><option value=\"email\">Email Address</option></select><br/>\n";
    
    
    echo "<anchor>&#187;Search";
    echo "<go method=\"post\" href=\"members.php?".SID."&amp;nocache=".$nocache."\">";
    echo "<postfield name=\"tz\" value=\"$(tz$r)\"/>";
    echo "<postfield name=\"action\" value=\"search\"/>";
    echo "<postfield name=\"sex\" value=\"$(sex$r)\"/></go></anchor><br/>";

    i have posted one of my old registration page and itss just working fyn now i dont know what is the problem actually
    Last edited by bijaybd; 11-23-2009 at 07:45 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •