PDA

View Full Version : Password Protection


phys2410
11-02-2004, 05:26 PM
Hi, first and foremost, sorry if this is in the wrong section.



My situation is that i am creating a physics tutorial for my lab partners. I am uploading my notes, labs, hmwks, etc. I want to be able to assign users with passwords. I signed up for Bravenet..... but um, they suck the proverbial fat one. Whenever i test to logon, it sometimes goes to my physics page and sometimes it just goes to an empty page or white error message. I am unsure if this is due to the fact that my test page is hosted with geocities or if this is a Bravenet screwup.


Anyone know of any free password protection/user services? ....free being the operative word here....
I wanna be able to have stat about user visits etc.

xangelo
11-02-2004, 10:28 PM
Well, heres the thing. DONT USE GEOCITIES!!! not even for a test page. Its garbage and should be there too (the garbage i mean). so heres what you do. use hostmatrix. then for a nice password script i suggest javascript. Thats only if you dont have super secure stuff. I belive I have a code somewhere, ill just post the link here. However I doubt that there are any javascript user authentication scripts that allow you to view stats.

I belive PHP can do this, but then again.......I cant work it so im not the guy to ask about that. You can use Moogle i think (key word being I think). Geeklog can work too. both those come with password protection and you can view stats and such. plus you can pre-register users.

<!-- TWO STEPS TO INSTALL MULTIPLE USERS PROMPT:

1. Add the first code into the HEAD of your HTML document
2. Copy the last coding into the BODY of your HTML document -->

<!-- STEP ONE: Add code to HEAD of login HTML document -->

<HEAD>

<script LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function LogIn(){
loggedin=false;
username="";
password="";
username=prompt("Username:","");
username=username.toLowerCase();
password=prompt("Password:","");
password=password.toLowerCase();
if (username=="guest" && password=="login") {
loggedin=true;
window.location="home-page.html";
}
if (username=="guest2" && password=="login2") {
loggedin=true;
window.location="home-page2.html";
}
if (loggedin==false) {
alert("Invalid login!");
}
}
// End -->
</SCRIPT>

<!-- STEP TWO: Put this code in BODY of your HTML document -->

<BODY>

<center>
<form><input type=button value="Login!" onClick="LogIn()"></form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
that was from http://javascript.internet.com/passwords/m...mpt-source.html (http://javascript.internet.com/passwords/multiple-users-prompt-source.html)

mck9235
11-02-2004, 10:43 PM
Here Is a simple script I used.
Right now: password: Yahoo
Just chnage it around as you like.

<HTML>
<!-- By MCK9235 -->

<HEAD>
<style type="text/css">
p { font-size:16pt; color:orange; font-family:cursive }
</style>
<TITLE> *** Place Title Here *** </TITLE>

<BODY BGCOLOR="00023">
<p></p>
<form name="myform" method="post"
action="">
<p><span id="p">Enter Password [6 max]</span><br>
<INPUT name="pwd1" type="password" maxlength="6" size="20">

</form>
<input type="button" value="Validate"
onclick="validate()"/>
</p>
<script LANGUAGE = JavaScript>

function validate()
{
var entry = document.forms.myform.pwd1.value.toLowerCase();
if( entry == "yahoo") window.location = "http://www.fandango.com";
else
{
window.alert("Password Incorrect: Please retry");
document.forms.myform.pwd1.value = "";
}
}
</script>
</body>
</html>

Bah someone beat me to it! ;)

phys2410
11-03-2004, 09:08 PM
Thanks Xangelo and Mck9235! I try to stray from codes that have the password in the source though.... not that what i am password protecting is sooo important er anything. Lol, i mean i'm sure no one cares to break their way into a physics page.

The thing is i want to assign user names with individual passwords. Hm, so i take it Bravenet is my only resource.


Oh, and Xangelo, ahaha, Geocities IS crap. Let me tell you this: My monthly allotment er whatever of bandwidth got used up in like two days. And you cannot cannot cannot upload using their way.... it always blanks out. That's why i'm here. I think i'll check out Moogle and Geeklog. Thanks for thje info!!

mahangee
11-03-2004, 09:10 PM
You could write a safer one in PHP using sessions and databases.

688206002
11-04-2004, 12:13 AM
Originally posted by mahangee@Nov 3 2004, 04:10 PM
You could write a safer one in PHP using sessions and databases.
5583


Yah, with javascript, people can view the source and see what the password is. Also, if you use sessions, it carries over to other pages whereas with javascript, you can have one page "protected" but unless you want your users to log in for every page they view, anyone can access a page without having to know the password if they know the URI for it.

phys2410
11-09-2004, 02:28 PM
See, my prob is i only know html. I have not learned php yet. I wanna get a chance and start looking at tutorials etc.

I learned html a looooooong time ago. I learned it by going to webpages and looking at the sources. I would see the source and how it correlated to the page and manipulate different things to see what it did.

That was fun to learn like that actually (not to sound like a loser).
But php seems like i could not learn that way. It appears to be one of those read the tutorials etc.

Am i right? Or can i find a "fun" way to learn php??

mahangee
11-09-2004, 07:53 PM
You cant learn PHP in the same way, because PHP is server side scripting so all the action happens on the server then sends the HTML to your browser. I must admit I used to take a random website and see if I could design a page like it using HTML and notepad. I think the best way to learn (the way I learnt) PHP is to do something similiar. Read a few basic tutorials so you get the idea and concept of PHP then start reading the tutorials on PHP Freaks you get good tutorials where it gives you some code and explains it to you. Its really code its pratical and very informative

http://www.phpfreaks.com

mck9235
11-09-2004, 08:59 PM
Yes, I know that it is very easy to figure out the password, I mean this is just a very simple script, nothing special, just if you had a file you would rather not share etc. Not meant for "super-de-duper" protection.

chilipie
12-03-2004, 03:42 PM
You could use .htaccess to create password protection.

webbyville
12-06-2004, 07:16 PM
www.sitegadgets.com has a good password protection...