Log in

View Full Version : Question!



ModernRevolutions
10-05-2006, 08:05 PM
Is there a code i can use for Freewebs to make a "member's area" so to speak? Where people have a username and password and can look at certain things that only they can see (because there a member)

if not is there any free web hosting that can enable html and accepts that?

ModernRevolutions
10-05-2006, 08:07 PM
would this work???



<!-- TWO STEPS TO INSTALL MULTIPLE USERS:

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

<!-- STEP ONE: Copy this code into the HEAD of your 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(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="member1" && password=="password1") { window.location="page1.html"; done=1; }
if (username=="member2" && password=="password2") { window.location="page2.html"; done=1; }
if (username=="member3" && password=="password3") { window.location="page3.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</SCRIPT>

<!-- STEP TWO: Paste this code into the BODY of your HTML document -->

<BODY>

<center>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Members-Only Area!</b></font></center></td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=text name=password></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>
</table>
</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>

<!-- Script Size: 1.60 KB -->

mburt
10-05-2006, 08:08 PM
No. The script above only works for users with JavaScript enabled.

if not is there any free web hosting that can enable html and accepts that?
Try funpic.org
Freewebs doesn't allow PHP/MySql, and funpic.org (free) does. Learn about PHP first (or another server-side language) then you can make a "member page"

ModernRevolutions
10-05-2006, 08:11 PM
i know html... does that count??

mburt
10-05-2006, 08:14 PM
Er... No. HTML can't store data in any way shape or form. If you only know HTML you're out of luck.
I have one question though: Do you want users to be able to make their own account and stuff, or do you want a general password everyone could enter?

ModernRevolutions
10-05-2006, 08:15 PM
general password

ModernRevolutions
10-05-2006, 08:20 PM
can i use html on funpic??

blm126
10-05-2006, 08:26 PM
yes, but you will need something more to add a memebers area(real simple)

mburt
10-05-2006, 08:27 PM
Okay then. This can be done with PHP (without MySql).
This would be your login page:


<form action="login.php" method="get">
User: <input type="text" name="user">
<br>Password: <input type="text" name="pass">
<br><input type="submit" value="Login">
</form>


and this would be login.php:


<?php
$password = $_POST['pass'];
$username = $_POST['user'];
if ($password != 'password_here' || $username != 'username_here') {
exit("<font color='red'>Invalid username or password. Please go back and try again.</font>");
}
?>


You can't use freewebs though

ModernRevolutions
10-05-2006, 08:27 PM
can u enlighten me on how to do a few things?:
>I can't find the page to put all the codes and stuff (can't find out where to go to setup my page)
>a code to make a username and password for a certain page?

mburt
10-05-2006, 08:31 PM
On the page you want the login form to be on, apply the first code to the body section of that page. For the php page, include all of your content on the members page and put the second code into the head of the document.

mburt
10-05-2006, 08:34 PM
In theory, you can do this with JavaScript and HTML. But it isn't practical. Any user could view the source code and find out the password and username. Also, and user without JavaScript enabled won't be able to do anything.