Spotlight Xin code check IP trùng...

depkotie

Junior
Joined
Jun 6, 2013
Messages
44
Reactions
15
MR
0.000
Facebook
Follow me on Facebook
Skype
Chat with me via Skype
Google Plus
Follow me on Google Plus
Xin code PHP check IP trùng.........

Pro nào hảo tâm: share được thì share cho e vs nhé.
Đang tập tành học web...:binhsua18::binhsua18::binhsua18::binhsua18:
 
Last edited by a moderator:
lập trình web thì chak là pascal rồi chứ còn j :-??

Pascal
haiz.gif
 
Xin code PHP check IP trùng.........

Pro nào hảo tâm: share được thì share cho e vs nhé.
Đang tập tành học web...:binhsua18::binhsua18::binhsua18::binhsua18:
Hiểu sơ sơ là bác muốn 1IP chỉ được register 1 lần trên site offer phải không ???
 
Hiểu sơ sơ là bác muốn 1IP chỉ được register 1 lần trên site offer phải không ???

ĐÚng rồi pro, có không cho e xin với.
 
tạo 1 cột ip sau đó khi ai đó reg lưu ip lại, check ip trong csdl đã tồn tại chưa, dùng hàm $_SERVER['REMOTE_ADDR'] lấy ip người đăng kí

Trên csdl đã có sẵn cột ip lưu sẵn ip đã reg site, khi chưa dk site thì ta truy xuất IP hiện tại bằng hàm trên rồi làm sao để so sánh vs ip trong csdl vậy pro
 
<?php
$file = "ip.txt"
// file ip.txt bạn lưu như thế này
/*
123.456.789
147.258.369
741.852.963
*/
$data = file_get_contents($file);
if(preg_match("/".$_SERVER['REMOTE_ADDR']."/i",$data))
{
header("location: http://google.com"); // nếu tìm thấy ip
}
else
{
header("location: http://sinhvienit.net"); // nếu không tìm thấy ip
}
?>
 
Trên csdl đã có sẵn cột ip lưu sẵn ip đã reg site, khi chưa dk site thì ta truy xuất IP hiện tại bằng hàm trên rồi làm sao để so sánh vs ip trong csdl vậy pro
select cái cột lưu ip trong csdl ra và so sánh với cái ip get được quá hàm remote
 
select cái cột lưu ip trong csdl ra và so sánh với cái ip get được quá hàm remote

Pro có thể nói rõ hơn chút dc ko, có thì cho e cái code để truy và so sánh
 
Pro có thể nói rõ hơn chút dc ko, có thì cho e cái code để truy và so sánh
Code:
[COLOR=#0000BB][FONT=monospace]<?php 
$ip [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$_SERVER[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'REMOTE_ADDR'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]]; 
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$ipc [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_query[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"SELECT ip_address FROM survey_xxx WHERE ip_address='$ip'"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]); 

[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$num_results [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]mysql_num_rows[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$ipc[/FONT][/COLOR][COLOR=#007700][FONT=monospace]); 

if([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$num_results[/FONT][/COLOR][COLOR=#007700][FONT=monospace]==[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]0[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) 
{ 
    echo [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"cho mày qua"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]; 
} else { 
    echo [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"Mày xạo hả kon, chém cmm luôn!!!!!"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]; 
}  
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR]
 
Last edited by a moderator:

Announcements

Today's birthdays

Forum statistics

Threads
421,469
Messages
7,110,726
Members
173,644
Latest member
Paybackperiod

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom