Parse error: parse error, unexpected $
Posted: Wed Jun 18, 2003 7:32 pm
i've been getting "Parse error: parse error, unexpected $ in /var/www/html/findyourdesire/php.signup.php on line 258" since i added to this after getting the error handling on the first working how i wanted... i don't know where the error is but took out everything other than page 2 and still got it, so i figure it's in there.
instead of posting the whole thing i'm going to post where i set variables, check for errors, pick a page to use, and the page2 function, and only through page 2 on some of this.
instead of posting the whole thing i'm going to post where i set variables, check for errors, pick a page to use, and the page2 function, and only through page 2 on some of this.
Code: Select all
<?php
/* *****************************************
** set any and all variables that need **
** to be set **
***************************************** */
$step=$_POST['step']; # what step are we on?
# variables for step 1
$lw=$_POST['lw']; $gtu=$_POST['gtu']; $fcc=$_POST['fcc']; $pp=$_POST['pp']; # liability waiver, general terms of use, forum civility code, privacy policy
# variables for step 2
$un=$_POST['un']; $pw=$_POST['pw']; $pwc=$_POST['pwc']; $email=$_POST['email']; $dobm=$_POST['month']; $dobd=$_POST['day']; $doby=$_POST['year']; $gender=$_POST['gender']; $sexpref=$_POST['sexpref']; $marstat=$_POST['marstat']; $country=$_POST['country']; $feet=$_POST['feet']; $inches=$_POST['inches']; $waist=$_POST['waist']; $eye=$_POST['eye']; $hair=$_POST['hair']; $weight=$_POST['weight']; $body=$_POST['body']; $education=$_POST['education ']; $employment=$_POST['employment']; $religion=$_POST['religion']; $ethnicity=$_POST['ethnicity']; $city=$_POST['city']; $spt=$_POST['spt']; $czodiac=$_POST['czodiac']; $rzodiac=$_POST['rzodiac']; $selfcat=$_POST['selfcat']; $aim=$_POST['aim']; $icq=$_POST['icq']; $mirc=$_POST['mirc']; $msn=$_POST['msn']; $yim=$_POST['yim']; # || username, password, password check, email || date of birth month/day/year, gender, sexual preference, marital status, country, height (feet/inches), waist, eye, hair, weight, body type, education level, employment status, religion, ethnicity, city, state/province/territory, chinese zodiac, regular zodiac, selfcat || aim, icq, mirc, msn, yim
/* *******************************************************
** find where we are and call the creation functions **
******************************************************* */
# check for errors
if((isset($step))&&($step>1)){
if($step==2){ # make sure they agree to the formalities
if($lw!=='agree'){ $err=TRUE; $errs[]='Liability Waiver'; $step=1;}
if($gtu!=='agree'){ $err=TRUE; $errs[]='General Terms Of Use'; $step=1;}
if($fcc!=='agree'){ $err=TRUE; $errs[]='Forum Civility Code'; $step=1;}
if($pp!=='agree'){ $err=TRUE; $errs[]='Privacy Policy'; $step=1;}
}elseif($step==3){ # make sure the username, e-mail and passwords are ok
if(!(preg_match('/\w+/', $un))){$err=TRUE; $errs[]='Your User Name has invalid characters.<br>Only Alpha-Numeric characters and underscore are accepted'; $step=2;}
# elseif( /* check against database */ ){$err=TRUE; $errs[]='That username has been chosen by another.'; $step=2;}
if($pw<6){ $err=TRUE; $errs[]='Your Password <b>MUST</b> be at least 6 characters'; $step=2;}
if($pw!==$pwc){ $err=TRUE; $errs[]='Your Password <b>MUST</b> match the check exactly'; $step=2;}
if(!(preg_match('/[\w\.\-]+@[\w\.\-]+\.\w\w\w?/', $email))){$err=TRUE; $errs[]='Your E-Mail address does not appear to be valid'; $step=2;}
# if(preg_match()){ $err=TRUE; $errs[]='Your e-mail address is on the "do not send" list. You need to use YOUR e-mail address. If you feel you see this in err, please go to the forums and contact the administration.'; $step=2}
}elseif($step==5){ # make sure the validation code is correct and "pictures" are pictures
/* $validate=$_COOKIE['confcode'];
if($conf!==$validate){$err=TRUE; $errs[]='Your Confirmation Code did not match. Your e-mail MUST be validated to proceed'; $step=4; }
# process the uploaded files
*/
}
}
# find where we are
if(isset($step)){
if(($step==1)&&($err)){ # an error was found in step 1
bgnpg('no', $step); errreport($step, $errs); s1();
}elseif($step==1){ # signup hasn't started yet
bgnpg('yes', $step); s1();
}elseif(($step==2)&&($err)){ # an error was found in step 2
bgnpg('no', $step); errreport($step, $errs); s2();
}elseif($step==2){ # we need a username, pw, and e-mail
bgnpg('no', $step); s2();
}elseif($step==3){ # see if they want a bio/misc interests
bgnpg('no', $step); s3();
}elseif(($step==4)&&($err)){ # an error was found in step4
bgnpg('no', $step); errreport($step, $errs); s4();
}elseif($step==4){ # get the validation code and let them upload pics
bgnpg('no', $step); s4();
}elseif($step==5){ # thank them for joining
bgnpg('no', $step); s5();
}
}else{ # they are starting signup
bgnpg('yes', '1'); s1();
}
#functions that make the pages
function bgnpg($cookie, $step){
if($cookie=='yes'){ # set the cookie with the validation code
$conf=uniqid(microtime(),1); # make unique id
$expire=time()+60*60; # set expiration an hour from now
setcookie(confcode, $conf, $expire); #create cookie
}
?><html>
<head>
<title>FindYourDesire.com Signup page -- <? echo $step; ?></title>
<meta name="Author" content="coded by: Josh Perlmutter; images by Morgan O'Brien-Bledsow & Tamara Collette all rights reserved">
<style type="text/css">
<!-- this comment is for non-css compliant browsers
{text-decoration=none}
end of css -->
</style>
</head>
<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4" link="#ffffff">
<center><p> </p>
<!-- banner goes here -->
<!-- ad bar goes here -->
<!-- nav bar goes here -->
<?php
}
function errreport($step, $errs){
if($step==1){ # report errors in step1
foreach($errs as $err){
echo " <h1>YOU MUST AGREE TO THE $err!</h1>";
}
}elseif($step==2){ # report errors in step2
foreach($errs as $err){
echo " <h1>$err</h1>";
}
}else{ # report errors of step4
}
}
function s1(){
?> <h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>
<p>Thank you for your interest in signing up for FindYourDesire.com. Before you can sign up, you need to agree to a few baisc terms of service</p>
<form name="step1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
<input type="hidden" name="step" value="2">
<table frame="void" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000" text="#c8c8c8">
<tr><td>I have read and agree to the <a name="#lw" href="#lw" onClick="window.open('faq.php?seek=lw', 'faq', 'height=250,width=500,scrollbars=yes');">Liabilty Waiver</a></td><td><input type="checkbox" name="lw" value="agree"></td></tr>
<tr><td>I have read and agree to the <a name="#gtu" href="#gtu" onClick="window.open('faq.php?seek=gtu', 'faq', 'height=250,width=500,scrollbars=yes');">General Terms of Use</a></td><td><input type="checkbox" name="gtu" value="agree"></td></tr>
<tr><td>I have read and agree to the <a name="#fcc" href="#fcc" onClick="window.open('faq.php?seek=fcc', 'faq', 'height=250,width=500,scrollbars=yes');">Forum Civilty Code</a></td><td><input type="checkbox" name="fcc" value="agree"></td></tr>
<tr><td>I have read and agree to the <a name="#privacy" href="#privacy" onClick="window.open('faq.php?seek=privacy', 'faq', 'height=250,width=500,scrollbars=yes');">Privacy Policy</a></td><td><input type="checkbox" name="pp" value="agree"></td></tr>
<tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
</table>
</form>
</center>
</body>
</html>
<?php
}
function s2(){
?> <h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE</h1>
<p>Thank you for your interest in joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in <font color="#ff0000">RED</font> is required. Any feild marked with an * is confidential and will NOT show up in your user stats. Any feild with a ° will not show up in your user stats, but is collected for future features. You will be notified before they are used.</p>
<form name="step2" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
<input type="hidden" name="step" value="3">
<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8">
<tr><td colspan="2" align="center"><!-- inner table for required information -->
<table frame="void" bgcolor="#ff0000" border="1" cellpadding="0" cellspacing="0" text="#c8c8c8">
<tr><td>User Name</td><td><input type="text" maxlength="15" name="un" size="15"></td></tr>
<tr><td>Password*</td><td><input type="password" maxlength="15" name="pw" size="15"></td><tr>
<tr><td>Password (incase of a typo)*</td><td><input type="password" maxlength="15" name="pwc" size="15"></td></tr>
<tr><td>Email Address*</td><td><input type="text" name="email" size="28"></td></tr>
</table></td></tr><!-- end required -->
<tr><td><a name="#dob" href="#dob" onClick="window.open('faq.php?seek=dob', 'faq', 'width=500,height=250,scrollbars=yes');">Date Of Birth</a></td><td>
<select name="month" size="1"><option value="1">January</option><option value="2">February</option><option value="3">March</option><option value="4">April</option><option value="5">May</option><option value="6">June</option><option value="7">July</option><option value="8">August</option><option value="9">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select><select name="day" size="1"> <?php for($i=1;$i<32;$i++){ echo "<option value="$i">$i</option>"; } ?></select><select name="year" size="1"><?php for($i=1900;$i<1989;$i++){ echo "<option value="$i">$i</option>"; } ?></select></td></tr>
<tr><td>Gender</td><td><select name="gender" size="1"><option selected value="Female">Female</option><option value="Male">Male</option></td></tr>
<tr><td>Sexual Preference</td><td><select name="sexpref"><option selected value="Decline to Answer">Decline to Answer</option><option value="Straight">Straight</option><option value="Bisexual">Bisexual</option><option value="Homosexual">Homosexual</option><option value="Transgender">Transgender</option><option value="Transsexual">Transsexual</option></select></td</tr>
<tr><td>Marital Status</td><td><select name="marstat" size="1"><option selected value="Decline to Answer">Decline to Answer</option><option value="Single">single</option><option value="Going Steady">Going Steady</option><option value="Engaged">Engaged</option><option value="Married">Married</option><option value="Seperated">Seperated</option><option value="Divorced">Divorced</option><option value="Widow/Widower">Widow/Widower</option></select></td></tr>
<tr><td>Country of Origin</td><td><select name="country" size="1"><option value="Australia">Australia</option><option value="Canada">Canada</option><option value="USA">USA</option><option value="Other">Other</other></select></td></tr>
<tr><td>Height</td><td><select name="feet" size="1"><?php for($i=3;$i<9;$i++){ echo "<option value="$i">$i</option>"; ?></select> feet <select name="inches"><?php for($i=0;$i<12;$i++){ echo "<option value="$i">$i</option>"; ?></select> inches</td></tr>
<tr><td>Waist</td><td><input type="text" maxlength="3" size="3" name="waist">inches</td></tr>
<tr><td>Eye Color</td><td><input type="text" name="eye" maxlength="10" size="10"></td></tr>
<tr><td>Hair Color</td><td><select size="1" name="hair"><option value="Black">Black</option><option value="Brown">Brown</option><option value="Red">Red</option><option value="Blonde">Blonde</option><option value="Dyed">Dyed</option></select></td></tr>
<tr><td>Weight</td><td><input type="text" max size="10" name="weight" size="10"></td></tr>
<tr><td>Body Type</td><td><select name="body" size="1"><option value="Thin">Thin</option><option value="Athletic-Not Musclebound">Athletic & not Musclebound</option><option value="Athletic-Musclebound">Athletic & Musclebound</option><option value="Heavyset">Heavyset</option><option value="Overweight">Overweight</option><option value="dta">Decline to Answer</option></select></td></tr>
<tr><td>Level of Education°</td><td><select name="education"><option value="High School">High School</option><option value="Associate">Associate's (2-yr)</option><option value="Bachelor">Bachelor's (4-yr)</option><option value="Master">Master's</option><option value="PHD">Doctorate</option></select></td></tr>
<tr><td>Employment Status°</td><td><select name="employment" size="1"><option value="Student">Student</option><option value="Unemployed">unemployed</option><option value="Part Time">Part Time</option><option value="Full Time">Full Time</option><option value="Self Employed">Self Employed</option><option value="Retired">Retired</option></select></td></tr>
<tr><td>Religion°</td><td><input type="text" size="20" name="religion"></td></tr>
<tr><td>Ethnic Background°</td><td><input type="text" size="20" name="ethnicity"></td></tr>
<tr><td>City°</td><td><input type="text"size="25" maxlength="100" name="city"></td></tr>
<tr><td>State/Province/Territory°</td><td><select name="spt" size="1"><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="Alberta">Alberta</option><option value="American Samoa">American Samoa</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="British Columbia">British Columbia</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="Federated States Of Micronesia">Federated States Of Micronesia</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Guam">Guam</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Manitoba">Manitoba</option><option value="Marshall Islands">Marshall Islands</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Brunswick">New Brunswick</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New South Wales">New South Wales</option><option value="New York">New York</option><option value="Newfoundland">Newfoundland</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Northern Mariana Islands">Northern Mariana Islands</option><option value="Northern Territory">Northern Territory</option><option value="Northwest Territories">Northwest Territories</option><option value="Nova Scotia">Nova Scotia</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Ontario">Ontario</option><option value="Oregon">Oregon</option><option value="Palau">Palau</option><option value="Pennsylvania">Pennsylvania</option><option value="Prince Edward Island">Prince Edward Island</option><option value="Puerto Rico">Puerto Rico</option><option value="Quebec">Quebec</option><option value="Rhode Island">Rhode Island</option><option value="Saskatchewan">Saskatchewan</option><option value="South Australia">South Australia</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tasmania">Tasmania</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Victoria">Victoria</option><option value="Virgin Islands">Virgin Islands</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="Washington, Dc">Washington, Dc</option><option value="West Virginia">West Virginia</option><option value="Western Australia">Western Australia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option><option value="Yukon">Yukon</option><option value="Not From A Listed Country">Not From A Listed Country</option></select></td></tr>
<tr><td>Chinese Zodiac</td><td><select name="czodiac" size="1"><option value="Ram">Ram</option><option value="Dragon">Dragon</option><option value="Horse">Horse</option><option value="Ox">Ox</option><option value="Rat">Rat</option><option value="Tiger">Tiger</option><option value="Monkey">Monkey</option><option value="Snake">Snake</option><option value="Dog">Dog</option><option value="Rabbit">Rabbit</option><option value="Pig">Pig</option><option value="Rooster">Rooster</option><option value="Unknown">Don't Know</option></select></td></tr>
<tr><td>Zodiac</td><td><select value="rzodiac" size="1"><option value="Aquarius">Aquarius</option><option value="Pisces">Pisces</option><option value="Aries">Aries</option><option valueTaurus>Taurus</option><option value="Gemini">Gemini</option><option value="Cancer">Cancer</option><option value="Leo">Leo</option><option value="Virgo">Virgo</option><option value="Libra">Libra</option><option value="Scorpio">Scorpio</option><option value="Sagittarius">Sagittarius</option><option value="Capricorn">Capricorn</option><option value="Unknown">Don't Know</option></select></td></tr>
<tr><td>You Catagorize Yourself As...</td><td><select name="selfcat"><option value="Decline to Answer">Decline to Answer</option><option value="Preppy">Preppy</option><option value="Jock">Jock</option><option value="Skater">Skater</option><option value="Hippy">Hippy</option><option value="Goth">Goth</option><option value="Nerd/Geek">Nerd/Geek</option></select></td></tr>
<tr><td><a href="http://www.aim.com" target="_blank">AOL Instant Messenger</a></td><td><input type="text" size="16" maxlength="16" name="aim"></td></tr>
<tr><td><a href="http://web.icq.com/" target="_blank">ICQ</a></td><td><input type="text" size="16" maxlength="12" name="icq"></td></tr>
<tr><td><a href="http://www.mirc.com/" target="_blank">mIRC</a></td><td><input type="text" size="16" name="mirc"></td></tr>
<tr><td><a href="http://messenger.yahoo.com" target="_blank">Y!</a></td><td><input type="text" size="16" name="yim"></td></tr>
<tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
</table>
</form>
</center>
</body>
</html>
<?php
}
?>