Wednesday, December 24, 2008

Login (Part I) - Login Screen

The login page will be your first big project. While long in explanation, it is designed to do a few simple things:

  1. Get id/pw
  2. Validate
  3. Register
  4. Reset PW
There are a BILLION differnt sites you can go to (just google "login source code php") and all will have a different method. Im hoping the method I use here will be simple, and a "little" secure (I wouldn't worry a whole lot about the security of your game yet until 1. its done and 2. its popular. But at the end of the tutorial, I will show you a few ways you can make sure that game is secure - for all you worry warts out there, this is NOT the same as securing your PC. this is just o people cannot alter the address bar and hop into someone elses character. I'll show you what I mean later. But for simple game design purposes this will do).

Open CE and make a new file called INDEX.PHP
and put this in it (don't forget the "<?php and the >")




// ### SHOW LOGIN
echo'
<center>
<h1>Wyverns Tear</h1><p>
<FORM action="checklogin.php" method="POST">
<table>
<tr>
<td>Login ID:<br>
<input type="text" length="20" name="username">
</td></tr><tr>
<td>Password:<br>
<input type="password" length="20" name="password">
</td></TR><TR>
<td>
<input type="submit" value="Login">
</td>
</tr><tr>
<td>
<a href="registration.php">Register</a>
| Forgot Info
</td>
</tr>
</table>
</form>
';


Most of this is just basic html. Notice the "echo" command. I kinda cheat and make a open quote and then shove all my html before the last '; at the bottom. So lets see what we have. Basically there are 2 input boxes. One for ID and one for PW. To get the PW box to show up as dots to hide the typing, simply use the "type" as PASSWORD. We name the id "username" and pw as "password". Pretty self explanitory. Feel free to tinker with this one. If you're really good at html this should be pretty easy.

0 comments: