WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Javascript - Login protection on Fri May 25, 2012 12:36 am

Mr.Joker

avatar
Mr. WebArtz
Mr. WebArtz
Hello WebArtz members, I am Mr.Joker and in this tutorial I will teach you how to protect your login username and password. You allready know that people can view your source code and like that simply see username and password and login which is bad. So there is a way to protect it but its not that taff. Still, if someone know javascript he can brake this code so simple. Here is code:

Code:
<html>
<head>
<title>Javascript - Forms</title>
<script type="text/javascript">
function test() {
var userName = document.forms[0].elements[0].value;
var password = document.forms[0].elements[1].value;
var x = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
var combination = x[19] + x[4] + x[18] + x[19] ;
var combination1 = x[0] + x[2] + x[0];
if ((userName==combination) && (password==combination1)) {
alert("Its true");
}
}
</script>
</head>
<body>
<form>
Username:<input type="text" />
Password:<input type="text" />
<input type="button" value="Click me" onClick="test();" />
</form>
</body>
</html>
We have username and password field and one button. Now in javascript part when we make if else statement to valiadate is it true, its not simple as it was. Now I didnt said userName=="some username" I said its equal to some variable. And variable is some word with parts of array. I have array x with all letters. A combination variable is acctualy a word but its combained of elements from Array. So, if someone doesnt know javascript he cant acces to your forum because he cant understand how Arrays work. If you cant udnerstand either then return back and learn Arrays once more then answer me on this question. What is Username and what is password?

If you have any questions ask me Very Happy .

2 Re: Javascript - Login protection on Sat Jun 02, 2012 2:57 pm

symphony.roads

avatar
Registered Member
Registered Member
hi Mr.Joker first questions
that's script just put in Javascript management Question

3 Re: Javascript - Login protection on Sat Jun 02, 2012 6:50 pm

Mr.Joker

avatar
Mr. WebArtz
Mr. WebArtz
Yes, but if you know javascript there is simple vulnerable point , so dont use this xD

4 Re: Javascript - Login protection on Sat Jun 02, 2012 7:45 pm

symphony.roads

avatar
Registered Member
Registered Member
Mr.Joker wrote:Yes, but if you know javascript there is simple vulnerable point , so dont use this xD

why Shocked

5 Re: Javascript - Login protection on Sat Jun 02, 2012 8:31 pm

Mr.Joker

avatar
Mr. WebArtz
Mr. WebArtz
Someone can look your script and just copy it, make a new document on computer and type:

Code:
document.write(combination + ":" + combination1)
and your protection is dead. Very Happy

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum