| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| DNOA Member | Hi, Actually, I hope this isn't in the wrong forum, since it's been done before I'm sure, but just a little enhancement to SecondVersion's post a bit downward... Now, I actually send an HTTP re-direct in case a certain nav panel on the side or top of the page needs to be updated upon a login. Because sessions and cookie variables don't take effect or are recognized until the page AFTER login, an HTTP redirect is used to keep things current without having to check filenames This is entirely optional but I think it works better and I recommend it.Note: For the re-direct, PHP function header() can be used: PHP Code: This SHOULD really work (haven't tried it) but I scanned the code for errors. Please note! This is NOT a very secure script! (I've written better...) index.html (login page) HTML Code: <html> <head> <title>Login</title> </head> <body> <form method="post" action="login.php"> Username: <input type="text" name="username"> <BR><BR> Password: <input type="password" name="password"> <BR><BR> <input type="submit" value="Login"> </form> </body> </html> login.php PHP Code: The script for that is as follows: protected_page.php PHP Code: ![]() EDIT! Guess I should tell ya how to log out. It's really easy! logout.php PHP Code:
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! Last edited by compuXP; 08-08-2005 at 06:19 AM. Reason: right forum? oops... |
| |
| | #3 (permalink) |
| Pro Coder & Designer | if you didnt know session_start(); and then space and comments above it, isnt allowed. it will give you header problems.
__________________ Online Dragonball Game |
| |
| | #4 (permalink) |
| DNOA Member | Actually, it just has to be sent before any other headers It works fine
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #5 (permalink) | |
| Senior Member | Quote:
| |
| |
| | #7 (permalink) |
| NamePros Regular | Good job, if I didn't write my own code and still stole others, I would probs steal it :P PJ
__________________ L33TSig.net |
| |
| | #8 (permalink) |
| DNOA Member | No no - use it if you want! Share it with the WORLD... that took me 5 mins to write anyway... I updated the script and added a logout function!
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #9 (permalink) |
| Senior Member | Cool and standard. Good work.
__________________ Custom WordPress theme design. Top notch free WordPress themes Custom Theme Design |
| |
| | #10 (permalink) |
| DNOA Member | NEW! http://www.namepros.com/code/113786-fullyfunctional-member-system-login-logout-admin.html If you're looking for something better - read that!
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP / MySQL Login Problem | will7 | Programming | 10 | 04-11-2005 01:40 PM |
| 60.000 Templates, scripts, fonts, banners etc. $9.95 | atkims | Web Development Wanted | 19 | 11-16-2004 09:48 AM |
| Tutorial: Getting Started With MySQL (The Basics) | deadserious | Webmaster Tutorials | 3 | 04-18-2004 01:17 PM |