البرمجه لـ php
سم القالب باي اسم كمثال
hayefip.php
<?php
echo 'User IP Address - '.$_SERVER['REMOTE_ADDR'];
?>
او
<?php
$ip=$_SERVER['REMOTE_ADDR'];
echo $ip;
?>
او
<?php
function getUserIpAddr(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
echo 'User Real IP - '.getUserIpAddr();
?>
او
<?php
function getIPAddress() {
//whether ip is from the share internet
if(!emptyempty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
//whether ip is from the proxy
elseif (!emptyempty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
//whether ip is from the remote address
else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = getIPAddress();
echo 'User Real IP Address - '.$ip;
?>
او
view plaincopy to clipboardprint?
<?php
session_start();
if(isset($_SESSION['count']))
{
echo "Your session count: ".$_SESSION['count']."<br />";
$_SESSION['count']++;
}
else
{
$_SESSION['count'] = 1;
echo "Session does not exist";
}
?>
وسلامتكم
ليست هناك تعليقات: