Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Button/Password link to a new page?


  • Please log in to reply

#1
andrewuk

andrewuk

    Trusted Helper

  • Malware Removal
  • 5,297 posts
i am designing a website that holds several client accounts. i want the clients to be able to view their own page having entered a password. how do i do this?

i tried forms (but could not get past the "?" in the url), i tried buttons (but could not get the button to read off a text box on the page)?

(this is not a serious website, so the security does not need to be water tight!)

thanks for any help in advance

andrewuk
  • 0

Advertisements


#2
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
Hello andrewuk,

I'd like to help you out. First, I need to know a couple things. What type of development tools are you planning to utilize (i.e. HTML, ASP, ASP.NET, PHP, etc)? Are you familiar with javascript? If you are just using HTML, your options are limited, but you have options.

Thanks,

Ax
  • 0

#3
andrewuk

andrewuk

    Trusted Helper

  • Topic Starter
  • Malware Removal
  • 5,297 posts
Hi Ax

i am a complete novice at this - what i am doing is designing a website for a (fun only) business i am setting up on Second Life (it is all a bit of fun and is in no way meant to make money for me personally, i am just doing this for pleasure and to learn about websites along the way). the internet site is www.sl-reinsurance.com and the page where i am putting in the passwords to allow clients to access their own page is http://sl-reinsuranc...clientaccounts/

the code i am using is:

<form>
<p>Enter Account Name : 
  <input type="text" name="text2">
</p>
<p>Enter Password		 : 
<input type="password" name="text1">
  <input type="button" value="Log into account" name="Submit" onclick=java script:validate(text2.value,"client1",text1.value,"pass1") >
</p>

</form>
<script language = "javascript">

function validate(text1,text2,text3,text4)
{

 load(text1+text3);

 {

 }
}
function load(url)
{
 location.href=url;
}
</script>
which, as you can see, is a bit slack and a bit of a cheat really......but does allow things to work.....essentially, each client page is called <clientname><password>.....so, one client account is called client1 with a password of pass1

so, i guess that means i am using html?

i am using a website builder that is provided for free at www.servage.net, though the above code was the first bit of coding i had to do (infact i used some free code i found and changed it around........and i know i forgot to attribute the original code to the author, so it is only a temporary fix).

......when i have completed the site i hope to put it on the forum for inspection (assuming such a site is allowed......and it really is for fun only!)

andrewuk
  • 0

#4
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
andrewuk,

Thanks for the information, yes you are using HTML. With that, you can use javascript to perform page login, but it will be more difficult to hide usernames and passwords from users who want to see them. You could make the approach similar to the following:
The JavaScript Source: Password Protection: Login Coder

If you choose to use this script, you may want to edit out the buttons. The only way you could possibly keep people from seeing the usernames and passwords would be to store them in a file and read them with javascript to determine whether they are valid.

Regards,

Ax
  • 0

#5
andrewuk

andrewuk

    Trusted Helper

  • Topic Starter
  • Malware Removal
  • 5,297 posts
Hi Ax

thanks for that :)

i'll look more closely at it over the weekend, but it looks like it will hit the spot

andrewuk
  • 0

#6
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
:) Glad to hear it! Let me know if you need anything else.

Ax
  • 0

#7
Caleb Mingle

Caleb Mingle

    New Member

  • Member
  • Pip
  • 1 posts
For the most secure system I would use a PHP/MySQL database application. The source code would not be displayed to the public unlike the Javascript code above.

Here is an example of a "simple" PHP login script:


[codebox]<?php
include "config.php"; // includes configuration linking to MySQL DB.

$username = $_POST["username"];
$password = $_POST["password"];

$get_user = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
$get_user_n = mysql_num_rows($get_user);
if ($get_user_n == "" || $get_user_n == "0")
{
echo "That user is not found.";
exit;
}
header("Location: inside.php");

?>[/codebox]

That is no where near secure as in cleaning the posted fields, but it should give you some sort of idea. If you need more help feel free to PM me and I could develop you a script to do this!

Caleb

Edited by Caleb Mingle, 17 November 2007 - 10:28 AM.

  • 0

#8
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
Hello Caleb and welcome to G2G,

Thanks for posting the extra information, which would be a great thing for the user to know if he wanted it to be somewhat secure. I think you might have missed this one though:

(this is not a serious website, so the security does not need to be water tight!)


Also, probably this one:

i am a complete novice at this


PHP and MySQL may be way out beyond novice HTML-writing level. Since the user stated that he was just using HTML, Javascript is one of the only options for dynamic form submission. Of course, the Javascript could be made more secure, but why if it isn't needed and is just for fun?

Kind Regards,

Ax

Edited by Ax238, 19 November 2007 - 01:04 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP