You are viewing our Forum Archives. To view or take place in current topics click here.
Website Password Protected Page with image +REP
Posted:

Website Password Protected Page with image +REPPosted:

CrypTic_Trivia
  • V5 Launch
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
I have website which is password protected with a javascript alert window being able to input the password and then enter to the site, I am looking to change the password page as the full screen rather than just the box, with an image above the password box, the same as this code but with an image, when i add my code to this code it doesn't work, also need the file to be a .HTML and not .PHP

[ Register or Signin to view external links. ]

amy help? Thanks +REP


Last edited by CrypTic_Trivia ; edited 1 time in total
#2. Posted:
CriticaI
  • Blind Luck
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,749
Reputation Power: 452
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,749
Reputation Power: 452
It is not possible to make a secure login without some type of server language like php, nodejs, ruby, python etc.

There are some work arounds though. But you are still technically using a server.
Pretty much you would use some third party server to store your data. Like firebase or google spread sheets. You would just access their api using a javascript library like ajax or axios.
#3. Posted:
dooon
  • Blind Luck
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Extending on what Critical said, if you want your website to actually be secure and not just a front end validation/check for the correct password (which is completely public to everyone), you need to store the passwords in a database.

If you just want to validate it in the front end you can do that with javascript. I would recommend it because in no way is it secure.

If you want real authentication you'll need a backend which interacts with your database, and provides the response to your front end.

You can use any back end language, PHP probably will be the easiest to get going.

Ask whatever other questions you need to get this going. I'm sure we can get it figured out.
#4. Posted:
CrypTic_Trivia
  • Resident Elite
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
TTG_Hayden wrote Extending on what Critical said, if you want your website to actually be secure and not just a front end validation/check for the correct password (which is completely public to everyone), you need to store the passwords in a database.

If you just want to validate it in the front end you can do that with javascript. I would recommend it because in no way is it secure.

If you want real authentication you'll need a backend which interacts with your database, and provides the response to your front end.

You can use any back end language, PHP probably will be the easiest to get going.

Ask whatever other questions you need to get this going. I'm sure we can get it figured out.


I dont really need too much security with this its only a small mobile web application, just need some sort of protection so I can give access to specific people and even if others know the password or something they can't gain access weather that validating it with OTP that 1 person can use and it expires or if not any of that atleast a password page that i can add an image to, i dont care too much about the security as long as it either has 1 global password with an image or the OTP method or something similar
#5. Posted:
dooon
  • Blind Luck
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Why don't you want to use PHP?
#6. Posted:
CrypTic_Trivia
  • V5 Launch
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
TTG_Hayden wrote Why don't you want to use PHP?


I will use php if it works but when I use the one i put in the post or any other they dont work
#7. Posted:
dooon
  • Blind Luck
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
What's the issue you are having?

<?php
if($_SESSION['password']=="123")
{
 ?>
 <h1>Create Password Protected Webpage Using PHP, HTML And CSS</h1>
 <form method="post" action="" id="logout_form">
  <input type="submit" name="page_logout" value="LOGOUT">
 </form>
 <?php
}
else
{
 ?>
 <form method="post" action="" id="login_form">
  <h1>LOGIN TO PROCEED</h1>
  <input type="password" name="pass" placeholder="*******">
  <input type="submit" name="submit_pass" value="DO SUBMIT">
  <p>"Password : 123"</p>
  <p><font style="color:red;"><?php echo $error;?></font></p>
 </form>
 <?php   
}
?>


if($_SESSION['password']=="thepasswordyouwant")


This is where you can set the password to protect the page with.
When this check passes you can render the authenticated content for that page.

Please note this is a simple solution, but probably is all you need.
#8. Posted:
CrypTic_Trivia
  • Resident Elite
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
Status: Offline
Joined: Jan 12, 201410Year Member
Posts: 299
Reputation Power: 12
TTG_Hayden wrote What's the issue you are having?

<?php
if($_SESSION['password']=="123")
{
 ?>
 <h1>Create Password Protected Webpage Using PHP, HTML And CSS</h1>
 <form method="post" action="" id="logout_form">
  <input type="submit" name="page_logout" value="LOGOUT">
 </form>
 <?php
}
else
{
 ?>
 <form method="post" action="" id="login_form">
  <h1>LOGIN TO PROCEED</h1>
  <input type="password" name="pass" placeholder="*******">
  <input type="submit" name="submit_pass" value="DO SUBMIT">
  <p>"Password : 123"</p>
  <p><font style="color:red;"><?php echo $error;?></font></p>
 </form>
 <?php   
}
?>


if($_SESSION['password']=="thepasswordyouwant")


This is where you can set the password to protect the page with.
When this check passes you can render the authenticated content for that page.

Please note this is a simple solution, but probably is all you need.


I already have the page password protected with a javascript alert which works fine, but in an alert box you can add anything but text, Instead i wanted similar to the one linked in the topic or a password protection where i can customize it
#9. Posted:
dooon
  • Blind Luck
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Well try implement the one in the example. What is the issue you are having?

You will need to have a web server that supports PHP (which most do).

Assuming you are developing it locally, you'll need an apache environment with PHP to run the PHP script.

Check out XAMPP [ Register or Signin to view external links. ]
#10. Posted:
Cyimking
  • 2 Million
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
If you are using Apache, then password protect the directory in due time.

If you want to the password page to be fancy, then you have NO choice but to use a database or a 3rd party service like OAuth.

FYI, just because PHP is a straightforward / cheap route doesn't mean that you can just write crappy, insecure code. If you are planning to use PHP, go with a framework like Laravel. If Laravel (or whatever framework) doesn't make sense, then you are not ready to push any secure code to production.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.