Find user ID by username

Discussion in 'PHP' started by papa_face, Sep 16, 2007.

  1. #1
    Hello,
    Does anyone know of a way to find out the user ID of a particular username on this forum?

    For instance, I would enter into the script a username, it would then find out the user ID.

    Thanks :D
     
    papa_face, Sep 16, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    function fetch_userid($username)
    {
    	preg_match(
    		'/&u=(\d+)"/',
    		file_get_contents('http://forums.digitalpoint.com/member.php?username='. rawurlencode($username)),
    		$match
    	);
    	return $match[1];
    }
    
    
    echo fetch_userid('nico_swd');
    
    
    PHP:
     
    nico_swd, Sep 16, 2007 IP
    Im The ONE likes this.
  3. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #3
    Thanks for that :D
    I had no idea you could use that in the member.php file lol
     
    papa_face, Sep 16, 2007 IP