Skip to content

Instantly share code, notes, and snippets.

@andreibabor
Last active January 4, 2018 09:26
Show Gist options
  • Save andreibabor/cdf52f60eac31d58c99e786ff5368d41 to your computer and use it in GitHub Desktop.
Save andreibabor/cdf52f60eac31d58c99e786ff5368d41 to your computer and use it in GitHub Desktop.
Script - show my IP Address
<script type="application/javascript">
function getIP(json) {
alert("My public IP address is: " + json.ip);
}
</script>
<script type="application/javascript"
src="http://api.ipify.org?format=jsonp&callback=getIP">
</script>
<!-- END: IP Stuff -->
@andreibabor
Copy link
Author

@andreibabor
Copy link
Author

<script> jQuery.ajax( { url: '//freegeoip.net/json/', type: 'POST', dataType: 'jsonp', success: function(location) { if ( location.ip === '{{ settings.ip_address_1 }}' || location.ip === '{{ settings.ip_address_2 }}' || location.ip === '{{ settings.ip_address_3 }}' || location.ip === '{{ settings.ip_address_4 }}' || location.ip === '{{ settings.ip_address_5 }}' ) { console.log('ip active'); } else{ console.log('ip disabled'); IPRedirect.init({{ settings | json }}); IPRedirect.run(); } } }); </script>

iar in settings-> IP Redirect
{
"type": "header",
"content": "IP addresses"
},
{
"type": "text",
"id": "ip_address_1",
"label": "First IP",
"default": "67.171.183.81"
},
{
"type": "text",
"id": "ip_address_2",
"label": "Second IP",
"default": "10.0.0.97"
},
{
"type": "text",
"id": "ip_address_3",
"label": "Third IP",
"default": "173.11.9.157"
},
{
"type": "text",
"id": "ip_address_4",
"label": "Four IP",
"default": "192.168.1.75"
},
{
"type": "text",
"id": "ip_address_5",
"label": "Five IP",
"default": "192.168.1.254"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment