Halletim arkadaslar buraya ekliyorum, ilgilenen arkadaslara tesekkürler;
<?
include("ayar.php");
function real_ip_adress() {
global $HTTP_SERVER_VARS;
$gizli_ipler = array( '10.0.0.', '192.168.', '127.0.0.', '172.16.0.' );
if( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '' ) {
$ip_strings = explode( ',',$_SERVER['HTTP_X_FORWARDED_FOR']);
foreach($ip_strings as $k => $v) {
if( empty($v) ) {
unset( $ip_strings[$k] );
} else {
if(!isset($ip_string)) {
$ip_string = $v;
}
}
}
}
if( isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '' ) {
$ip_strings[] = $_SERVER['REMOTE_ADDR'];
if(!isset($ip_string)) {
$ip_string = $_SERVER['REMOTE_ADDR'];
}
}
foreach($ip_strings as $k1 => $ip) {
foreach($gizli_ipler as $k2 => $pip) {
if(strpos($ip, $pip) === 0) {
unset($ip_strings[$k1]); break;
}
}
}
if(!empty($ip_strings) ) {
foreach( $ip_strings as $v ) {
if(!empty($v)) {
$ip_string = $v;
$is_local_ip = false;
break;
}
}
} else {
$is_local_ip = true;
}
return $ip_string;
}
$ip = real_ip_adress();
$a=$_GET['muzik_id'];
$oy=$_POST['oy'];
$s=mysql_query("SELECT * FROM oylama where ip='$ip' and muzik_id='$a'");
$kactane=mysql_num_rows($s);
if($kactane>0){
print ('<script language="Javascript">
alert("Daha Önce Oy Kullandiniz");
</script>');
}else{
$sorgu=mysql_query("INSERT INTO oylama (oy, muzik_id, ip) values ('$oy', '$a', '$ip')");
print ('<script language="Javascript">
alert("Oy Kullandiginiz Icin Tesekkurler");
</script>');
}
?>