rejetto forum

How to change "Default File Mask" with "event scripts" option?

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: 13510
    • View Profile
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
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: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
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...
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline 1001questions

  • Occasional poster
  • *
    • Posts: 12
    • View Profile
    • CHEAPFORCASH.com
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
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: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
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 »
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline Fysack

  • Tireless poster
  • ****
    • Posts: 598
  • present picture
    • View Profile
    • Admin