Jump to content
cristian.pana

Afla IP (Real)

Recommended Posts

Afla ip-ul real din spatele unui proxy. Aceste coduri sunt functionabile numai in cazul in care serverul pe care rulati este Apache (nu Litespeed) si au instalate HTTP_X_REAL_IP si HTTP_X_FORWARDED_FOR


function ip() {
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP,
FILTER_FLAG_NO_PRIV_RANGE ) ) {
$_SERVER['REMOTE_ADDR'] = filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE ) ;
} else
if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) && filter_var( $_SERVER['HTTP_X_REAL_IP'], FILTER_VALIDATE_IP,
FILTER_FLAG_NO_PRIV_RANGE ) ) {
$_SERVER['REMOTE_ADDR'] = filter_var( $_SERVER['HTTP_X_REAL_IP'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE ) ;
} else {
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'] ;
}
if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'] ;
}
}
return $_SERVER['REMOTE_ADDR'] ;
}

SAU


function ip() {
$address = $_SERVER['REMOTE_ADDR'] ;
if ( ! empty( $_SERVER['HTTP_X_REAL_IP'] ) ) {
$ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP'] ;
}
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$ip[] = 'X-Forwarded-For: ' . $_SERVER['HTTP_X_FORWARDED_FOR'] ;
}

if ( ! empty( $ip ) ) $address .= '(' . implode( ',', $ip ) . ')' ;

return $address ;
}

  • Downvote 1
Link to comment
Share on other sites

eu am o intrebare daca folosesti un program de scanat porturi 21,139,etc... poti sa iti scumnzi ip cand scanezi de acasa astfel de poruturi?
:-B~X( Esti sigur ca intelegem ceea ce vrei?

Tic, tac, tic,tac ... raspunsul e, de acasa poti sa-l scanezi, dar va trebui sa accepte programul proxy/sock, si nu prea e recomandat.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...