Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("header.php");
- print "<STYLE>body { font-family: georgia; }</STYLE>";
- // Validation begins
- if(!empty($submit))
- {
- $error = 0;
- // Check username. not allowed to leave it empty
- if(empty($username))
- {
- $usernameerr = "Please type your username<BR>";
- $error++;
- }
- // Check password. not allowed to leave it empty
- if(empty($password))
- {
- $passworderr = "Please type your password";
- $error++;
- }
- // If there's no error
- if($error == 0)
- {
- // compare what the user type in with the data in the database
- $result = mysql_query("select * from member where username = '$username' and password = '$password'");
- // if the data doesn't match
- if(mysql_num_rows($result) == 0)
- {
- $loginerr = "Username or password is incorrect. Please try again";
- }
- // if log in successfully, go to 'Home' page
- else
- {
- $data = mysql_fetch_array($result);
- session_register("MEMBERNAME");
- session_register("MEMBERID");
- $MEMBERNAME = $data["memberfname"];
- $MEMBERID = $data["memberid"];
- header("location: home.php");
- }
- }
- }
- print "<center>";
- // Menu bar
- print "<img src='pic/header.jpg' usemap='#Map'>";
- print "<map name='Map' id='Map'><area shape='rect' coords='32,-3,457,168' href='index.php' />";
- print "<area shape='rect' coords='524,37,624,67' href='howto.php' />";
- print "<area shape='rect' coords='655,89,756,120' href='contact.php' />";
- print "<area shape='rect' coords='720,21,822,53' href='aboutus.php' />";
- print "</map><BR>";
- print "<TABLE bordercolor='black' cellpadding='10' cellspacing='0' border='1'><TR><TD>";
- // Where error message is printed
- print "<center>$usernameerr $passworderr $loginerr</center>";
- // Log in form
- print "<FORM>";
- print "<img src='pic/loginlabel.jpg' align=absmiddle><img src='pic/usernamelabel.jpg' align=absmiddle>";
- print "<input type=text name=username value=$username>";
- print "<img src='pic/passwordlabel.jpg' align=absmiddle><input type=password name=password value=$password> ";
- print "<input type=submit name=submit value=GO>  <a href='register.php'><img src='pic/signupbutton.jpg' align=absmiddle></a>";
- print "</FORM></TABLE>";
- print "<img src='pic/instruction.jpg'>";
- // footer
- print "<img src='pic/footer.jpg'>";
- print "</center>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement