Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Php Login</title>
- </head>
- <body>
- <form action="checkuserlogin.php" method="post">
- Username:
- <input type="text" name="uname">
- <br/>
- <br/>
- Password:
- <input type="password" name="pword">
- <br />
- <br />
- Name:
- <input type="text" name="name">
- <br />
- <br />
- Gender:
- <br />
- <input type="radio" name="gender" value="Male">Male<br />
- <input type="radio" name="gender" value="Female">Female
- <br />
- <br />
- Date of Submission:
- <input type="datetime" name="submissiondate">
- <br />
- <br />
- <input type="submit" value="Login" name="save">
- </form>
- <?php
- if(isset($_GET['uname']) && isset($_GET['pword']))
- {
- echo "<b>Invalid Username and Password</b>";
- }
- ?>
- </body>
- </html>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Check User Login</title>
- </head>
- <body>
- <?php
- $u=$_POST['uname'];
- $p=$_POST['pword'];
- $u=$_POST['uname'];
- $p=$_POST['pword'];
- $u=$_POST['uname'];
- $p=$_POST['pword'];
- $n=$_POST['name'];
- $g=$_POST['gender'];
- date_default_timezone_set('Asia/Singapore');
- $time=date('Y-m-d H:i:s');
- $s=$time . $_POST['submissiondate'];
- $conn=mysqli_connect("localhost", "root", "" , "db_healthcare");
- $sql="INSERT INTO users_care(uname, pword, name, gender, submissiondate) VALUES ('$u' , '$p', '$n' , '$g' , '$s')";
- $result=mysqli_query($conn, $sql);
- if($result)
- {
- echo "Data Saved";
- }
- else
- {
- echo "Not Saved";
- }
- mysqli_close($conn);
- ?>
- <?php
- if(isset($_POST["uname"]))
- {
- $u=$_POST['uname'];
- $p=$_POST['pword'];
- $query = "SELECT * FROM users_care WHERE uname='" .$u. "' AND pword='" .$p. "' ";
- $search_result=mysqli_query($conn, $query);
- $userfound=mysqli_num_rows($search_result);
- if($userfound >= 1)
- {
- header("Location: success.html");
- }
- else
- {
- header("Location: login.php?uname=" . $u . "&pw=" . $p);
- }
- }
- mysqli_close($conn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement