Subscription Management: IP control

Dear Sir,

I want to do a IP control for our published papers, because we want it to free to China.

Are there any way to do this?

I am thinking control this by using subscription manager, I added all the IP from China as subscripted user. But there are a lot IP addresses, so I wonder if I could added this IPs via database.

If I can do this, how to do with the “INSERT INTO institutional_subscription_ip (institutional_subscription_ip_id, subscription_id, ip_string, ip_start, ip_end) values (’?’ ‘1’ ‘ip address’ ‘?’ ‘?’)”;

Especially how to do with the “ip_start” and “ip_end”.

Thank you in advance!

Regards,
Xianghua

Hi @lixh,

You can enter these manually into your database, but you’ll need to convert each IP address or IP range into its unsigned integer representation.

You can do this in PHP via the ip2long function, but you’ll need to make sure that the result is non-negative, i.e. $ipStart = sprintf(’%u’, ip2long(trim($ipStart));

Alternatively, in MySQL you can use the INET_ATON function in your INSERT statement which will return a non-negative integer by default.

For IP ranges, you’ll need to convert both the start and end IP address and insert them both into the database. For single IP addresses, you convert and insert the address into the ip_start column and set the ip_end column to null.

Here’s what some sample data should look like:

193.62.226.60 => ip_start: 3242123836 ip_end: NULL
146.57.128.0 - 146.57.131.255 => ip_start: 2453241856 ip_end: 2453242879
136.142.*.* => ip_start: 2291007488 ip_end: 2291073023

Cheers,
Michael