473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

I need a litle help about fsockopen function

I need a little help with the fsockopen function.

I have this PHP code

Expand|Select|Wrap|Line Numbers
  1.    if (    in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554,47830,50070))
  2.     || @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
Nov 24 '11 #1
1 2149
$_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_PORT"] 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.
Nov 26 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: wandaring | last post by:
here's my problem If a visitor comes to visit my site and puts in his / her browser www . mysite.com/Ceciliasfirstpage.html (excluding the space) I want Ceciliasfirstpage.html to be generated...
1
by: Alex Vinokur | last post by:
========================= Windows 2000 Professional Digital Mars C/C++ 8.36 STLport 4.5.3 ========================= I have got a problem with compilation of the following piece of code using...
2
by: brian | last post by:
question about Onload function can one define more than one function for Onload ? <body Onload="function1()"> or can one define multiple functions one after another like <body Onload="f() g()...
5
by: Jim | last post by:
Need help with aggregate function...for each unique product, I need the provider with the cheapest cost factor Here't the table (Table1) ID product provider factor 1 123456 abc...
2
by: Kiran | last post by:
Hi, Need info about Uttara Info Systems Bangalore, who train for UNIX and C. I heard it is world famous. Regards Kiran
1
by: santus | last post by:
Hello, I've just join this forum and i need help about using matlab function from .net. I need to make a program to plot data into 2D graphics and the program use use mathematics functions. ...
3
by: johnperl | last post by:
Hi, I have a question about the perl 'undef' function. I am using it to read all line at once in once string. In the same script i am using sftp to transfer the file created by the script which...
2
by: Wayne Shu | last post by:
Hi everyone, Today I meet a problem about virtual function. Consider the following little program. #include <iostream> class base { int i;
20
by: xiao | last post by:
Hi~ every one~ I have a queston about fread function. if i have a code like this: (nscrdh and data are defined as two dementional arrays and both of them were stored in the same binary file) ...
0
by: smokenlinks | last post by:
I am working on a script and i get this error Warning: fsockopen() : unable to connect to https://www.alertpay.com:443 (Unable to find the socket transport "https" - did you forget to enable it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.