![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Look, Brent. You say your code doesn't work, but you don't show it. Someone suggests you show it, and you do, but you don't point out the areas that don't meet your expectations, or the errors you're getting, or anything. You need to help people help you by providing all the information available. Information is what debugging is all about. As it is, we have to examine your code from top to bottom instead of concentrating on one particular section. Of course, we'll do that, but give us a break, huh?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4
![]() |
ok here...when i click login, it does nothing, doesnt show any error message, it does NOTHING.
|
|
|
|
|
|
#13 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Right off the top of my head, before I look in detail, I see your function name is invalid.
EDIT: Oops, your form action in incorrect, also. The action specifies what server page to request (normally a script), it doesn't specify a function name. Let me ask a question: are you aware of the client/server nature of the interaction and exactly what that means in terms of what code is run where? EDIT 2: You're overlapping your form and table elements in non-compliant ways.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#14 |
|
Programming Guru
![]() ![]() |
This is how i would do it.
[PHP] <html> <head> <title>Login:</title> </head> <body> <?PHP switch ($_POST['action']) { case "Login": $username=$_POST['username']; $password=$_POST['password']; if($username=='webmaster' && $password=='pass') { print("success"); } else { print("failure"); } break; default: ?> <form method="post" name="form1" action="mypage_name.php?action=Login"> <table name="login_menu" width="100" background="pic_1.jpg"> <th> User info </th> <tr> <td> Username: <br> <input type="text" name="username" size="10"> </td> </tr> <tr> <td> Password: <br> <input type="password" name="password" size="10"> </td> </tr> <tr> <td> <input type="submit" value="Login"> </td> </tr> <tr> <td> <b>(</b><a href="register.html">register</a><b>)</b> </td> </tr> </table> </form> <?PHP break; } //end of switch. ?> </body> </html> [/PHP] Please note that you should replace "mypage_name.php" with the name of your page. I am sure that you could use phpself() if you really wanted, but you must have the "?action=Login" part for it to work.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! Last edited by Pizentios; Aug 4th, 2005 at 10:25 AM. |
|
|
|
|
|
#15 |
|
Professional Programmer
|
If it's 1 user, just use http auth.
[PHP]<? if (!isset($PHP_AUTH_USER)) { header("WWW-Authenticate: Basic realm=\"Protected Page\""); Header("HTTP/1.0 401 Unauthorized"); exit; } else if(($PHP_AUTH_USER=="user") && ($PHP_AUTH_PW=="password")) { echo "You got in..."; //place page content or re-direct ehre } //part 3 else { echo "Sory dude, wrong password"; //it didn't work } ?>[/PHP] taken from spoono.com, but I've use modified versions before. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|