Jump to content
  • Advertisement
Sign in to follow this  
Alex3579

Ok now what do i do

This topic is 5098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Do you have any PHP/programming knowledge? It's obvious you need to work out some workflow.

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

Share this post


Link to post
Share on other sites
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++)?

Share this post


Link to post
Share on other sites
cant you use the .htaccess file for a login dialog? or isnt it supported on you http-server? just wondering...


T2k

Share this post


Link to post
Share on other sites
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".


<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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!