TY_BCA_AWT_SLIP 6_1


6.    Write a PHP Script create login form and validate it (Use database and Sticky form concept)
Sticky Form


<html>
<head>
<title>Sticky Form</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=post>
<input type=text name=txtuname value="<?php if(isset($_POST['txtuname']))echo $_POST['txtuname'];?>" ></br>
<input type=password name=txtupass value="<?php if(isset($_POST['txtupass']))echo $_POST['txtupass'];?>" ></br>
<input type=submit value="Login" name=submit>
<?php
if(isset($_POST['submit']))
$nm=$_POST['txtuname'];
$ps=$_POST['txtupass'];
$con=mysql_connect("localhost","root","rsb");
mysql_elect_db("slip6db",$con);
$result=mysql_query("select * from login where uname='$nm' and upass='$ps'");
$flag=0;
while($row=mysql_fetch_array($result))
{
  $flag++;
}
if($flag==1)
  echo "Login validated";
else
  echo "username or password invalid";
?>
</body>
</html>

4 comments:

  1. That's a Great Article and more useful for anyone.Thanks for sharing...
    PHP Training course in chennai

    ReplyDelete
  2. Mereka memberikan beberapa jenis promosi serta bonus menarik. Hingga banyak beberapa pengagum domino online yang tertarik untuk bermain judi dalam situs perjudian mereka.
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terpercaya
    hobiqq
    paito warna
    forum prediksi

    ReplyDelete
  3. Very often client faces some typically common issues like he/she isn’t prepared to open QuickBooks Technical Support Number package, it is playing terribly slow, struggling to set up and re-install, a challenge in printing checks or client reports. good job
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete

Note: only a member of this blog may post a comment.