Code:
<?php $username="root"; $password=""; $database="lko_phone"; $host="localhost"; $msg=""; mysql_connect($host,$username,$password); @mysql_select_db($database); if($_SERVER["REQUEST_METHOD"] == "POST") { $myusername=$_POST['unm']; $mypassword=$_POST['pwd']; $sql="SELECT * FROM login WHERE id='$myusername' and pwd='$mypassword'"; $result=mysql_query($sql); $row = mysql_fetch_assoc($result) // Mysql_num_row is counting table row $num = mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { session_start(); $_SESSION['UID'] = $row['id']; $_SESSION['PWD'] = $row['pwd']; $_SESSION['RGT'] = $row['access']; header("location:Welcome.php"); } else { msg="Wrong user name and/or Password" } } mysql_free_result($result); ?> <html> <body background="Images/Back15.jpg" text='black'> <center> <table width=100% border=0> <tr> <td align=center><img src="Images/Logo.JPG"></td> <td><font face="courier new" size="5" color="orange"><strong>Welcome To: LII - ESS maintenance</strong></font> <br><font face="courier new" size="2" color="yellow">Employee-System-Software Maintenance</font></td> </tr> </table> </center> <form action="index.php" method=POST> <center> <table width="200" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="14"><img src="TableImage/TL.png" width=14 height=23 border="0" /></td> <td background="Images/Back1.jpg" colspan="2" align="center"> <font face='arial' size='4' color='maroon'><strong> Enter Login Information </font> </td> <td width="14"><img src="TableImage/TR.png" width=14 height=23 border="0" /></td> </tr> <tr> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> </tr> <tr> <td background="Images/Back1.jpg"></td> <td background="Images/Back1.jpg" align="right"><font face='verdana' size='4'>Username:</font></td> <td background="Images/Back1.jpg"><input type='text' name='unm'/></td> <td background="Images/Back1.jpg"></td> </tr> <tr> <td background="Images/Back1.jpg"></td> <td background="Images/Back1.jpg" align="right"><font face='verdana' size='4'>Password:</font></td> <td background="Images/Back1.jpg"><input type='password' name='pwd'></td> <td background="Images/Back1.jpg"></td> </tr> <tr> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> </tr> <tr> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg" align="center" colspan="2"><input type='submit' name='log' value=' login '></td> <td background="Images/Back1.jpg"> </td> </tr> <tr> <td><img src="TableImage/BL.png" width=14 height=23 border="0" /></td> <td background="Images/Back1.jpg"> </td> <td background="Images/Back1.jpg"> </td> <td><img src="TableImage/BR.png" width=14 height=23 border="0" /></td> </tr> </table> </center> <p align=Center><?php echo $msg ?></p> </form> </body> </html>
Comment