Viewing file: log.php (1.09 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: new_reg.php"); } else { $error="Your Login Name or Password is invalid"; } } ?> <form action="" method="post"> <table width="403"> <tr> <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>
|