Smee Posted April 28, 2010 Share Posted April 28, 2010 I am getting the following error: Parse error: syntax error, unexpected '{' in /home/footba33/public_html/activate.php on line 25 Line 25 is this: if ( ($x > 0) && (strlen($y) == (32)) { in the following activate.php, i have checked it several times and can't see a reason for it not to work? Any help would be good. Thanks! <?php // This page activates a user account require_once ('./includes/config.inc.php'); $page_title = 'Activate Your Account'; include ('./includes/header.html'); if (isset($_GET['x'])) { $x = (int) $_GET['x']; } else { $x = 0; } if (isset($_GET['y'])) { $y = $_GET['y']; } else { $y = 0; } // If $x and $y are not correct re-direct user. if ( ($x > 0) && (strlen($y) == (32)) { require_once ('../mysql_connect.php'); $query = "UPDATE users SET active=NULL WHERE (user_id=$x AND active='" . escape_data($y) . "') LIMIT 1"; $result = mysql_query ($query) or trigger_error("Query: $query\n <br />MySQL Error: " . mysql_error()); // Print a customized message if (mysql_affected_rows() == 1) { echo "<h1>Your account has now been activated. You can now log in.</h1>"; } else { echo '<p><font color="red" size="+1">Your account could not be activated. Please re-check the link or contact the system administrator.</font></p>'; } mysql_close(); } else { // Redirect $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for trailing slash if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop of the slash } // Add the page $url .= '/index.php'; ob_end_clean(); // Delete the buffer header("Location: $url"); exit(); // Quit the script } include ('./includes/footer.html'); ?> Link to comment https://forums.phpfreaks.com/topic/200092-activatephp/ Share on other sites More sharing options...
ialsoagree Posted April 28, 2010 Share Posted April 28, 2010 You're missing a parenthesis: if ( ($x > 0) && (strlen($y) == (32)) ) { Link to comment https://forums.phpfreaks.com/topic/200092-activatephp/#findComment-1050199 Share on other sites More sharing options...
Smee Posted April 28, 2010 Author Share Posted April 28, 2010 oh my.. think i have been doing this too long for one night Thanks mate! Link to comment https://forums.phpfreaks.com/topic/200092-activatephp/#findComment-1050200 Share on other sites More sharing options...
mrMarcus Posted April 28, 2010 Share Posted April 28, 2010 download Notepad++ which has syntax highlighting, which makes it easier to tell when you're missing - or have one too many parenthesis/curly braces. Link to comment https://forums.phpfreaks.com/topic/200092-activatephp/#findComment-1050201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.