Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!empty($_POST['login-submit']))
- {
- $user=$_POST['user'];
- $pass=$_POST['pass'];
- $servername="localhost";
- $username="root";
- //create connection
- $conn=new mysqli($servername,$username,"","projectdb");
- //check connection
- if($conn->connect_error)
- {
- die("failed".$conn->connect_error);
- }
- $sql="SELECT user FROM users where (name='".$user."' OR email='".$user."') and password='".$pass."')"; // pro$
- if($conn->query($sql)===TRUE)
- {
- echo "<html><h1>Welcome!</h1></html>";
- }
- else
- {
- echo "<html> <body> <h1>Hi!<h1></body></html>";
- }
- $conn->close();
- }
- if (!empty($_POST['register-submit']))
- {
- //insert in table;sms on phn-otp;mail on id,pass confirm pass same
- echo "Thank you!<br>";
- $fname=$_POST["fname"];
- $lname=$_POST["lname"];
- $email=$_POST["email"];
- $user=$_POST["user"];
- $pass=$_POST["pass"];
- $cpass=$_POST["cpass"];
- $phn=$_POST["phn"];
- if($pass!=$cpass)
- {
- echo("Password not same.");
- }
- //sms OTP
- //echo $name."<br>".$branch."<br>".$sex."<br>".$course."<br>".$contact."<br>".$emailid."<br>";
- $servername="localhost";
- $username="root";
- //create connection
- $conn=new mysqli($servername,$username,"","projectdb");
- //check connection
- if($conn->connect_error)
- {
- die("failed".$conn->connect_error);
- }
- //create database
- $sql="INSERT INTO users VALUES('".$fname."','".$lname."','".$email."','".$user."','".$pass."','".$phn."')"; //)",'".$_POST["column"]."')";
- if($conn->query($sql)===TRUE)
- {
- echo "You are successfully registered.<br><br>!";
- }
- else
- {
- echo "Some failure occured.";
- }
- $conn->close();
- }
Add Comment
Please, Sign In to add comment