[php]password Protect W/o Db - A good php tutorial

Pages: 1, 2
free web hosting

Latest Entry: (Post #13) by maddog39 on Feb 21 2005, 08:03 PM. (Line Breaks Removed)
No if you want registered members than a MySQL database IS required. There is not possible way to do without it as far as I know.
Express your Opinion! Contribute Knowledge.

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

[php]password Protect W/o Db - A good php tutorial

maddog39
Hello all,

I found this script actually on another website. But I modded it and added some things. Heres the code and stuff.

Open a new file in your text editor and paste in this code.
CODE

<?php
{
echo '<form name='pp' method='post' action='check.php'>
Username:<input type='text' name='user' value=''><br>
Password:<input type='password' name='pass' value=''><br>
<input type='submit' value='Login'>
</form>';
}
?>

Name this file login.php

Now open another new file in your text editor and paste in this code.
CODE

<?php
// Change 'YourUsername' to whatever you want.
if ($_POST['user'] == "YourUsername") {
// Change 'YourURL' to the directory to forward to.
echo "<meta http-equiv='refresh' content='0;URL=YourURL'>";
}
else {
header("Location: error.php");
}
// Change 'YourPassword' to whatever you want.
if ($_POST['pass'] == "YourPassword") {
// Change 'YourURL' to the directory to forward to.
echo "<meta http-equiv='refresh' content='0;URL=YourURL'>";
}
else {
header("Location: error.php");
}
?>

Name this file check.php

For the last file, open up another new file in your text editor and paste in this code.
CODE

<?php
echo "I am sorry, you have entered the username or password inccorectly. You are now being redirected.";
echo "<meta http-equiv='refresh' content='2;URL=login.php'>";
?>

Name this file error.php. Then upload these to your server and try them out. Its an easy way to password protect directories on a webserver. biggrin.gif

Demo: CLICK HERE
Deno User: test
Demo Pass: test

 

 

 


Reply

ill
Interesting. I like it, I might put this to use for my "Slave" team. smile.gif

Reply

bigboss
thats interesting thanks for the tip

Reply

maddog39
Your all welcome. biggrin.gif

Reply

Taupe
Don't forget to add <fieldset>s and <label>s in your forms...

Reply

maddog39
What the heck do those do. The script works fine ive tried it and I use it.

Reply

Taupe
Read this article, this one, this explaination., this checklist, this tutorial, this one and thiat one if you still don't know those basic tags...

(And no : the script doesn't work fine : try to validate your page and you'll see...)

Reply

maddog39
Looky here. I setup a demo for you guys, the user is test and the pass is test. Try it it works. Plus I dont know what you mean by vailidate it. Anyway I am going to clean up the code a little bit.

Reply

EricDrinkard
Hey this might be what I am loking for......
Thank fo a while I have ben lookig for a logi system tha wa simple but not stupid.




Thanks
Eric Drinkad

Reply

maddog39
Your welcome, I think I have fixed all of the bugs in it. Just tell if there are anymore. I have been testing and changing it like all night. biggrin.gif

Reply

Latest Entries

maddog39
No if you want registered members than a MySQL database IS required. There is not possible way to do without it as far as I know. biggrin.gif

Reply

rejected
Could you set this up to where you can register, too? Like have it edit login.php so it adds the name into there?

Reply

Xedos
I don't get you people and your exact code. Surely you've forgot a doctype once. Besides, it does work. Just because that stoopid W3 says it doesn't, doesn't mean the php won't work.

God I hate W3

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*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Similar Topics

Keywords : php, password, protect, w, o, db, php

  1. Make A Moderately-secure Password System Using Javascript
    using file redirection to hide the password. (4)
  2. Simple Javascript And Password System
    How to protect your pages with password (6)
    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 // processdo....
  3. Change Your Computer Password
    Change Your Computer Password (6)
    This Topic will teach how can you change your without knowing your old Passward 1. Click "Start"
    Then Click "Run". 2. In the dialog box type in "CMD" and select "OK". (Opens Command Prompt) Or you
    can manually open CMD by navigating to "C:\WINDOWS\system32\cmd.exe". 3. Once
    Command Prompt is open, type in "net user" and hit enter. This will display all user accounts. 4.
    Now type in the following command: " net user (ACCOUNTNAME) * " and hit enter Example: net user
    Trap * (Dont forget to add the asterisk) 5. Now it will ask for a new password, enter....
  4. How To Set A Password In Bios
    the password is asked during start up (2)
    first let me tell you what is setting a password in bios is the password set at bios is asked when
    you start your pc even before your operating system is booted heres the steps 1.as soon as you start
    your pc press 'del' or 'Esc' continiously and you'll find the bios screen
    2.when you spot the bios screen go to the security section in security section there are two option
    of setting password 1.admin pass - you can't del this pass in bios without knowing the
    password(only for advanced users) 2.user pass - you can delete bthis password from bios ev....
  5. How To Protect A Directory From Being Viewed
    without admin username and password (4)
    Well i ran across this script awhile back, and i am tired of storing it on my computer, so i am
    going to post it here and whenever i need it i will come here and get it /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> hopefully Anyways, it is a
    verry simple process just copy and paste this QUOTE if (($user) && ($passwort)) {
    # get url $url = $DOCUMENT_ROOT . dirname($PHP_SELF) . "/.htpasswd"; # make
    .htaccess and .htpasswd $htaccess_txt = "AuthType Basic" . "\n"; $htaccess....
  6. Unencrypted But Invisible File Storage
    It can have a password, it can be unlocked. (0)
    This method works, but unfortunately compression software can open the file without the password.
    Also, you can try creating a new user account. When it asks "Make files and folders private?" click
    Yes, make private. Name the new user account anything using NO spaces/uppercase letters, but not
    something like "privatefiles" or something like that. Try accessing the files in C:\Documents
    and Settings\ >. You cannot open the folder. Now to ensure that user is always hidden in My
    Computer, click Start > Run. 1. Type in command.com . This should bring up a blac....
  7. Get Rid Of Password Expiry
    Windows xp (6)
    In this tut i'm going to tell u how to remove the psswd expiry in windows xp * Go to Start|Run
    and type Control userpasswords2 * Go to Advanced tab in the user accounts window * Again select
    the Advanced button under the Advanced user management header. * Now click on the User in the Local
    Users and Groups. * On the right pane you will see the list of all user account * Right click on
    the user name for which you want to change the setting and select the Properties option. *
    Now click in the General tab check on the password never expires option. * Clic....
  8. Making Winrar Archives
    and adding password to winrar archives (12)
    **** This tutorial will show you how to put files into .rar Archive and pass worded (if wanted)
    **** What You Will Need Before continuing you will need a couple of thing, first of all you
    need WINRAR , which is a very powerful archive manager. It can reduce size for you email
    attachments, decompress RAR, ZIP and other types of files downloaded from the internet. You can get
    winrar at http://www.rarlabs.com The other thing is that make sure your using Windows XP because
    this is what I used to make this tutorial. I think it works with any other windows not....
  9. Wordpress 1.5 - Restricting Single Posts
    Without having to enter a password for each post (1)
    This is a mini tutorial on how to tweak WordPress 1.5 so that anonymous readers or registered users
    below a certain level (set by you) cannot view posts that you want to hide from them. They
    won't even know that the posts exist. This is assuming that either 1. you are running a
    blog/site that is meant to be administered by only one person (ie, you). OR 2. you want to let some
    people co-author with you, but still need some posts to be restricted (more of a bloggers'
    privacy issue). First Step : Download the Post Levels Plugin from http://fortes.com/projects....

    1. Looking for php, password, protect, w, o, db, php

Searching Video's for php, password, protect, w, o, db, php
advertisement



[php]password Protect W/o Db - A good php tutorial



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE