Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: GetIP Macro Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: July 17 2008 at 13:29 | IP Logged Quote TonyNo

This was in the programming section, so I just copied it over.

Make sure you first create a Global Variable called "IP"!

Code:
insert into macroheader values ('GET IP 2','GET IP',4,4,252,96,0,0,0,12632256,0,0,1,'',10);
insert into macrodetail values ('GET IP 2',1,15,'[LOCAL1]',NULL,'ph_geturl("www.ods.org/cgi-bin/myip")',0);
insert into macrodetail values ('GET IP 2',2,16,'',NULL,'if(left("[LOCAL1]",12) <> "HTTP/1.1 200",999,1)',0);
insert into macrodetail values ('GET IP 2',3,15,'[LOCAL2]',NULL,'pos("[LOCAL1]", "~r~n~r~n") + 4',0);
insert into macrodetail values ('GET IP 2',4,15,'[LOCAL3]',NULL,'pos("[LOCAL1]","~r~n",[LOCAL2])',0);
insert into macrodetail values ('GET IP 2',5,15,'[LOCAL1]',NULL,'mid("[LOCAL1]",[LOCAL2],[LOCAL3] - [LOCAL2])',0);
insert into macrodetail values ('GET IP 2',6,37,'',NULL,'Jump out if same',0);
insert into macrodetail values ('GET IP 2',7,16,'',NULL,'if("[LOCAL1]" = "{IP}",999,1)',0);
insert into macrodetail values ('GET IP 2',8,10,'IP',NULL,'"[LOCAL1]"',0);

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: July 17 2008 at 13:34 | IP Logged Quote TonyNo

Here is another version...

Code:
10 Set System [LOCAL1] ph_geturl( "www.ods.org/cgi-bin/myip")     
20 Jump if( left("[LOCAL1]",12) <> "HTTP/1.1 200",999,1)
30 Set System [LOCAL1] ph_regex("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+","[LOCAL1]",1,0,0,0)      
40 User Message "[LOCAL1]"      
50 Comment Jump out if same      
60 Jump if( "[LOCAL1]" = "{IP}", 999, 1)      
70 Jump if( len("[LOCAL1]") < 7, 999, 1)      
80 Set Global IP "[LOCAL1]"
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum