Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'connect.php';
- if(isset($_REQUEST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- if(!empty($username) && !empty($password)){
- $sel = "SELECT * FROM members WHERE username = '$username' AND password = '$password'";
- $re = mysql_query($sel);
- if($re){
- $me = mysql_fetch_array($re);
- if($me == 0){
- $message= 'Username and Password Incorrect';
- }else{
- $_SESSION['username'] = $username;
- header('Location: mainpage.php');
- }
- }
- }else{
- $message= 'All fields are required';
- }
- }else{
- $message= "";
- }
- ?>
- <html>
- <title>School Stuff</title>
- <head>
- <link rel="stylesheet" href="css/style.css" type="text/css">
- </head>
- <body>
- <div id="container">
- <div class="head">
- School Portal
- </div>
- <div id="sideleft">
- <div class="sideleft">
- <ul>
- <li><a href="index.php" title="">Home Page</a></li>
- <li><a href="reg.php" title="">Register</a></li>
- </ul>
- </div>
- </div>
- <div id="sideright";>
- <h4>Login</h4>
- <form action="index.php" method="post">
- <font face="Times New Roman, Times, serif" color="#CC0000"><?php echo $message; ?></font>
- <table>
- <tr>
- <td>Username</td>
- <td><input type="text" name="username"></td>
- </tr>
- <tr>
- <td>Password</td>
- <td><input type="password" name="password"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="submit" value="Login"></td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment