943,520 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1529
  • PHP RSS
Apr 19th, 2006
0

Unexpected T_STRING

Expand Post »
This is my code but I get the error
Parse error: parse error, unexpected T_STRING in /home/projecte/public_html/index.php on line 48

When I try it, any ideas on whats gone wrong
PHP Syntax (Toggle Plain Text)
  1. <?PHP
  2. switch ($pg) {
  3. case login:
  4. $dbh=mysql_connect ("localhost", "projecte_ries", "*********") or die ('I cannot connect to the database because: ' . mysql_error());
  5. mysql_select_db ("projecte_gamedb");
  6. $_POST['email'] == $email;
  7. $_POST['password'] == $pass;
  8. if (!isset($_POST['email'])) {
  9. $error == 1;
  10. die('<center><body bgcolor=black>No email address was entered into the email field</body></center>');
  11. }
  12. if (!isset($_POST['password'])) {
  13. $error == 1;
  14. die('<center>You did not input a password in the password field</body></center>');
  15. }
  16.  
  17. $checklog = mysql_query("SELECT user,pass FROM members WHERE `email`='$email'")or die(mysql_error());
  18. while($checked = mysql_fetch_array($checklog)) {
  19. if ($checked['password'] != $pass) {
  20. $error = 1;
  21. die('<center>You entered a incorrect password :o</center>');
  22. }else{
  23. echo "<meta http-equiv='Refresh' content='0;url=members.php'>";
  24. }
  25. }
  26. break;
  27. case register:
  28. echo "<html>
  29. <head>
  30. <title>Red Winter</title>
  31. </head>
  32. <body><center><table width='600' height='200'><tr><td></tr></td></table>";
  33. echo "<form action='index.php?pg=register2'>email:<input type='text' name='email' /><br /> pass:<input type='password' name='password' /><br /> username:<input type='text' name='user' />";
  34. echo "<br /><input type='submit' value='Register' /></form>";
  35. break;
  36. case register2:
  37. echo "<html>
  38. <head>
  39. <title>Red Winter</title>
  40. </head>
  41. <body><center><table width='600' height='200'><tr><td></tr></td></table>";
  42. $_POST['email'] == $email;
  43. $_POST['pass'] == $pass;
  44. $_POST['user'] == $user;
  45. $reg = mysql_query("SELECT * FROM members WHERE `email`='$email' ")or die(mysql_error());
  46. @$numm = mysql_num_rows($reg);
  47. if ($numm == "1"){
  48. die('Someone already has an account with that email, you can't have multis');
  49. }
  50. $sign = mysql_query("SELECT * FROM members WHERE `user`='$user' ")or die(mysql_error());
  51. @$sigg = mysql_num_rows($sign);
  52. if ($sigg == "1"){
  53. die('That username is already in use, go back and try another.');
  54. }
  55. $add = mysql_query("INSERT INTO members ('user','pass','email') VALUES ('$user','$pass','$email') ")or die(mysql_error());
  56. echo "You can now login and play :D<br />";
  57. break;
  58. default:
  59. $dbh=mysql_connect ("localhost", "projecte_ries", "********") or die ('I cannot connect to the database because: ' . mysql_error());
  60. mysql_select_db ("projecte_gamedb");
  61. $sigings = mysql_query("SELECT * FROM members")or die(mysql_error());
  62. @$signed = mysql_num_rows($sigings);
  63. echo "<html>
  64. <head>
  65. <title>Red Winter</title>
  66. </head>
  67. <body><center><table width='600' height='200'><tr><td></tr></td></table> ";
  68. echo "
  69. <style type='text/css'>
  70. input, textarea, select {
  71. color: white;
  72. background: #000000;
  73. border: solid white 1px;
  74. }
  75. a {
  76. text-decoration: none;
  77. text-transform: none;
  78. color: white;
  79. font-family: verdana;
  80. font-size: 10px;
  81. }
  82. body {
  83. background: #000000;
  84. background-attachment: fixed;
  85. background-possition: center;
  86. font-family: verdana;
  87. color: white;
  88. font-size: 10px;
  89. }
  90. </style>
  91. $signed people are already playing!<br />
  92. <form action='index.php?pg=login' method='post'>
  93. email:<input type='text' name='email' /><br />
  94. pass: <input type='password' name='password' /><br />
  95. <input type='submit' value='Login' /><br /><br /><br />
  96. <a href='index.php?pg=login'>Login</a> : <a href='index.php?pg=register'>Register</a> : <a href='index.php?pg=tos'>ToS</a>";
  97. break;
  98. }
  99. ?>
  100.  
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ries is offline Offline
20 posts
since Apr 2006
Apr 19th, 2006
0

Re: Unexpected T_STRING

on this section of code
PHP Syntax (Toggle Plain Text)
  1. @$numm = mysql_num_rows($reg);
  2. if ($numm == "1"){
  3. die('Someone already has an account with that email, you can't have multis');
  4. }
  5.  
your error message has a ' in it

so change it to
PHP Syntax (Toggle Plain Text)
  1. die("Someone already has an account with that email, you can't have multis");
or
PHP Syntax (Toggle Plain Text)
  1. die('Someone already has an account with that email, you can\'t have multis');
Reputation Points: 10
Solved Threads: 1
Junior Poster
sarahk is offline Offline
138 posts
since Apr 2005
Apr 19th, 2006
0

Re: Unexpected T_STRING

look on this line

Quote ...
if ($numm == "1"){
die('Someone already has an account with that email, you can't have multis');
}
you need to change it like

Quote ...
if ($numm == "1"){
die('Someone already has an account with that email, you can\'t have multis');
}
see the diffrence of comma,
you have to hide that in your code by "\"
Reputation Points: 10
Solved Threads: 0
Newbie Poster
loanskey is offline Offline
4 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: proj stuff
Next Thread in PHP Forum Timeline: Need Freelancing Partner





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC