A Php Loginbox On Your Webpage - Is it possible?

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

A Php Loginbox On Your Webpage - Is it possible?

techocian
You know how when you password protect a page/directory, and try to access that page/directory, you would be prompted to type in your username and password? Is it possible for me to input some code on a page so that the person types his uername and password on the webpage itself like those loginboxes which you seein many websites. I know i sound kinda stupid but I was just hoping that it could work.
I would appreciate all your help! biggrin.gif

Reply

NilsC
It's not a tutorial so I moved your post here to the "What Is.." forum. Use the tutorial forum for tutorials only and ask for help and for "new" tutorials in the respectice forums. smile.gif

Nils

Reply

jipman
read this

http://httpd.apache.org/docs/howto/auth.html

and get ssh enabled on your account in order create these things. I like the prompt more... but thats just my silly opinion wink.gif.

Good luck with it.

Reply

szupie
To do this, you need a database to store the password and usernames of your members. But I'm not going to show you that here, because there are a lot of tutorials online that teaches you that. I am just going to give you a script that can only authorize one username and password.

CODE
<?php

if ($form == "yes")  // form sent
{
if ($_POST[username] == admin && $_POST[password] == yourpasswordhere)  // If the username entered is admin and the password is yourpasswordhere
{
 header("Location: member.php");  // Go to members page
}
else  // If username or password is wrong
{
 echo "Wrong Username or Password. Please try again.<br>";
}
}
?>

<html>

<head>

<title>Login</title>
</head>
<body>
<form method="POST" action="<? echo $php_self ?>?form=yes">
<center>
<p><font size="7">Members Login</font><br>
</p>
 <table border="0" width="40%">
   <tr>
     <td width="50%">
     <p>Username:</p>
     </td>
     <td width="50%">
     <p><input type="text" name="username" size="20"></p>
     </td>
   </tr>
   <tr>
     <td width="50%">
     <p>Password:</p>
     </td>
     <td width="50%">
     <p><input type="password" name="password" size="20"></p>
     </td>
   </tr>
 </table>
 <p align="center">
 <input type="submit" value="Login" name="submit"></p>
</form>
</body>
</html>

 

 

 


Reply

arez
i think there is a faster way give me some time and i will post it.

Reply

marijnnn
i think the safest & best way would be to use htaccess
that will protect your folder. once you enter the password, you'd be able to view the files inside the folder. you can use this for all purposes: a hidden website or just a hidden storage for files you want to access files from everywhere.
if you just want to prohibit access to your website, you can use an index.php file. you can store your password hardcoded if it's not very imporant. you can store an md5 hash of it if you want it to be safer, or an md5 hash in a database to go really safe. if you want, i can provide you with a login page that uses a database & an md5 hashed password. even if a hacker would be scanning your traffic, he wouldn't be able to get your password.

anyway, the easiest way would still be the .htaccess file. check google.

Reply

szupie
I think he meant a page where you enter your name and password and click submit in order to get redirected to the hidden page, instead of having a pop up prompt.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. php password webpage - 288.05 hr back. (1)
Similar Topics

Keywords : php loginbox webpage

  1. What's Wrong With My Php Webpage? - there may be something wrong in my php code. (2)



Looking for php, loginbox, webpage






*SIMILAR VIDEOS*
Searching Video's for php, loginbox, webpage
advertisement




A Php Loginbox On Your Webpage - Is it possible?