https://faab007.nl
faab007nl / yourls-ip-viewer Goto Github PK
View Code? Open in Web Editor NEWA plugin that tracks the ip of users
License: MIT License
A plugin that tracks the ip of users
License: MIT License
I've been enjoying using this plugin but got frustrated with all the copy/paste to a whois tool when trying to get more info on who has clicked my links so I thought I'd try to add a hyperlink to the table listing IP addresses despite the fact that I don't really know how to code. After much trial and error (not to mention googling) I'm very excited that it works!
I think that others would find this useful and I'd like to share it besides making my first ever contribution to a GitHub project. Details are below but is there a better way to include this new functionality to the master?
What I did:
I added another column/header item to the end of the display table code so
<table> <tr> <th>IP</th> <th>Shorturl</th> <th>Referrer</th> <th>User Agent</th> <th>IP Address</th> <th>Country</th> <th>Date & Time</th> </tr> ";
became
table> <tr> <th>IP</th> <th>Shorturl</th> <th>Referrer</th> <th>User Agent</th> <th>IP Address</th> <th>Country</th> <th>Date & Time</th> <th>WhoIs</th> </tr> ";
That was the easy part.
Then, after lots of trying I got the next part to work. At the bottom of the table code, after
echo "<td><input value='".$row['click_time']."' readonly/></td>";
but before
echo "</tr>"; } echo " </table>
I added
echo "<td><a href=https://who.is/whois-ip/ip-address/{$row['ip_address']} target=_blank>" . $row['ip_address']."</a></td>";
I tried a few different whois tools, specifically https://iplocation.io/ip-whois-lookup and https://whois.domaintools.com/, but I found that https://who.is/ seems to work best without captchas, limits, etc. though it does take a bit long for each page to load. You can easily use the IP lookup tool of your choice, as long as it's accessed by concatenating the IP address in question within the URL by simply replacing https://who.is/whois-ip/ip-address/
with the URL (minus the IP address slug, that's handled automatically by the {$row['ip_address']}
piece) of the lookup tool you prefer.
Did I do good? Is this something that makes sense to include in the main code? If so, how to do so?
I suppose there is one issue that remains, the width of the added column for WhoIs makes the User Agent column data a bit too small. I'm not sure how to fix that but I suppose one option would be to remove the IP Address column now that this data is repeated in the new column but that seems less than ideal to me.
Thanks in advance for your input!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.