|
|
|
|
![]() ![]() |
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 |
|
|
|
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] |
|
|
|
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. |
|
|
|
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. |
|
|
|
Yesterday, 03:42 AM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 4 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
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 13th May 2008 - 09:52 PM |