Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Simple Javascript And Password System, How to protect your pages with password
peterspliid
post Apr 18 2008, 09:48 PM
Post #1


Newbie [Level 2]
**

Group: Members
Posts: 32
Joined: 18-April 08
Member No.: 60,982



The quickest way to get a password protection system up and running is to use a Prompt box in JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know what the password should be, could even be one each, that can be sorted out at the next page

then pass the "input" directly through the url by changing the .href, like http://www.iSource.net.nz/users/?leTmeIn=
The page that then processes this should also check for the referring page, and three fails from an IP if you like

the php (the next page):
CODE
<?php
// processdownloads.php
if (!isset($_POST['leTmeIn'])) {
?>
<script language=JavaScript>
location.href=document.referrer;
</script>
<?php
} else {
?>
put all your download stuff here
<?php
}
?>


the javascript (the first page):
CODE
<a href="" onclick="return(doOpen());" >downloads</a>

<script language=JavaScript>
function doOpen(){
    pw = prompt('Enter your Email Address','');
    if (pw){
        location.href='processdownloads.php?'+pw+'='
        return(false);
        }
    }else{
        return(false);
    }
</script>


This is a cheats way of dealing with hackers, crackers or anyone else who shouldn't be where you dont want them to be. leTmeIn is the password here

This is quick and simple, but leaves an ugly url and therefore would not be ideal for anywhere that someone could look over your shoulder, or go through you history, but can be hidden in frames

a simple PHP only version would be:
CODE
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post"><input type="password" name="email">
<input type="submit" name="submit" value="Submit"></form>
<?php
} else {
  $pass = $_POST['email'];
  if ($pass!="leTmeIn") {
?>
<script language=JavaScript>location.href=document.referrer;</script>
<?php
  }else {
?>
put the rest of the page here
<?php
  }
}
?>


I hope it helps someone.

PS: This is my first post wink.gif
Go to the top of the page
 
+Quote Post
lailai
post Apr 28 2008, 03:30 AM
Post #2


Newbie [Level 3]
***

Group: Members
Posts: 43
Joined: 8-December 07
Member No.: 54,414



What? I coudn't under stand...
where am i supposed to name this file:
[quote]a simple PHP only version would be:[quote]

Go to the top of the page
 
+Quote Post
mastermike14
post Apr 28 2008, 09:37 PM
Post #3


Newbie
*

Group: Members
Posts: 7
Joined: 23-April 08
Member No.: 61,231



QUOTE
the javascript (the first page):
CODE
<a href="" onclick="return(doOpen());" >downloads</a>

<script language=JavaScript>
function doOpen(){
pw = prompt('Enter your Email Address','');
if (pw){
location.href='processdownloads.php?'+pw+'='
return(false);
}
}else{
return(false);
}
</script>


ya this is not a secure way of stopping hackers, crackers, etc. go to any legal hack site, like hackthissite.org for example and the number one noob test for hackers would be something like what you just posted. all someone has to do is view the source code and they would get the password.

go to this website here
http://codingforums.com/showthread.php?t=10114

this is a way more secure javascript password and username login.

Notice from rvalkass:

Corrected BBCode.
Go to the top of the page
 
+Quote Post
games4u
post Apr 30 2008, 09:40 AM
Post #4


Newbie
*

Group: Members
Posts: 7
Joined: 27-April 08
Member No.: 61,384



It is indeed a good method for beginners (like me).
And I would also like to say that your first post was very good as well.

But if you ask me, I would say that using a simple MySql database along with php or asp would do the work and offer more security. In this way viewing the source to find the password will also be in vain.
Go to the top of the page
 
+Quote Post
thecolorchanging...
post May 12 2008, 03:42 AM
Post #5


Newbie [Level 1]
*

Group: [HOSTED]
Posts: 19
Joined: 11-May 08
From: USA
Member No.: 62,005



May not be the most secure, like you said, but it's still pretty nifty! Especially if you're in a bind and need something quick and simple to work with. Thanks smile.gif
Go to the top of the page
 
+Quote Post
gameratheart
post May 14 2008, 09:43 PM
Post #6


Super Member
*********

Group: [HOSTED]
Posts: 459
Joined: 14-November 05
From: Britannia!
Member No.: 14,287



Creating password submit forms through Javascript is an extermely low-security method of keeping documents private, and should not be used for anything TOO important. The reason for this is that JavaScript code can be seen in the source of the page, which can give away the password, and even if you put the code as a seperate .js file and jst embed it into the actual login page, the source will still reveal where this .js file is.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Test Your Php Pages W/o Upload/internet(55)
  2. Image Preloader With Progress Bar Status(22)
  3. Wordpress 1.5 - Restricting Single Posts(1)
  4. How To Block Google Web Accelerator(6)
  5. Custom 404 Error Pages(17)
  6. Creating Rollovers With Buttons(2)
  7. How To Edit Your "index Page"(0)
  8. How To: Change An Image When A User Clicks On It(11)
  9. Css And Javascript Combined For Dynamic Layout(8)
  10. Image Rollovers In Javascript(11)
  11. Making Winrar Archives(11)
  12. Get Rid Of Password Expiry(6)
  13. Handy Javascript Code Snips(5)
  14. How To: Make A Simple Php Site(20)
  15. Tool Tips Using Only Css To Pop Up The Tool Tip(8)
  1. Javascript Framework - A Shortcut Javascript(3)
  2. Unencrypted But Invisible File Storage(0)
  3. How To Protect A Directory From Being Viewed(4)
  4. Making A Dynamic Page On Blogspot(5)
  5. How To Set A Password In Bios(2)
  6. Document Type Declarations(0)
  7. Simple Scripts In Html And Javascript(7)
  8. Do You Want To Use Php Code In Your Html Pages?(9)
  9. Javascript Scroll Bar(13)
  10. Mootools - My Favourite Javascript Library(3)
  11. Change Your Computer Password(5)
  12. Create A Simple Html Editor With Php And Javascript(3)
  13. Php--> Content-only Pages(9)


 



- Lo-Fi Version Time is now: 16th May 2008 - 12:56 PM