rejetto forum

General => Everything else => Topic started by: 1001questions on October 11, 2015, 05:22:58 AM

Title: How to change "Default File Mask" with "event scripts" option?
Post by: 1001questions on October 11, 2015, 05:22:58 AM
With the "Event Scripts" option: How do change my default file mask based upon a certain incoming IP Address? Example: IF a certain incoming IP address is: blah, blah, blah, then set default file mask to: blah, blah, blah, thanks

1001 questions
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: rejetto on October 11, 2015, 03:15:35 PM
i guess you should be using event [request]
there's no command to change the default file mask, currently, but you can do the same by just redirecting.
the code should be something like

{.if| {. %ip% = 1.2.3.4 .}{. {.cut|-1||%url%.} = / .} |{:
  {.add header|location: /my/other/path.}
:}.}


UNTESTED!
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: 1001questions on October 11, 2015, 04:36:17 PM
I can't get the redirect to work. What am I doing wrong?
This is my code:( "INDEX02.HTM" is in the same directory as my default index file.)  thanks, 1001 questions

[request]

{.if| {. %ip% = 71.223.211.243 .}{. {.cut|-1||%url%.} = /INDEX02.htm .} |{:
  {.add header|location: /my/other/path.}
:}.}
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: bmartino1 on October 11, 2015, 06:32:13 PM
well for starters, let look at this macro..: http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands


her is the untested code via rejeto:
----------------------(this code may not even work....)
{.if| {. %ip% = 1.2.3.4 .}{. {.cut|-1||%url%.} = / .} |{:
  {.add header|location: /my/other/path.}
:}.}

-----------------------
Here is your code
[request]

{.if| {. %ip% = 71.223.211.243 .}{. {.cut|-1||%url%.} = /INDEX02.htm .} |{:
  {.add header|location: /my/other/path.}
:}.}

---------------
I believe the info is in the wrong places... i think this is the correct code with the info you provided:

{.if| {. %ip% = 71.223.211.243 .}{. {.cut|-1||%url%.} = / .} |{:
  {.add header|location: /INDEX02.htm.}
:}.}

Here is how i come to this conclusion:
if > ip address then cut form HFS root
add header redirect to path location...

(ONLY IF THE CODE STILL FAILS!):
other wise you wil have to look at java script and html code to do such redirect:
http://stackoverflow.com/questions/13857734/redirect-user-to-diffrent-website-based-on-location-ip-address

html to redirect to another site:
<META http-equiv="refresh" content="0;URL=http://www.indiana.edu/~account/new-directory">

*THE "0" means as soon ASAP!... its recommend to be at 5....
just need to din the code to put it into if then programing so when the ip hits, it gets html meta redirect...
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: 1001questions on October 11, 2015, 07:10:49 PM
Thanks for all your help! But a "redirect" won't work for my application. I need to stay in the same "URL". Are you sure there is no way to serve up a different "home page" (i.e. different default file mask in the same directory) if a certain event takes place? (i.e. a request from a specific IP Address) I am no programmer, but it doesn't seem (to me anyway) to be that complicated to implement in the HFS application the following code: IF "a certain condition" (i.e. request from a specific IP address) THEN "serve up" "filename.htm" as the default file mask, ELSE "default file mask does not change

Again, thanks for all you help to this point.

1001 questions
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: 1001questions on October 11, 2015, 10:59:42 PM
In other words: IF, incoming IP address request = 1.2.3.4, serve up: "filename.htm" (as your home page) INSTEAD OF: "default file mask"  Can this be added or implemented into HFS as a network event?

thanks again.

1001 questions
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: bmartino1 on October 12, 2015, 09:08:02 PM
Ok, i think i may have the solution for you then.

If i'm reading your post directly,l you need index2.htm to be the default home page.
see picture to do this....

In hfs, the house icon otherwise know as root " / "

right click properties
Different template tab
paste everything in the index2.htm into that area

----------------
then you can use redirect to links within the same url....

know when you go to your public ip / dns name / the home page will load what ever is in index2.htm

Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: rejetto on October 17, 2015, 06:29:31 PM
yes, instead of redirecting you can

{.load|yourfile.html.}
{.break.}
Title: Re: How to change "Default File Mask" with "event scripts" option?
Post by: Fysack on September 17, 2016, 02:41:20 AM
hardcore my man, haaaaardcore  *superpossitive*