Unexpected T_STRING

Reply

Join Date: Apr 2006
Posts: 20
Reputation: Ries is an unknown quantity at this point 
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

Unexpected T_STRING

 
0
  #1
Apr 19th, 2006
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
  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.  
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 138
Reputation: sarahk is an unknown quantity at this point 
Solved Threads: 1
sarahk's Avatar
sarahk sarahk is offline Offline
Junior Poster

Re: Unexpected T_STRING

 
0
  #2
Apr 19th, 2006
on this section of code
  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
  1. die("Someone already has an account with that email, you can't have multis");
or
  1. die('Someone already has an account with that email, you can\'t have multis');
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 4
Reputation: loanskey is an unknown quantity at this point 
Solved Threads: 0
loanskey loanskey is offline Offline
Newbie Poster

Re: Unexpected T_STRING

 
0
  #3
Apr 19th, 2006
look on this line

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

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 "\"
Ravish Kumar
I run Loanskey ( A Loan and Mortgage infomation company) and RealEstateCut ( A real estate listing websites ) . I love both of these websites. and this is a subdomain of the loanskey for UK
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC