Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-10-2014, 06:17 AM
|
#1
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,186
|
how to show link on web page but only from lan ( hide from internet )
Basically what it says.
I have a webpage on my locally hosted server which displays some family photos in a grid with an edit button for simple editing ( rotate, add comment etc ), see first image.
I have configured apache so that if the edit button is clicked from the LAN the edit script is run, but if connecting from the internet clicking the edit button causes a
Code:
Forbidden
You don't have permission to access /cgi-bin/edit on this server.
error, which is what I want as I don't want all and sundry editing my photos!
But ideally I would like to hide the button completely if the page is accessed from the intanet.
The page is a statically built page by a small BASH script, it is NOT dynamically generated when accessing the page only when the page is created, the html tag that displays the thumbnail and button is:
Code:
<td>
<center> <a href="100-0653.jpg"><img
src="tmb/100-0653.jpg" alt="click to enlarge"></a> <font
size="-4">
<form
action="/cgi-bin/edit?name=/Photos/Pictures/America/100-0653.jpg"
method="post" style="padding: 0; margin: 0"> <input
value="Edit" type="submit"> </form>
</font> </center>
</td>
This is repeated for each image.
I'm pretty competent in Linux/programming, but have limited knowledge of html, so you can be as technical as you like in words of one syllable
I think I have to just hide everything in the form tags.
I can't seem to find anything on this with google.
|
|
|
12-10-2014, 07:32 AM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,892
|
Firstly; any content I can "see" on a web page, I can grab and edit. I just can't put it back because I'm not the author/editor of the web page.
An example is my google links:
I made a list of links which are my personal web links and I can reference that page from home, work, mobile, etc. I can edit it because I'm logged into my google account.
Meanwhile a family member liked what I have for links so they reference that as a bookmark but they can't edit it.
So maybe instead of developing it yourself you could use one of the web services like google, or yahoo to publish your page. In fact, your ISP may already permit this, or whatever web portal you're using to publish your page.
Then you may not have to even show the EDIT button, but instead you'll be able to see that you can edit the page as a whole when you're logged into your account, and anyone not logged in to your account, simply can't make changes.
|
|
|
12-10-2014, 07:46 AM
|
#3
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,186
Original Poster
|
Sorry no this is not what I want at all, I don't like google sites because they are slow and can only be created/changed via the awful web editor, ( I don't have a problem with google by the way I think they do a lot of good stuff that tends to get overlooked in the anti corp bashing, and I do actually have a couple of google sites on the go ), second I have been using a free web hosting site for many years and have been happy with it but more and more ISP's are blocking such domains under the impression that free = illegal! There is no porn, warez, links to so called 'black web' activities, I find the ISP's behavior that block such sites as outrageous!
I am aware that that I can copy any image on a web page and do what I like to it but can't put it back, the point is I set up the simple editor so that the pics CAN be edited, if using from the LAN, I trust people in my house! But my wife is not particularly computer savvy and I can't expect her to do the technical stuff, also I don't want to change the page just the pics, as I said I have already prevented the edit script from being used from the web, I would just like to hide the button, it's an aesthetic thing really.
|
|
|
12-10-2014, 08:07 AM
|
#4
|
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,504
|
You'd really be better off generating the page dynamically and then you'd have full control over what the user sees based on client IP address. If it's purely aesthetic then a quick Google search turns up this:
http://stackoverflow.com/questions/2...-on-ip-address
Which I've not tried to be honest as I generally use PHP for everything these days.
|
|
|
12-10-2014, 08:24 AM
|
#5
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,186
Original Poster
|
Quote:
Originally Posted by TenTenths
You'd really be better off generating the page dynamically and then you'd have full control over what the user sees based on client IP address...
|
Thanks for link, but people are REALLY not looking at the request I want to HIDE A BUTTON, the website is working fine other than that, I DO NOT WANT TO DYNAMICALLY PRODUCE PHOTOS, these are family pics that need a one off edit, rotate, trash etc, the edit will be a 'real' edit and permanently alter the photos ( yes I have backups ), it's NOT just to alter what is being seen.
It's my web site this part is designed for me and my family only, there is another part that deals with all my released software, themes etc, this is how I want to do it.
|
|
|
12-10-2014, 08:40 AM
|
#6
|
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,504
|
Quote:
Originally Posted by Keith Hedger
Thanks for link, but people are REALLY not looking at the request I want to HIDE A BUTTON
|
I totally get what you want to do. My suggestion would still be to dynamically generate just the HTML for the page using a PHP script and only include the button code if the client IP address is within the range. I'm certainly not suggesting you generate the actual images dynamically.
I can think of at least three ways to address your problem ranging from relatively simple to excessively complicated!
- Generate the HTML dynamically.
- Look at the JavaScript example and use div elements of css classes for your buttons to control whether they appear or not on the browser display (this won't stop them showing up in a simple "view source".
- Generate two versions of your page and then use different apache vhosts listening on multiple interfaces and only display the buttons on the apache instance listening on your "internal" interface. (Like I said, excessively complicated!!)
|
|
|
12-10-2014, 08:51 AM
|
#7
|
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,186
Original Poster
|
Sorry for getting a bit ratty with the caps!
I will probably go with your second suggestion and use java script, I'm not too bothered if the code shows up in a source view as the scripts can only be run locally anyway, it's just my javascript and html isn't up to much and I really don't want to learn yet another language for something which should be simple, I don't do a lot of web stuff anyway so don't want to invest too much time in learning a bunch of stuff I am never going to use again.
|
|
|
12-10-2014, 08:58 AM
|
#8
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,892
|
Quote:
Originally Posted by Keith Hedger
I have configured apache so that if the edit button is clicked from the LAN the edit script is run, but if connecting from the internet clicking the edit button causes a
Code:
Forbidden
You don't have permission to access /cgi-bin/edit on this server.
|
OK you did go on to say that ultimately you want to hide the button, but since the quote here was also there, that's what I and seemingly a few others saw first. Sorry for the confusion.
Looks like TenTenths is offering some solutions. That's above what I can offer talent-wise, so go with their assistance.
Last edited by rtmistler; 12-10-2014 at 09:00 AM.
|
|
|
All times are GMT -5. The time now is 03:44 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|