marcus Posted November 18, 2006 Share Posted November 18, 2006 [tt]Parse error: syntax error, unexpected $end in /home/neoblob/public_html/cms/register.php on line 139[/tt][code]<?php include('header.php'); ?><?php$action = $_POST[action];$act = $_GET[action];$username = $_POST[username];$bday1 = $_POST[year];$bday2 = $_POST[day];$bday3 = $_POST[month];$userpass = $_POST[password];$passconf = $_POST[passconf];$email = $_POST[email];$emailconf = $_POST[emailconf];$userip = $_SERVER[REMOTE_ADDR];$ref = $_GET[ref];$ref2 = $_POST[ref2];$formact = "register.php";$formeth = post;if($ref){$sql = "SELECT id,username FROM users WHERE id=$ref";$result = mysql_query($sql);$result2 = mysql_fetch_assoc($result);$referrer = $result2[username];$refid = $result2[id];};if(!$ref){$ref = "0";};if(!$act){echo "Hello! Looks like you want to register for NBCMS. Well just hit register below and get started!!<br><br><a href='?action=register'>Register</a>";};if($act == register){echo "<h3>Register</h3><table border=0 cellspacing=0 cellpadding=2><form name=register action=".$formact." method=".$formeth."><input type=hidden name=action value=doreg><tr><td>Username:<td colspan=3><input type=text name=username><tr><td>Password:<td colspan=3><input type=password name=password><tr><td>Confirm:<td colspan=3><input type=password name=passconf><tr><td>Email:<td colspan=3><input type=text name=email><tr><td>Confirm:<td colspan=3><input type=text name=emailconf><tr><td>Birthday:<td><select name=month><option value=January>January<option value=February>February<option value=March>March<option value=April>April<option value=May>May<option value=June>June<option value=July>July<option value=August>August<option value=September>September<option value=October>October<option value=November>November<option value=December>December</select><td><select name=day>";?><?phpfor($i=1; $i<32; $i++){echo "<option value=$i>$i</option>";};?><?phpecho "</select><td><select name=year>";?><?phpfor($i=1900; $i<1993; $i++){echo "<option value=$i>$i</option>";};?><?phpecho"</select><tr><td>Age:<td><select name=age>";?><?phpfor($i=13; $i<107; $i++){echo "<option value=$i>$i</option>";};?><?phpecho "</select>";if($ref){echo "<tr><td>Referrer<td>$referrer<input type=text name=ref2 value=$refid>";};echo "<tr><td colspan=2><input type=submit value=Submit> <input type=reset value=Reset></form></table>";};if($action == doreg){if(!$username || !$email || !$passconf || !$userpass || !$emailconf){echo "Please fill in all the missing fields";};$sqlcun = "SELECT username,email,ip FROM users WHERE username=$username,email=$email,IP=$userip";$rescun = mysql_query($sqlcun);$numcun = mysql_num_rows($rescun);if($userpass != $passconf){echo "Your passwords did not match";};if($email != $emailconf){echo "Your emails did not match";};if($numcun > 0){echo "The username, email or IP is already in use!";};if($username && $email && $passconf && $userpass && $emailconf){$addus = "INSERT INTO `users` (`username` , `pass` , `email` , `IP` , `age` , `bday_year` , `bday_month` , `bday_day` , `referred` )VALUES ('$username', '$userpass', '$email', '$userip', '$age', '$bday1', '$bday3', '$bday2', '$ref2');$resus = mysql_query($addus);};};?>[/code]cant figure it out :/ Quote Link to comment Share on other sites More sharing options...
trq Posted November 18, 2006 Share Posted November 18, 2006 You might want to narrow down which is line 139 for us.Also, use either short <? (not recommended) or long <?php (recommended) tags but be consistant, your code is a mess. Quote Link to comment Share on other sites More sharing options...
marcus Posted November 18, 2006 Author Share Posted November 18, 2006 line 139 is ?>, the last line Quote Link to comment Share on other sites More sharing options...
trq Posted November 18, 2006 Share Posted November 18, 2006 Its allmost impossible to read your code through lack of indentaion. The error you are recieving is usually due to a missing or extra closing tag } which one, will be very hard to find without fixing your indentation. Quote Link to comment Share on other sites More sharing options...
marcus Posted November 18, 2006 Author Share Posted November 18, 2006 Haha, fixed. I missed a "; on one of the queries. Quote Link to comment Share on other sites More sharing options...
trq Posted November 18, 2006 Share Posted November 18, 2006 [quote]Haha[/quote]What are you laughing at? Did you [i]fix[/i] your indentation? Quote Link to comment Share on other sites More sharing options...
marcus Posted November 18, 2006 Author Share Posted November 18, 2006 I'm laughing because I didn't notice that. And all codes do not have to be indented. I was working with cPanel and when I hit tab it goes to the next input. Quote Link to comment Share on other sites More sharing options...
trq Posted November 18, 2006 Share Posted November 18, 2006 Dont use tab, use spaces. Code that is not indented is VERY difficult to maintain. Its just a [b]very[/b] bad habbit to get into. Quote Link to comment Share on other sites More sharing options...
marcus Posted November 18, 2006 Author Share Posted November 18, 2006 Thanks for the tip :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.