lpxxfaintxx Posted November 28, 2008 Share Posted November 28, 2008 I've been looking at the code for quite a while now, trying to see whats wrong. I just can't find it, so I thought some fresh eyes would do a better job. Parse error: syntax error, unexpected T_DEFAULT in /home/q94/public_html/alumnify.com/login.php on line 39 Line 39 is 'default:' <?php switch($_GET['action']){ case "login": if(isset($_POST['login'])) { $email = trim(addslashes($_POST['email'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM Users WHERE email = '$email' AND Password = '$password' LIMIT 1") or die (mysql_error()); $row = mysql_fetch_array($query); if(mysql_num_rows($query) > 0) { if($row['Activated'] > 0) { $_SESSION['s_logged_n'] = 'true'; $_SESSION['s_username'] = $username; $_SESSION['s_name'] = $row['Name']; $_SESSION['rank'] = $row['Activated']; } else { echo ' <p>Sorry, you must activate your account first. Please check your email for the activation email.</p> <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> '; } break; default: <html> include('includes/header.php'); <p>You must login to view this page. Enter your username and password below and hit submit:</p> <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>"> <p>Email Address:<br> <input name="email" type="text" Cid="email"> <p>Password:<br> <input name="password" type="password" id="password"> </p> <p> <input name="login" type="submit" id="login" value="Submit"> </p> </form> <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p> include('includes/footer.php'); </html> break; } ?> Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted November 28, 2008 Share Posted November 28, 2008 Look at the nice coloured syntax highlighting in your posting here, particularly after the default: in line 39, and then decide whether your PHP and HTML are getting mixed Quote Link to comment Share on other sites More sharing options...
lpxxfaintxx Posted November 28, 2008 Author Share Posted November 28, 2008 <?php switch($_GET['action']){ case "login": if(isset($_POST['login'])) { $email = trim(addslashes($_POST['email'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM Users WHERE email = '$email' AND Password = '$password' LIMIT 1") or die (mysql_error()); $row = mysql_fetch_array($query); if(mysql_num_rows($query) > 0) { if($row['Activated'] > 0) { $_SESSION['s_logged_n'] = 'true'; $_SESSION['s_username'] = $username; $_SESSION['s_name'] = $row['Name']; $_SESSION['rank'] = $row['Activated']; } else { echo ' <p>Sorry, you must activate your account first. Please check your email for the activation email.</p> <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> '; } break; default: <html> include('includes/header.php'); <p>You must login to view this page. Enter your username and password below and hit submit:</p> <form method="post" action="$_SERVER['PHP_SELF']"> <p>Email Address:<br> <input name="email" type="text" Cid="email"> <p>Password:<br> <input name="password" type="password" id="password"> </p> <p> <input name="login" type="submit" id="login" value="Submit"> </p> </form> <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p> include('includes/footer.php'); </html> break; } ?> Same problem. Quote Link to comment Share on other sites More sharing options...
revraz Posted November 28, 2008 Share Posted November 28, 2008 What are you trying to do with default: ? Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted November 28, 2008 Share Posted November 28, 2008 Alright. Let me give you a clue: default: <html> Since when was <html> a valid PHP command/function/variable name/anything Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.