How to ?
I want to control the visibility and access to a client plugin. If the user accessing the FTP server from within my local network (defined by IP range) the user must see and activate the menu item but if the usre come from the internet the user may not see it. If it is possible to access LUA server variables i would be possible to du this.
Can anyone tell me how to do it.
How to access LUA variables in client plugins
-
- Posts: 40
- Joined: Mon Feb 09, 2015 8:50 pm
-
- Site Admin
- Posts: 2107
- Joined: Tue Sep 29, 2009 6:09 am
Re: How to access LUA variables in client plugins
Yes, you can get the client IP by the Lua global variable "_REMOTE_IP".
-
- Posts: 40
- Joined: Mon Feb 09, 2015 8:50 pm
Re: How to access LUA variables in client plugins
Thanks, it works
To other, who need to create client menu entry. The code below control the IP number of the user, my WINGFTP server is behind a F5 proxy then all external users come from only one IP number. If they come from the Internet they do not have the menu entry. I they come from intranet they will see the menu entry.
<%
local tab1 = {}
if _REMOTE_IP == "xx.xx.xx.xx" then a=""; else
tab1.plugin_enabled = true
tab1.extbutton_name = "User manager"
tab1.extbutton_func = "show_mydiv1()"
tab1.extbutton_icon = "plugins/User_Adm_1/icon3.png"
tab1.need_selectfile = false
tab1.exthtml = [[ <div id="commandUser" style="position:absolute; border:0; z-index:50; top:75px;
left:500px; width:150px; height:10px; padding:1px; text-align:center;
background:#FFFFFF; display:none; onclick="hide_mydiv1()";>
<form action="http://my-server:8080/" method="get"><input type="image" src="plugins/User_Adm_1/icon3.png" alt="User Manager" ></form>
</div>
]]
tab1.extjs = [[
function show_mydiv1() { $("commandUser").style.display = "";}
function hide_mydiv1() { $("commandUser").style.display = "none";}
]]
register_plugin(tab1)
end
%>
To other, who need to create client menu entry. The code below control the IP number of the user, my WINGFTP server is behind a F5 proxy then all external users come from only one IP number. If they come from the Internet they do not have the menu entry. I they come from intranet they will see the menu entry.
<%
local tab1 = {}
if _REMOTE_IP == "xx.xx.xx.xx" then a=""; else
tab1.plugin_enabled = true
tab1.extbutton_name = "User manager"
tab1.extbutton_func = "show_mydiv1()"
tab1.extbutton_icon = "plugins/User_Adm_1/icon3.png"
tab1.need_selectfile = false
tab1.exthtml = [[ <div id="commandUser" style="position:absolute; border:0; z-index:50; top:75px;
left:500px; width:150px; height:10px; padding:1px; text-align:center;
background:#FFFFFF; display:none; onclick="hide_mydiv1()";>
<form action="http://my-server:8080/" method="get"><input type="image" src="plugins/User_Adm_1/icon3.png" alt="User Manager" ></form>
</div>
]]
tab1.extjs = [[
function show_mydiv1() { $("commandUser").style.display = "";}
function hide_mydiv1() { $("commandUser").style.display = "none";}
]]
register_plugin(tab1)
end
%>