View Single Post

  #2 (permalink)  
Old 12-03-2006
Ric
 
Posts: n/a
Default Re: Need help with an activate page

Anonymous schrieb:
> Here is my code, it doesn't seem to work, all it does is just redirect the
> url
>
> <?php # activate.php
> // This page activates the user's account.
>
> // Include the configuration file for error management and such.
> require_once('./php/config.inc.php');
>
> // Set the page title and include the HTML header.
> $page_title = 'Activate Your Account';
> include ('../php/header.php');
>
> // Validate $_GET['x'] and $_GET['y'].
> if (isset($_GET['x'])) {
> $x = (int) $_GET['x'];
> } else {
> $x = 0;
> }
> if (isset($_GET['y'])) {
> $y = $_GET['y'];
> } else {
> $y = 0;
> }
>

How about adding an error_log to see what the vars contain:

error_log("X: $x Y: $y");


> // If $x and $y aren't correct, redirect the user.
> if ( ($x > 0) && (strlen($y) == 32)) {


if you only see the redirect, then either $x is not greater 0 or $y
doesn't contain a value with 32 chars, right.


>
> require_once ('/whereever/mysql_connect.php'); // Connect to the
> database.
> $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 "<h3>Your account is now active. You may now log in.</h3>";
> } 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.
>
> // Start defining the URL.
> $url = 'http://www.ourvegankitchen.com';
>
> ob_end_clean(); //Delete the buffer.
> header("Location: $url");
> exit(); //Quit the script.
>
> } // End of main IF-ELSE.
>
> include ('../php/footer.php');
> ?>
>
>

Reply With Quote