 | Form submit & deal with custom object |
| <?php
| | 1:include "Classes/UserDetails.php";
| | 2:include "Secure/DataConnection.php";
| | 3:include "DTOObjects/UserDetailsDTO.php";
| | 4:
| | 5:if($_POST['frmaction']=="submitted")
| | 6:{
| | 7: $dtoObj=new UserDetailsDTO();
| | 8:
| | 9: $obj = $dtoObj->GetUser($_POST['username'], $_POST['userpass']);
| | 10:
| | 11: if($obj!=null)
| | 12: {
| | 13: echo $obj->get_Username();
| | 14: $_SESSION['username']=$_POST['username'];
| | 15: header("Location:phpstore\default.php");
| | 16: }
| | 17: else
| | 18: {
| | 19: echo "<font color='red'>Authentication failed. Invalid username / password.</font>";
| | 20: }
| | 21:
| | 22:}
| | 23:
| | 24:?>
| | 25:
| | 26:<form action="index.php" method="post">
| | 27:<input type="hidden" name="frmaction" value="submitted">
| | 28:<table>
| | 29:<tr><td>User Id :</td><td><input name="username" type="text"></td></tr>
| | 30:<tr><td>Password :</td><td><input name="userpass" type="password"></td></tr>
| | 31:<tr><td></td><td><input type="submit" value="Enter"></td></tr>
| | 32:</table>
| | 33:</form>
| | 34: |
|