RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1035 | Replies: 2
Reply
Join Date: Apr 2006
Posts: 14
Reputation: Ries is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

Unexpected T_STRING

  #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
<?PHP
switch ($pg) {
    case login:
      $dbh=mysql_connect ("localhost", "projecte_ries", "*********") or die ('I cannot connect to the database because: ' . mysql_error());
      mysql_select_db ("projecte_gamedb"); 
      $_POST['email'] == $email;
      $_POST['password'] == $pass; 
      if (!isset($_POST['email'])) {
            $error == 1;
            die('<center><body bgcolor=black>No email address was entered into the email field</body></center>');
      }
      if (!isset($_POST['password'])) {
            $error == 1;
            die('<center>You did not input a password in the password field</body></center>');
      }

      $checklog = mysql_query("SELECT user,pass FROM members WHERE `email`='$email'")or die(mysql_error());
      while($checked = mysql_fetch_array($checklog)) {
      if ($checked['password'] != $pass) {
          $error = 1;
          die('<center>You entered a incorrect password :o</center>');
      }else{
          echo "<meta http-equiv='Refresh' content='0;url=members.php'>";
      }
      }
      break;    
    case register:
      echo "<html>
      <head>
      <title>Red Winter</title>
      </head>
      <body><center><table width='600' height='200'><tr><td></tr></td></table>";    
      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' />";
      echo "<br /><input type='submit' value='Register' /></form>";
      break;  
    case register2:
      echo "<html>
      <head>
      <title>Red Winter</title>
      </head>
      <body><center><table width='600' height='200'><tr><td></tr></td></table>"; 
      $_POST['email'] == $email;
      $_POST['pass'] == $pass;
      $_POST['user'] == $user;   
      $reg = mysql_query("SELECT * FROM members WHERE `email`='$email' ")or die(mysql_error());
      @$numm = mysql_num_rows($reg);
        if ($numm == "1"){
           die('Someone already has an account with that email, you can't have multis');
      }
      $sign = mysql_query("SELECT * FROM members WHERE `user`='$user' ")or die(mysql_error());
      @$sigg = mysql_num_rows($sign);
        if ($sigg == "1"){
           die('That username is already in use, go back and try another.');
      }
      $add = mysql_query("INSERT INTO members ('user','pass','email') VALUES ('$user','$pass','$email') ")or die(mysql_error());
      echo "You can now login and play :D<br />";
      break;
    default:
      $dbh=mysql_connect ("localhost", "projecte_ries", "********") or die ('I cannot connect to the database because: ' . mysql_error());
      mysql_select_db ("projecte_gamedb"); 
      $sigings = mysql_query("SELECT * FROM members")or die(mysql_error());
      @$signed = mysql_num_rows($sigings);
      echo "<html>
      <head>
      <title>Red Winter</title>
      </head>
      <body><center><table width='600' height='200'><tr><td></tr></td></table>  "; 
      echo "
      <style type='text/css'>
      input, textarea, select {
      color: white;
      background: #000000;
      border: solid white 1px;
      }
      a {
      text-decoration: none;
      text-transform: none;
      color: white;
      font-family: verdana;
      font-size: 10px;
      }
      body {
      background: #000000;
      background-attachment: fixed;
      background-possition: center;
      font-family: verdana;
      color: white;
      font-size: 10px;
      }
      </style>
      $signed people are already playing!<br />
      <form action='index.php?pg=login' method='post'>
      email:<input type='text' name='email' /><br />
      pass: <input type='password' name='password' /><br />
      <input type='submit' value='Login' /><br /><br /><br />
      <a href='index.php?pg=login'>Login</a> : <a href='index.php?pg=register'>Register</a> : <a href='index.php?pg=tos'>ToS</a>";
      break;
}
?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: Auckland, New Zealand
Posts: 136
Reputation: sarahk is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
sarahk's Avatar
sarahk sarahk is offline Offline
Junior Poster

Re: Unexpected T_STRING

  #2  
Apr 19th, 2006
on this section of code
@$numm = mysql_num_rows($reg);
		if ($numm == "1"){
		   die('Someone already has an account with that email, you can't have multis');
	  }
your error message has a ' in it

so change it to
die("Someone already has an account with that email, you can't have multis");
or
die('Someone already has an account with that email, you can\'t have multis');
Reply With Quote  
Join Date: Apr 2006
Posts: 4
Reputation: loanskey is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
loanskey loanskey is offline Offline
Newbie Poster

Re: Unexpected T_STRING

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:36 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC