Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 739855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:26:54+00:00 2026-05-14T08:26:54+00:00

I’m have a problem with an invite system. The if statement seems to break.

  • 0

I’m have a problem with an invite system. The if statement seems to break. It shows the message “Fail” but the UPDATE statement still executes. Why do both the THEN and the ELSE excute?

$dbConn = new dbConn();

// Check if POST user_username and user_hash are matching and valid; both are hidden for fields
$sql = "SELECT user_username "
    . "FROM table_users "
    . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"])." "
    . "AND user_hash='".mysql_real_escape_string($_POST["user_hash"])."' "
    . "AND user_enabled=0;";
$objUser = $dbConn->query($sql);

// If result contains 1 or more rows
if( mysql_num_rows($objUser) != NULL ){
    $objUser = mysql_fetch_assoc($objUser);

    $ssnUser->login( $objUser["user_username"] );

    $sql = "UPDATE table_users SET "
        . "user_enabled=1, "
        . "user_first_name='".mysql_real_escape_string($_POST["user_first_name"])."', "
        . "user_last_name='".mysql_real_escape_string($_POST["user_last_name"])."', "
        . "user_password='".mysql_real_escape_string( md5($_POST["user_password"]) )."' "
        . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"]).";";
    $dbConn->query($sql);

    echo "Success";
    header( "Refresh: 5; url=/account/?action=domains" );

} else {
    echo "Fail";
}

This dbConn Class is as follows:

class dbConn{
    var $username = "xxxx_admin";
    var $password = "xxxxxxxx";
    var $server = "localhost";
    var $database = "xxxx";
    var $objConn;

    function __construct(){
        $conn = mysql_connect( $this->server, $this->username, $this->password, true );
        if( !$conn ){
            die("Could not connect: ".mysql_error() );
        } else {
            $this->objConn = $conn;
        }
        unset($conn);
    }
    function __destruct(){
        mysql_close( $this->objConn );
        unset( $this );
    }
    function query( $query, $db = false ){
        mysql_select_db( $db != false ? $db : $this->database, $this->objConn );
        $result = mysql_query( $query );
        unset($query,$db);
        return $result;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:26:55+00:00Added an answer on May 14, 2026 at 8:26 am

    I don’t see anything really weird in your code. Could there be a “Fail” call in your login() method? Either way, I would change the line:

    if( mysql_num_rows($objUser) != NULL ){
    

    to:

    $rowCount = mysql_num_rows($objUser);
    if($rowCount and $rowCount > 0){
    

    And, put an exit(); call after your header() line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have just tried to save a simple *.rtf file with some websites and
I have text I am displaying in SIlverlight that is coming from a CMS
this is what i have right now Drawing an RSS feed into the php,
I have a JSP page retrieving data and when single or double quotes are
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
i got an object with contents of html markup in it, for example: string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.