Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <form action="sam.php" method="post">
- username:<input type="text" name="username"><br>
- password:<input type="password" name="password"><br>
- <input type="submit">
- </form>
- <?php
- $host='localhost:3306';
- $dbname='sam';
- $con=mysql_connect($host,'root','root') or die(mysql_error());
- $db=mysql_select_db($dbname,$con) or die(mysql_error());
- $id=$_POST['username'];
- $pass=$_POST['password'];
- echo $id;
- if(!empty($_POST['username']))
- {
- $query=mysql_query("select * from loginpage") or die(mysql_error());
- $row=mysql_fetch_array($query) or die(mysql_error());
- if($row['name']==$id and $row['password']==$pass)
- {
- echo " login succesfull";
- }
- else
- {
- echo " failed";
- }
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment