View Full Version : Password ( Urgent! )

03-20-2007, 04:20 PM
Encrypted password


the problem is that 2 differend people wants to login with their own password and username.
I have tried to insert two differend things but it wil not open anithing :(

Exuse me for my bad english. I am Dutch.

03-20-2007, 04:23 PM
I've adapted this script to make the best of a bad job, but DD's attitude is that the whole idea of using client-side security is so bad that the only reason that script is still up is so as to not break any links :) However, you can see my version, which includes support for multiple users (amongst other things) here (http://www.twey.co.uk/?q=encpass).

03-21-2007, 06:05 AM
I have seen ur the pw scripts at http://www.dynamicdrive.com/dynamicindex9/password.htm.

however, what i'm looking is a encrypted password script for blogs. I've tried putting that script above in the template section, but it doesnt work.

Someone help pls!!!

03-21-2007, 06:15 AM
A link to your page would be needed to do anything specific.

03-21-2007, 06:28 AM
ohh ... opps sry

my blog is http://testing1233.blogspot.com

03-21-2007, 06:40 AM
It'll be nice if you let us in :)

This blog is open to invited readers only

It doesn't look like you have been invited to read this blog. If you think this is a mistake, you might want to contact the blog author and request an invitation.

You're signed in as PROTECTEDEMAIL@EMAIL.COM - Sign in with a different account

03-21-2007, 07:37 AM
O.o ... ohhh ... my blog is locked alreadi?? I didnt know dat as I still can access it no matter I sign in wif whateva account.

03-21-2007, 07:38 AM
No, your blog is only restricted to "allowed" members.

03-21-2007, 07:56 AM
icicx ... sry abt dat. I've been looking at all these scripts today n its making mi veri blur >.<

btw ... regarding the instructions on how 2 put the encrypted pw script at http://www.dynamicdrive.com/dynamicindex9/password.htm, i dont know how 2 do it. Can teach me?:(

03-21-2007, 07:57 AM
I recommend you use Twey's script instead of that one.

03-21-2007, 08:02 AM
i have read through dat as well ... Do i have 2 download md5.js??

And where i paste the script? ... im currently using freewebs as my website hosting.

03-21-2007, 08:28 AM
Put this on your page:

<script type="text/javascript" src="md5.js"></script>
<script type="text/javascript">
// Encrypted Password script - by Twey, http://www.twey.co.uk/
// (only slightly based on the script of the same name by Rob Heslop)
// Released under the terms of the GNU General Public License,
// version 2 or later. See http://www.gnu.org/copyleft/gpl.html for more
// information.

var caseSensitive = true;
var pageToGoTo = "includes/&#37;p.txt"; // %u will be replaced with username, %p with password.
var failureMessage = "Username/password combination entered incorrectly."
var caseWarning = "\nWarning: case sensitive.";
var users = [
["61409aa1fd47d4a5332de23cbf59a36f", "0c6ad70beb3a7e76c3fc7adab7c46acc"]
// Add more here, in the format [usercode, passcode]
// but don't forget to add a comma to all but the last one!

function encrypt(str) {
/* Original algorithm:

var hash = 1;
for(var i=0;i<str.length;i++) hash *= str.charCodeAt(i);
return hash;

/* Paj's MD5 implementation: */
// NOTE: MD5 has several collision weaknesses. However,
// these are not an issue here, as succeeding in creating
// a collision would only cause the script to report the
// correctness of the password incorrectly.

return hex_md5(str);

function passCheck(frm, user, pass) {
var form = document.forms[frm] || frm,
username = user ? (form && form.elements[user] ? form.elements[user].value : user) : form.elements["username"].value,
password = pass ? (form && form.elements[pass] ? form.elements[pass].value : pass) : form.elements["password"].value,
passcode = usercode = 1;
if(!caseSensitive) {
username = username.toLowerCase();
password = password.toLowerCase();
var pg = pageToGoTo.replace(/%p/g, password).replace(/%u/g, username);
passcode = encrypt(password);
usercode = encrypt(username);
for(var i = 0; i < users.length; i++)
if(users[i][0] == usercode && users[i][1] == passcode) {
if(!frm) return window.location.href = pg;
form.action = pg;
return true;
window.alert(failureMessage + (caseSensitive ? caseWarning : ""));
return false;

Download md5.js (http://pajhome.org.uk/crypt/md5/md5.js)

Copy this into your page:

<form action="" onsubmit="return passCheck(this);">
<label style="display:block;">
<input type="text" name="username" size="15">
<label style="display:block;">

<input type="password" name="password" size="15">
<input type="submit" value="Submit">


["61409aa1fd47d4a5332de23cbf59a36f", "0c6ad70beb3a7e76c3fc7adab7c46acc"]
with your MD5ed username and password [username, password] using the generator on the page.

And you're done!

03-21-2007, 08:30 AM
ermm ... okie ... i roughly get the picture ... but lets sae i oni wan restricted certain webpages to my members ... how do i go abt doing dat?

03-21-2007, 08:34 AM
I strongly suggest you use server-side scripting for that (eg. PHP)

03-21-2007, 08:42 AM
ermm ... where can get dat script?

btw ... it might be more helpful if u can see my website

03-21-2007, 08:11 PM
I use freewebs to.......