By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,526 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,526 IT Pros & Developers. It's quick & easy.

Another... Parse error: syntax error, unexpected $end

P: 1
Hey.. I've been working on these sign up / log in forms for my new Game Site, and everything else in the game works but the registration!! I keep ketting the unexpected $end and Im tired of it! Here is the code... SOMEBODY PLEASE HELP ME!! I'm going crazy! haha

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //This contains user stuffs
  3. switch($_GET['action'])
  4. {
  5. case 'newuser': new_user_form(); break;
  6. case 'newusersub': new_user_submit(); break;
  7. case 'edituser': edit_user_begin(); break;
  8. case 'edituserform': edit_user_form(); break;
  9. case 'editusersub': edit_user_sub(); break;
  10. case 'invbeg': inv_user_begin(); break;
  11. case 'invuser': inv_user_view(); break;
  12. case 'deleinv': inv_delete(); break;
  13. case 'creditform': credit_user_form(); break;
  14. case 'creditsub': credit_user_submit(); break;
  15. case 'masscredit': mcredit_user_form(); break;
  16. case 'masscreditsub': mcredit_user_submit(); break;
  17. case 'reportsview': reports_view(); break;
  18. case 'repclear': report_clear(); break;
  19. case 'deluser': deluser(); break;
  20. case 'forcelogout': forcelogout(); break;
  21. }
  22. function htmlspcl($in)
  23. {
  24. return str_replace("'", "'", htmlspecialchars($in));
  25. }
  26. function new_user_form()
  27. {
  28. print "Registration<br />
  29. <form action='register.php method=post?action=newusersub' method='post'>
  30. Username: <input type='text' name='username' /><br />
  31. Email: <input type='text' name='email' /><br />
  32. Password: <input type='text' name='userpass' /><br />
  33. Your Referrers ID:</td><td><input type=text name=referrer value='".$_GET["REF"]."'><br /> <br />
  34. <input type='submit' value='Create User' /></form>";
  35. }
  36. {
  37. if($_POST['password'] != $_POST['cpassword'])
  38. {
  39. print "<b>Registration</b><form action=register.php method=post><table width='75%' border='0'>
  40. <tr>
  41. <td colspan='2' align='center'><span style='color:red; font-weight: 800;'>! ERROR: The passwords did not match</span></td>
  42. </tr>
  43. <tr>
  44. <td width='50%'>Username:</td><td><input type=text name='username'></td>
  45. </tr>
  46. <tr>
  47. <td width='50%'>Password:</td><td><input type=password name='userpass'></td>
  48. </tr>
  49. <tr>
  50. <td width='50%'>Confirm Password:</td><td><input type=password name='cpassword'></td>
  51. </tr>
  52. <tr>
  53. <td width='50%'>E-Mail Address:</td><td><input type=text name='email' ><br> <font color=red>Must be valid in order to activate your account!!!!!!</font></td>
  54. </tr>
  55. <tr>
  56. <td width='50%'>Your Referrers ID:</td><td><input type=text name=referrer value=".$_GET["REF"]."'></td>
  57. </tr>
  58. <tr>
  59. <td colspan='2' align='center'><input type='submit' value='Create User' /></td>
  60. </tr></table></form>";
  61. }
  62. exit;
  63. {
  64. $r=@mysql_fetch_array($q);
  65. $pass=strip_tags($r['userpass']);
  66. $pass=md5($pass);
  67. $username=($r['username']);
  68. $email=($r['email']);
  69. $money=($r['money']);
  70. $db->query("INSERT INTO users (username, userpass,level, money, crystals, donatordays, energy, maxenergy, will, maxwill,brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney) VALUES( '{$_POST['username']}', md5('{$_POST['userpass']}'), '1', '1000', '0', '3', '12', '12', 100, 100, '3', '3', '100', '100', 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1)");
  71. $i=@mysql_insert_id($c);
  72.  
  73. mail( $_POST['email'], "Murder Town Account Validation",
  74. "Hi {$username},
  75.  
  76. Your email has just been used to register an account on Mafia Fight Club.
  77.  
  78. To validate your account, copy and paste this into your browsers address bar:
  79. http://www.murder-town.com/validate.php?act=val&token=$key
  80. <a href='http://www.murder-town.com/validate.php?act=val&token=$key'>AOL users click here to validate your account</a>
  81.  
  82. Or to cancel the registration:
  83. http://www.murder-town.com/validate.php?act=can&token=$key
  84. <a href='http://www.murder-town.com/validate.php?act=can&token=$key'>AOL users click here to cancel your account</a>
  85.  
  86. Username: $username
  87. Password: {$_POST['userpass']}
  88.  
  89. Thanks,
  90. Diego ", "From: validations@murder-town.com");
  91. mysql_query("UPDATE users SET crystals='crystals+8' WHERE userid={$_POST['referrer']}",$c) or print mysql_error();
  92. print "<b>Registration Complete</b><br />
  93. Please check your email to validate your Mafia Fight Club account and begin playing or go login.<br>
  94. <b>Note:</b> The email may have been sent to your spam/junk box, please check these if you cannot find it.<br>";
  95. $q = mysql_query("SELECT `username` FROM `users` WHERE `userid` = ".$_POST["referrer"]."") or print mysql_error();
  96. print "<i>For reffering you to Murder Town, ".mysql_result($q,0,0)." has recieved eight crystals!";
  97. }
  98. {
  99. print "<b>Registration Complete</b><br>
  100. Please check your email..our validation link is acting abnormal so if it doesnt not work, message Diego at joerollsresurrected@hotmail.com to validate your Mafia Fight Club account and begin playing.<br>
  101. <b>Note:</b> The email may have been sent to your spam/junk box, please check these if you cannot find it.<br><b>You have until midnight EST to validate your account, and the staff is online at all times.<br> Please do so as soon as possible or it will be deleted.</b>";
  102. }
  103. {
  104. print "<b>Registration</b><br />
  105. You will receive an email to the address you specify, follow the instructions there to validate your account.
  106. <form action=register.php method=post><table width='400' border='1'>
  107. <tr>
  108. <td width='50%'>Username:</td><td><input type=text name=userid></td>
  109. </tr>
  110. <tr>
  111. <td width='50%'>Password:</td><td><input type=password name=password></td>
  112. </tr>
  113. <tr>
  114. <td width='50%'>Confirm Password:</td><td><input type=password name=cpassword></td>
  115. </tr>
  116. <tr>
  117. <td width='50%'>E-Mail Address:</td><td><input type=text name=email><br> <font color=red>Must be valid</font></td>
  118. </tr>
  119. <tr>
  120. <td width='50%'>Your Referrers ID:</td><td><input type=text name=referrer value='".$_GET["REF"]."'></td>
  121. </tr>
  122. <tr>
  123. <td width='50%'>Promo Code:</td><td><input type=text name=promo></td>
  124. </tr>
  125. <tr>
  126. <td colspan='2' align='center'><input type='submit' value='Register' /></td>
  127. </tr></table></form>";
  128. {
  129. print "Registration Complete!<br />
  130. <a href='login.php'>&gt; Go to Login</a>";
  131. }
  132. $h->endpage();
  133. ?>
Oct 12 '07 #1
Share this Question
Share on Google+
1 Reply


nathj
Expert 100+
P: 938
Hi,

I've had a look over the code and I think the problem is with the { characters you've got, the } don't atch up. One example of this is on line 72 - it appears that there is a'{' that is not needed.

There are a couple of overs with the IF structure you use. I'd read through the code and make sure they all match properly. Then try it again.

Cheers
nathj
Oct 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.