Author Topic: How to change "Default File Mask" with "event scripts" option?  (Read 2939 times)

0 Members and 1 Guest are viewing this topic.

Offline 1001questions

  • Occasional poster
  • *
  • Posts: 12
    • View Profile
    • CHEAPFORCASH.com
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

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12903
    • View Profile
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #1 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!

Offline 1001questions

  • Occasional poster
  • *
  • Posts: 12
    • View Profile
    • CHEAPFORCASH.com
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #2 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.}
:}.}

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 790
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #3 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...
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline 1001questions

  • Occasional poster
  • *
  • Posts: 12
    • View Profile
    • CHEAPFORCASH.com
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #4 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

Offline 1001questions

  • Occasional poster
  • *
  • Posts: 12
    • View Profile
    • CHEAPFORCASH.com
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #5 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

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 790
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #6 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

« Last Edit: October 12, 2015, 09:09:48 PM by bmartino1 »
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12903
    • View Profile
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #7 on: October 17, 2015, 06:29:31 PM »
yes, instead of redirecting you can

{.load|yourfile.html.}
{.break.}

Offline Fysack

  • Tireless poster
  • ****
  • Posts: 597
  • present picture
    • View Profile
    • Admin
Re: How to change "Default File Mask" with "event scripts" option?
« Reply #8 on: September 17, 2016, 02:41:20 AM »
hardcore my man, haaaaardcore  *superpossitive*
GOD CAN READ YOUR MIND