Viewing file: login.php (1.21 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include("config.php"); session_start(); if($_SERVER["REQUEST_METHOD"] == "POST") { // username and password sent from Form $myusername=mysqli_real_escape_string($db,$_POST['username']); $mypassword=mysqli_real_escape_string($db,$_POST['password']);
$sql="SELECT * FROM login WHERE username='$myusername' and pass='$mypassword'"; $result=mysqli_query($db,$sql); $row=mysqli_fetch_array($result,MYSQLI_ASSOC); $active=$row['active']; $count=mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { session_register("myusername"); $_SESSION['login_user']=$myusername;
header("location: account_create.php"); } else { $error="Your Login Name or Password is invalid"; } } ?> <center> <form action="" method="post"> <table width="572"> <tr> <td width="159" rowspan="3"><img src="images/login.jpeg" width="126" height="93" /></td> <td width="159"> <label>UserName :</label></td> <td width="232"><input type="text" name="username"/><br /></td> </tr> <tr> <td> <label>Password :</label></td><td> <input type="password" name="password"/><br/></td></tr><tr> <td height="45"> <input type="submit" value=" Submit "/><br /></td></tr> </table> </form></center>
|