Heh first off, I want to thank the responders here for the help given.

Ok, now for the prob.

I just wrote my first ever HTML page (awful if ya ask me), and I'm mainly using it as a place to keep files and such. However, it's still in development.

What I'm trying to do is password protect it's directory and all the files inclosed inside it.

Some more slight background stuff.

I read over this page for some tips, and here's my sort-of response to it:

1) I don't really need something super secure. I just want protection from the basics.
2) admin privs - I have admin status inside my directory
3) I dunno which OS/webserver I'm using :sad: (see, this space was given as a sorta gift). Is there a way to check this?


Here's the current code if ya wanna see that:

<html>
<head>
	<title>le John</title>
	<link rel=stylesheet type="text/css" href="style.css">
</head>
<FONT FACE="Tempus Sans ITC">
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" background="img/NASA2-2.gif">

<table height="123" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">

<td><img src="img/Einstein1.JPG" width="141" height="190" border="0" alt=""></td>

<td width="100%" background="img/spacetime.jpg">&nbsp;</td>
</tr>
</table>

<table height="40" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="100%" background="img/spacetime.jpg">&nbsp;</td>
</tr>
</table>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">

<td width="201"><BR>

&nbsp;&nbsp;&raquo;&nbsp;<a href="http://stoic_sleeper.livejournal.com/"><FONT COLOR="#FF6600"><B>My Life</B></FONT></a><BR>
<img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
&nbsp;&nbsp;&raquo;&nbsp;<a href="http://www.sultanofmirth.com/jhay116/pics"><FONT COLOR="#FF6600"><B>My Pics</B></FONT></a><BR>
<img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
&nbsp;&nbsp;&raquo;&nbsp;<a href="http://www.webaddresshere.com"><FONT COLOR="#FF6600"><B>Me Music</B></FONT></a><BR>
<img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
&nbsp;&nbsp;&raquo;&nbsp;<a href="http://www.webaddresshere.com">your link</a><BR>
<img src="img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>

</td>

<td width="100%">
	<table width="100%" cellpadding="10" cellspacing="0" border="0">
		<tr valign="top">
			<td>

<h2><CENTER><FONT FACE="Tempus Sans ITC" SIZE="+3" COLOR="#FF0000">The Life and Times of John</FONT></CENTER></h2>
<HR WIDTH="75%" COLOR="#FF0000" SIZE="4">
<p <P align="center"><FONT FACE="Tempus Sans ITC" COLOR="#FFFF00">Well, this is just for kicks...for the most part.  In reality, this is here so I have a place to backup my hard drive.<BR></p>
<p </p>
<p </p>
</FONT>


<BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR>
<p align="center">
This site is &copy; Copyright John Haydek 2006-2007, All Rights Reserved<BR></p>
			</td>
		</tr>
	</table>
</td>

</tr>
</table>

</body>
</FONT>
</html>

By the way, if ya wanna point out any obvious problems with it, feel free to :mrgreen:

Lastly, here's the site we're lookin at:

www.sultanofmirth.com/jhay116

Thanks again.

Member Avatar for iamthwee

encryption perhaps?

http://home.zonnet.nl/MAvanEverdingen/Code/

Also, I would have thought if you are using some sorta database mysql or something, it may have built in security features?

Arg, I think I'm trying to find somethin that would password protect the page.

I tried using .htaccess & .htpasswd text files, but that didn't seem to work.

You could always set permissions on the dir. Also, you could find out if the server you are using allows access to Perl or PHP and cruft up a server side app to do that (I have skeletons, so it's no problem to throw one together for you if needed).

If you only need a simple (few lines) code/script to provide basic protection, I would suggest google search for javascript password gate or similar.

There is no way to secure a page using JavaScript, HTML, or CSS, the topics of this forum.

You either have to do this at the server or data layers of your application (or both).

tgreer- you couldnt password protect with html, even if it didnt matter how secure it is? Truthfully, I just dont want friends purveying my site

comatose- how would ya set permissions on the directory.

Lastly, would a javascript password gate work?

Thanks guys.

Member Avatar for iamthwee


Lastly, would a javascript password gate work?

Thanks guys.

How about this:-

http://javascriptkit.com/script/cutindex6.shtml

It requires a password to open up a .html file. And there you can put all your secret documents.

Stein: no, you can't password-protect with client-side scripts or markup. Any code you wrote would have to be interpreted by the browser, which means it is sent to the browser, which means any password would be embedded in the code. It's as simple as viewing the source, then entering the password.

Member Avatar for iamthwee

Stein: no, you can't password-protect with client-side scripts or markup. Any code you wrote would have to be interpreted by the browser, which means it is sent to the browser, which means any password would be embedded in the code. It's as simple as viewing the source, then entering the password.

Not if you use encryption, which was one example given in that link I provided.

Encrypted Password Generator
Use our password generator to help password protect your web pages. Using advanced JavaScript techniques and some ciphering tricks, this program encrypts the password specified before storing it on the page, making it "unviewable" by simply looking at the page's source.

This makes it harder, true. But the decryption code must also be embedded in the script. How secure is it to send an ecrypted password along with all the code necessary to decrypt it?

Again, there is no way to secure a site using client-side techniques.

However, this is trivial with server-side code and/or techniques.

Why go to elaborate lengths to attempt a client-side method that will never be secure, instead of clicking through a wizard on your web server config console?

Just contact your host, tell them you want basic authentication for your directory, and be done with this.

Just contact your host, tell them you want basic authentication for your directory, and be done with this.

Heh, good idea, I'll be doin that as soon as I can.

Thanks again guys.


EDIT: One last thing, if ya don't mind.

What would be the best place (in your opinion at least) to learn basic coding? I was originally thinking a book...but I dunno.

The Visual QuickStart series is good. The book I learned basic HTML coding from was by Elizabeth Castro. That was years ago, and I'm sure the book has been updated to cover CSS, and DHTML, by now.

First learn XHTML, which is the current version. It's the core markup, the elements. You then learn CSS for how to "style" and "place" those elements on the page. JavaScript, you learn as-needed.

For sites that actually "do something", you'll need to learn a server-side language, and I recommend PHP. Learn PHP and MySql together, there should be thousands of books on that topic.

commented: Awsome, thanks Thomas. +1

What language? I always find that hands on dirty is the best way to go.... look at other people's code, and go from there.... try little things yourself, practice code, and find an idea that you real like..... for example, my first real project was a simple program that acted as a computerized rolodex.... so I could keep track of people and their phone numbers.... so, take an idea, and run with it.

EDIT: TGreer and I Part ways on that one ;) I'm a perl guy.

I always find that hands on dirty is the best way to go.... look at other people's code, and go from there.... try little things yourself, practice code, and find an idea that you real like..

Heh that's how I love to learn....but that's just complicated when ya know virtually nothing in the topic :mrgreen:

I know how that is, and it can feel overwhelming.... so, take an idea... what do you want to do? Build a website? Build an app for the PC? Figure out what you want, and then go step by step. If it's a web site, look at some source of a simple page, and figure out what the HTML or XHTML is doing....

Good idea...and am beginning to look into it now (improving my website/build others).

Last question, what's the diff between HTML and XHTML?

TGreer may have a better explanation, but at the gist of it, HTML isn't 100% XML compatible. There are syntax issues, because HTML doesn't demand that you "close" every tag that you open. For example, most of the time in HTML, you have to start a bold tag <B> and then close it when you no longer want bold text </B>. <B>This would be bold</B>. Sometimes though, such as the HR, BR, and Image tags, there is no closing tag for them.... so <BR></BR> is just silly, because it's just a line break, not a tag that needs a start and a finish..... XML demands that all of the tags that are opened, be closed as well (like the <B> tag). So, what do you do for tags that have no closing cousin? You add a /. So, you could do a line break like this: <BR />, and that would be XML Compliant. I might be a little off, but on the very base of it, I'd say that XHTML is XML Compliant HTML..... if that makes any sense.

Heh sure does, makes a ton of sense. Last question (I swear :)), is there a good code-writing program I should use, if any? Earlier today I downloaded Visual Basic '05. Any good?

Some swear by it, others swear at it. I'm in the latter group. I wouldn't suggest it if you plan to be doing web pages (though, you can do web pages with it, I wouldn't suggest it). To be honest, I think notepad is the best answer (or some other text editor that does syntax highlighting, like VIM For windows, or Golden-Pen) to learn how to code HTML/Javascript with. If you learn from that level, everything else will just make sense.

For an editor, I use TextPad for nearly everything.

For HTML vs XHTML, I just wrote the following on another site:

There is no such thing as "HTML". There are HTML specifications. The pages you author need to follow a particular specification, or "flavor" of HTML.

You tell the browser which specification you adhere to by using a "doctype". It's a declaration you make just prior to the <html> tag.

The vBulletin system is written to the XHTML 1.0 Transitional doctype/specification. That means, only those tags which are within that specification should be used.

A document that is "valid" is one that adheres to the specification.

Q. What if I don't declare a doctype?
A. The browser will just "guess", and use its own internal defaults. This is very bad news particularly with IE, which is simply screwball about things. You'll wonder why your code "works" in one browser but not another.

Q. What if I use a non-standard tag, or something from another HTML specification (such as <center>)?
A. It will probably render fine. However, the danger is two-fold:

1. You don't really know, as the browser is rendering that tag however it likes, NOT in relation to a published specification.

2. The day is coming when the user will control what to do with non-compliant code, just as they can control whether to render graphics, styles, and scripts today. On that day, millions of pages break because the authors didn't care about validation.

This conversation has moved beyond "password protecting", but I'm too lazy to split the thread. For future discussion, please start a new thread?

Member Avatar for iamthwee

Do you know of a good text editor for php, preferably ones that shows errors if the code ain't right?

You'd need more than an editor for that, you'd need a complete IDE. See the fine folks at Zend.

Awsome, tgreer.

This conversation has moved beyond "password protecting", but I'm too lazy to split the thread. For future discussion, please start a new thread?

My apologies :o

Thanks again everybody.

Do you know of a good text editor for php, preferably ones that shows errors if the code ain't right?

VIM for windows (and golden pen) have syntax highlighting ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.