Jump to content

Activate.php


Smee

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.