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;
}
?>

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');

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 "\"

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.