0

Hi i have this error if i send a message to a member on my site

That user does not exist or is not yet activated, press back

Although the member is activated ive also tried other members

here is the code thats sending it like it after installing the script

<?php 
include_once("php_includes/check_login_status.php"); 
// Initialize any variables that the page might echo 
$u = ""; 
$mail = ""; 
// Make sure the _GET username is set, and sanitize it 
if(isset($_GET["u"])){ 
    $u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); 
    } else { 
        header("location: index.php"); 
        exit(); 
} 
// Select the member from the users table 
$sql = "SELECT * FROM users WHERE username='$u' AND activated='1' LIMIT 1"; 
$user_query = mysqli_query($db_conx, $sql); 
// Now make sure that user exists in the table 
$numrows = mysqli_num_rows($user_query); 
if($numrows < 1){ 
    echo "That user does not exist or is not yet activated, press back"; 
    exit(); 
} 
2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by diafol
0

Place temporary echo commands at key places to find out where your script is going, e.g.

if(isset($_GET["u"])){ 
$u = preg_replace('#[^a-z0-9]#i', '', $_GET['u']); 
echo "GET isset and u value = $u";

} else { 
    header("location: index.php"); 
    exit(); 
} 

Use 'or die()' for mysqli functions

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.