The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

can some1 help me

Discussion in 'General Discussion' started by Hughra Hosting, May 13, 2004.

  1. Hughra Hosting

    Joined:
    Jan 12, 2004
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    im writin a script that auto creats a account. so far everything works except it says cannot modify header information.

    this is what i got... i left of the form, this is the php script.
    also.. i use queries..ex main.php?page=order

    if($sent)
    {
    #set variable default value
    $valid=true;

    #check first field is not blank
    if( !$fname )
    { $errmsg.="Please enter your first name.<br />"; $valid = false; }


    #check lastname field is not blank
    if( !$lname )
    { $errmsg.="Please enter your last name.<br />"; $valid = false; }

    #check phonenumber field is not blank
    if( !$pnumber )
    { $errmsg.="Please enter your phone number.<br />"; $valid = false; }

    #check address field is not blank
    if( !$address )
    { $errmsg.="Please enter a street address.<br />"; $valid = false; }

    #check zip field is not blank
    if( !$zip )
    { $errmsg.="Please enter your zip code.<br />"; $valid = false; }

    #check city field is not blank
    if( !$lname )
    { $errmsg.="Please specify your city.<br />"; $valid = false; }


    #check email useraddr field is not blank
    if( !$useraddr )
    { $errmsg .="Please enter an email address.<br />"; $valid = false; }

    #modified section with extra validation
    else
    {
    $useraddr = trim($useraddr);
    #permitted patterns for name,domain and top-level domains
    $_name = "/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+";
    $_host = "([-0-9A-Z]+\.)+";
    $_tlds = "([0-9A-Z]){2,4}$/i";

    #check validity of email format
    if( !preg_match( $_name."@".$_host .$_tlds,$useraddr ) )
    {
    $errmsg.="Email address has incorrect format!<br />";
    $valid=false;
    }
    }

    if( !$acctdomain )
    { $errmsg.="Please specify a domain.<br />"; $valid = false; };

    if( !$acctuser )
    { $errmsg.="Please specify a username.<br />"; $valid = false; }

    if( !$acctpass )
    { $errmsg.="Please specify a password.<br />"; $valid = false; }

    }

    #if not valid write the error mesage/s and repeat the form
    if($valid!=true)
    {
    echo( $errmsg.$form );
    }
    else
    $file_contents = ob_get_contents();

    ob_end_clean();

    setcookie( "acctplan", $acctplan, time()+3600 );
    setcookie( "acctdomain", $acctdomain, time()+3600 );
    setcookie( "acctpass", $acctpass, time()+3600 );
    setcookie( "acctuser", $acctuser, time()+3600 );

    print $file_contents;
     
  2. nybble

    nybble Well-Known Member

    Joined:
    Jan 26, 2004
    Messages:
    223
    Likes Received:
    0
    Trophy Points:
    16
    You can not modify header info, that means exactly what it says.

    Once you send the user output(eg. html), you can not send any more headers (Yes, this includes cookies)
     
Loading...

Share This Page