I need a litle help about fsockopen function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matrixc
    New Member
    • Nov 2011
    • 1

    I need a litle help about fsockopen function

    I need a little help with the fsockopen function.

    I have this PHP code

    Code:
       if (    in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554,47830,50070))
        || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 1))
    I need to make @fsockopen check IPs by port 80 if it doesn't request authentication.

    I think I should use isset($_SERVER['PHP_AUTH_USER']) in there somewhere, but I can't do it by myself. Can anyone help?

    Thank you very much
  • Artnessde
    New Member
    • Nov 2011
    • 13

    #2
    $_SERVER['REMOTE_PORT'] is a random port of the visiting user.
    $_SERVER['REMOTE_ADDR'] is the IP of the visiting User.

    Why are you checking a random non standardport against a fixed list of standard ports?.

    If you want to check if the visitor is using Port 80, check $_SERVER["SERVER_POR T"] as this is the port the user is connected by the protocol he is using.

    2nd question is, where do you want to connect to? To the visitors PC, 99% chance he is behind a Firewall and has no local http server running.

    Comment

    Working...