Ok now what do i do
Do you have any PHP/programming knowledge? It's obvious you need to work out some workflow.
I did it like this:
Well, sort of... I have no idea if it works, but my login code looked something like that. Consider using sessions though.
Toolmaker
I did it like this:
$Action = GetPostField("action", null); // Custom made function switch ($Action){ case null: ShowLoginForm(); break; case "login": $Username = GetPostField("username", null); $Password = GetPostField("password", null); // Check username/password stored in db if (CheckLogin($Username, $Password) == TRUE) { // Store cookie for auto login StoreCookie($Username, $Password); // Forward to mainpage header("location: index.php"); } else { ErrorMessage("Invalid username/password"); ShowLoginForm(); } break;}
Well, sort of... I have no idea if it works, but my login code looked something like that. Consider using sessions though.
Toolmaker
On this subject, does anyone know of any place where they have a beginner's PHP tutorial on logins, etc (for someone who can already program in C++)?
cant you use the .htaccess file for a login dialog? or isnt it supported on you http-server? just wondering...
T2k
T2k
Ok, I wrote an HTML page that contains a "login dialog" and a Submit button. When you call ShowLoginForm(), you should output this code in that function.
When you click "Submit", it will call "login.php?action=login".
Because you know nothing about PHP, I suggest you go to the link below and follow the tutorial.
http://www.w3schools.com/php/default.asp
Toolmaker
When you click "Submit", it will call "login.php?action=login".
<center> Please login<br><br> <form name="login" action="login.php" method="post"> <table border="0"> <tr> <td width="100px">Username</td> <td width="250px"><input type="text" size="30" name="username"/></td> </tr> <tr> <td width="100px">Password</td> <td width="250px"><input type="password" size="30" name="password"/></td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" text="login"> </td> </tr> </table> </form></center>
Because you know nothing about PHP, I suggest you go to the link below and follow the tutorial.
http://www.w3schools.com/php/default.asp
Toolmaker
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement