Spotlight Xin code check IP trùng...

depkotie

Junior
Joined
Jun 6, 2013
Messages
44
Reactions
15
MR
0.000
Follow me on Facebook Chat with me via Skype X.com
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:

Permiser

Hero
Joined
Nov 11, 2012
Messages
1,335
Reactions
531
MR
0.008
lập trình web thì chak là pascal rồi chứ còn j :-??

Pascal
haiz.gif
 

sangmt

Senior
Joined
Apr 6, 2012
Messages
865
Reactions
1,210
MR
0.000
Chat with me via Skype
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 ???
 

zerbra

Junior
Joined
Mar 15, 2013
Messages
223
Reactions
176
MR
0.000
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
 

anmivn

Senior
Joined
Mar 8, 2011
Messages
531
Reactions
311
MR
0.002
<?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
 
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
423,678
Messages
7,138,240
Members
176,067
Latest member
quychuong

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom