LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 12-10-2014, 06:17 AM   #1
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
Attached Thumbnails
Click image for larger version

Name:	image.jpg
Views:	13
Size:	29.1 KB
ID:	17075  
 
Old 12-10-2014, 07:32 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 12-10-2014, 07:46 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Original Poster
Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
Old 12-10-2014, 08:07 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
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.
 
Old 12-10-2014, 08:24 AM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Original Poster
Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by TenTenths View Post
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.
 
Old 12-10-2014, 08:40 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by Keith Hedger View Post
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!
  1. Generate the HTML dynamically.
  2. 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".
  3. 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!!)
 
Old 12-10-2014, 08:51 AM   #7
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Original Poster
Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
Old 12-10-2014, 08:58 AM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by Keith Hedger View Post
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.
 
  


Reply

Tags
hide, html, lan, link, wan



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Page Link to Items Outside Web Directory CincinnatiKid Programming 4 06-20-2013 02:38 PM
[SOLVED] Downloaded complete web page with wget but browser wants internet to open page? SharpyWarpy Linux - General 15 08-16-2012 04:57 AM
Quiery database and show results on a web page jlinkels Linux - Software 5 01-04-2007 07:26 AM
httpd problems - blank web page shows up when access from outside of internet LAN wk4997 Linux - Networking 2 01-21-2006 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration