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;



LinkBack URL
About LinkBacks
Reply With Quote




