Jump to content

username/pwd protection


gangsterwanster1

Recommended Posts

well depends how many ppl you want to be able to login.  If it's just for 1-2 admin users or something you can easily store the correct username/password in a php file:

<?php

$user = "some";

$pass = md5("thing");

?>

or similar and the access file fopen()/include().

 

If it's for more people you could store in an xml file maybe and access with AJAX?

Link to comment
Share on other sites

Safest way would be to always access it via an include and locate the file itself outside of your webdirectory and do something to the passwords themselves like a salted md5 hash

 

Ok, i have another question.

 

So say i make a php installer where the user picks his or her username, then the installer writes the hashed pwd in members.html, what should i do so that my code below reads members.html (where the hashes pwd / user is) and login based on those credentials?



<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.