Page 1 of 1

Getting External IP from computer

PostPosted: Mon Jun 30, 2014 12:07 pm
by NyperCro
Hi Neobookers

How to get users External IP using any acceptable code in Neobook ?
I need to get IP from users who using my software to disable multy accounts to be created
Thank you

Re: Getting External IP from computer

PostPosted: Mon Jun 30, 2014 12:57 pm
by dec
Hello,

May you want to use a service like WhatIsMyIp.com provide? Or some similar service of course.

Re: Getting External IP from computer

PostPosted: Mon Jun 30, 2014 5:01 pm
by virger
I would try this, create a button with this action ..
I hope you serve

Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=BtIp
X=11
Y=16
W=270
H=33
Anchor=0
Text=GetMy IP: [Ret1]
Align=1
ImageStyle=0
ObjAction=InternetPost "http://checkip.dyndns.org/" "" "[Ret]" "Async"¶StrParse "[Ret]" ":" "[Ret]" "[x]"¶strparse "[Ret2]" "<" "[Ret]" "[x]"¶¶..SEND EMAIL [Ret1]
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2


Desde COSTA RICA
Sigue Holanda

Re: Getting External IP from computer

PostPosted: Tue Jul 01, 2014 7:19 am
by dec
Hello,

One more thing: if you have your own server, probably you can run PHP scripts, and then, try to get the client IP address using PHP. You can prepare such PHP script in order to return just the IP address, then you only need to call to the "InternetGet" action and retrieve the server response.

Re: Getting External IP from computer

PostPosted: Tue Jul 01, 2014 7:27 am
by mishem

Re: Getting External IP from computer

PostPosted: Tue Jul 01, 2014 7:36 am
by dec
Hello,

mishem wrote:http://checkip.dyndns.org/


This is the server used by virger in their above code. However, this kind of service (depending on the HTTP request number or any other arbitrary limitations) are not free, because have a cost, and therefore may you cannot rely on these "free servers" for your applications, above all if these are commercial applications.

So the best option (IMHO) is to use some service provider like WhatIsMyIp.com (wich offers various price plans to suite your needs) or use your own web server, which you are paying anyway. Of course you are free to use "free servers", but, then no complaint about possible issues. And then try to explain that to your customers.

Another possible solution in this particular case can be to use the computer MAC address instead of the IP. Then the npMacAddresses action from my npUtil plugin can help. Maybe a combination of the user PC information can do the trick and therefore the IP address become not necessary, which can be good, since to obtain the IP address the user need an internet connection, which maybe is not what we wanted.

Re: Getting External IP from computer

PostPosted: Tue Jul 01, 2014 9:53 am
by virger
Looking at old programs I found this, it might help.

1) In Button:
InternetPost "http://www.MyServer.com/neobook.php?ori=1357" "" "[RetIp]" ""
2) The "php" in MyServer:
Code: Select all
<?php
// creado el      16:17 p.m. 11/04/2012
// modificado el   10:09 a.m. 01/07/2014
// MyEmail@hotmail.com
// AlguienEntro

$ori       = @$_REQUEST['ori'];
// si lo necesito      $usa    = @$_SERVER['PHP_AUTH_USER'];
$ip         = $_SERVER['REMOTE_ADDR'];

// para guardar inf en mi servidor:      $fp = fopen('quienentro.txt', 'a+');
//                              fwrite($fp, $ip."\t".date("d.m.Y, g:i a")."...".$ori."---".$usa."\n");
//                              fclose($fp);

//////////////////////////////////////
// mandar a mi email
$to         = "MyEmail@hotmail.com";
$subject    = "ENTRO: $ip";
$msg       = "Entro $ori Por 'IP': $ip.\t".date('d.m.Y, g:i a');
           // si estoy usandolo agrego:  ." USA ($usa)";
$headers    = "From: TheWatcher@hotmail.com";

//$headers    = "From: MyEmail@hotmail.com" . "\r\n" .  "CC: OtroEmail@hotmail.com";
/*$msg = $msg .'
                     ESTE SEPARADOR (\n) NO FUNCIONA DEBE SER CON
                     VERDADERO SALTO DE LINEA
                     COMO TAS';
$msg .= "
                     --- HOLA LOLA ---"; */
                     
$sn         = mail($to,$subject,$msg,$headers);

// si quiero condirmacion uso esta linea
// if ($sn) { echo "Enviado $ori---$usa" ;};
?>


COSTA RICA
MAKING HISTORY
PURA VIDA