<? set_include_path(".."); require_once( 'offensive/assets/header.inc' ); require_once( 'offensive/classes/assets.inc' ); require_once( "offensive/assets/activationFunctions.inc" ); require_once( 'admin/mysqlConnectionInfo.inc' ); if(!isset($link) || !$link) $link = openDbConnection(); $message = "There was a problem with your request."; $id = id_from_hash( $_REQUEST[ $hash_param_key ] ); $sql = "SELECT username,email,account_status from users where userid=$id"; $result = tmbo_query( $sql ); if( mysql_num_rows( $result ) == 1 ) { $row = mysql_fetch_assoc( $result ); $email = $row['email']; $username = $row['username']; $rehash = tmbohash( $id + 0, $email . $salt ); if( $rehash == $_REQUEST[ $hash_param_key ] ) { $sql = "UPDATE users SET timestamp = timestamp, account_status='normal' WHERE userid=$id AND account_status='awaiting activation' limit 1"; tmbo_query( $sql ); if( mysql_affected_rows() == 1 ) { $message = "Your account is now active. <a href=\"./\">Click here</a> to log in."; }
function userRowFromCode( $code ) { $id = id_from_hash( $code ); if( is_intger( $id ) && $id > 1 ) { $sql = "SELECT * FROM users WHERE userid = $id"; $result = tmbo_query( $sql ); if( mysql_num_rows( $result ) == 1 ) { $row = mysql_fetch_assoc( $result ); $hash = hashFromUserRow( $row ); if( $hash == $code ) { return $row; } } } return false; }