Display Country Flag by IP

2019-08-05 17:33发布

I want to be able to display the Country Flag image by the IP. The IPs are stored in Mysql in a column, each page has it's own row with IP like so:

TABLE:
PAGEID    INFO    IP
12340     abc     120.120.120.120
12341     fgh     121.121.121.121
12342     ert     122.122.122.122
12343     bvn     120.120.120.120  
12344     hjk     123.123.123.123

So when a user open it will get the IP by the page id from mysql and then decide what country flag to display based on the IP.
Is there such a script like this besides the one below?

This is a similar script i found but it's not working:

<IMG SRC="http://api.hostip.info/flag.php?ip=12.215.42.19">
<IMG SRC="http://api.hostip.info/flag.php?ip=<YOUR IP HERE>">

1条回答
Luminary・发光体
2楼-- · 2019-08-05 17:59

refer to this article ,use switch case or if else to echo your flag tutorial

查看更多
登录 后发表回答