Detecting IP Address of someone using ‘copy’ function [closed]

Here is a road map to do this. You should adjust this code to your exact requirements: You can detect copy event in JavaScript using this code in your page <script> jQuery(document).ready( function($) { function myFunction() { // here make an ajax call to send data to server $.ajax({ url: “http://yourwebsite.com”, type: ‘POST’, data: {‘copied’: … Read more

Show my custom post id if a country or ip

I believe you can do something like this (not tested): if($_SERVER[‘REMOTE_ADDR’]==”89.0.0.0″ && $post->ID==15){ $post5 = get_post(‘5′); echo $post5->post_title; //Call custom meta using $post5->ID; } Update: If you’d like to replace the original object you can do the following: if($_SERVER[‘REMOTE_ADDR’]==”89.0.0.0″ && $post->ID==15){ global $post; $post = get_post(‘5’); setup_postdata($post); //Here you can call for the_content() or the_title … Read more

Log IP of users who click a button? [closed]

It depends on how the button works. For instance, you can make an API. When the button is clicked, you can call the api via Ajax and save the IP during the process. Or most likely you will write ip via action hook, if the button call the hook. In this case, you will use … Read more

Test for IP in Array Always Fails on First IP

There are two pieces to this code: 1) Interpreting the list of allowed IPs from a textarea, delimited by newline character, and 2) Checking if a given user’s IP is in the allowed list of IPs. Part 1) Parse list of IPs delimited by newline character, and trim whitespace: $_POST[‘allowed_ips’] = ” 67.6.134.102 97.118.69.236 “; … Read more

Changing the site URL

If you have access to phpmyadmin the best way in my opinion is to get WP migrate Db Plugin, then create an export sql file with new url address and upload it with PhpmyAdmin. That way you ensure that every place in the site with old url get replaced with new url in a safe … Read more

Using a page-template to restrict access based on IP (Frontend)

Now I have it working! In the meanwhile Jeff Cohan also gave the right advice on how to do it (see his comment on the question). Here’s my full code, working the way he suggested: function getUserIP() { $client = @$_SERVER[‘HTTP_CLIENT_IP’]; $forward = @$_SERVER[‘HTTP_X_FORWARDED_FOR’]; $remote = $_SERVER[‘REMOTE_ADDR’]; if (filter_var($client, FILTER_VALIDATE_IP)) {$ip=$client;} elseif (filter_var($forward, FILTER_VALIDATE_IP)) {$ip=$forward;} … Read more