Commit 5e0d4a21 authored by stephanie.smith's avatar stephanie.smith

php

parent 3fed4577
......@@ -27,13 +27,13 @@
<h2>Login</h2>
</div>
<div class="card-body">
<form action ="login.php" method="post">
<form action ="readdata.php" method="post">
<div class="form-group">
<label for="email">Email </label>
<input type="email" id="email" class="form-control" name="email" required>
<label for="password">Password </label>
<input type="password" id="password" class="form-control" name="password" required>
<label for="pass">Password </label>
<input type="pass" id="pass" class="form-control" name="pass"required >
</div>
<input type="submit" class="btn btn-primary w-100" value="Login" name="">
</form>
......
<?php
$email = $_POST['emial'];
$password = $_POST['password'];
//connection
$con = new mysqli("localhost","root","","test");
if($con->connect_error){
die("failed to connect: ".$con->connect_error);
}else{
$stmt=$con->prepare("select * from registration where email = ?");
$stmt->bind_param("s",$email);
$stmt->execute();
$stmt_result=$stmt->get_result();
if ($stmt_result->num_rows>0){
if($data['password']=== $password)
echo "<h2>Login successful</h2>";
}else{
echo "<h2>Invalid email or password</h2>";
}
}
?>
\ No newline at end of file
<html>
<head>
</head>
<body>
<?php
if(isset($_POST['email'], $_POST['pass'])){
$conn=mysqli_connect('localhost:3306','stephanie.smith','0lnKdVkBKy','stephaniesmith_database');
$sql="INSERT INTO dataa (Email,Passwords) VALUES ('$email','$pass')";
$email = $_POST['email'];
$pass = $_POST['pass'];
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if (mysqli_query($conn,$sql)) {
echo "Record added";
}
mysqli_close($conn);
}
?>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment