WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Password using php, Javascript, and html form
Categories : Security, PHP, Authentication, Java Script Update Picture
William Munger
Date : Aug 11th 2000
Grade : 2 of 5 (graded 3 times)
Viewed : 18193
File : No file for this code example.
Images : No Images for this code example.
Search : More code by William Munger
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

I used a html form that has a password field named password and a submit button named
submit. When the submit button is clicked the page reloads with the $password variable sent
back to the server. Then when php resends the html to the client it includes the appropriate
javascript to redirect them to the correct protected page.

<?php
if($password){
if($password==coach){
?>
<script language="JavaScript">
location="http://www.charlottesoccer.com/coach.php3";
</script>
<?php
}elseif ($password==admin){
?>
<script language="JavaScript">
location="http://www.charlottesoccer.com/admin.php3";
</script>
<?php
}elseif ($password==member){
?>
<script language="JavaScript">
location="http://www.charlottesoccer.com/member.php3";
</script>
<?php
}elseif ($password==guest){
?>
<script language="JavaScript">
location="http://www.charlottesoccer.com/guest.php3";
</script>
<?php
}else{
?>
<script language="JavaScript">
location="http://www.charlottesoccer.com/signin.php3";
</script>
<?php
}
}
?>

You see that as many passords as you need can be set up.
If there are a large amount of passwords it would be better to set up a select case statement.




MD5 secured login
Categories : PHP, Java Script, Authentication, Security
Simple Password example
Categories : PHP, Authentication, Security, HTTP
PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character.
Categories : PHP, Algorithms, Security, Authentication, Encryption
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
A simple PHP login script that you can modify to suite your needs. It use a session to store data in a session file submited by the page.
Categories : PHP, Sessions, Security, Authentication
Form Security - Match A Value For Success
Categories : PHP, Authentication, HTML and PHP, Sessions, Security
complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password. improved security using time functions to initialize random number generator.
Categories : Java Script, HTML, Security, Authentication, Strings
phpSecurePages is a PHP module to secures pages with a loginname and password. It handles multiple user groups (each has own viewing rights), store data in a MySQL database or a configuration file, and can be used to identify Web site viewers.
Categories : PHP, Security, Authentication
Authenticator for Exchange Server LDAP
Categories : PHP, Authentication, LDAP, Security, Sessions
Password protection for Phorum 3.1.x with userlevels and log.
Categories : PHP, MySQL, Authentication, Security
Use of bitmasks to represent permissions
Categories : PHP, Authentication, Bitwise Operators, Security, PHP Classes
Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate.
Categories : Authentication, PHP
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions
Dynamic Calender in PHP, Javascript and HTML.
Categories : PHP, Java Script, HTML and PHP, Calendar
 ivan cool wrote : 612
I can`t see how this code will protect your pages. Anyone can go directly to the locations above and no testing will occcur.
 
 yeAH fghj wrote :704
hmm maybe in combo with some other script , but this code is more usefull fore learning redirect with, as protection rather useless