Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Session */
- session_start(); //Nicht vergessen
- $name = $_POST['email'];
- //Session registrieren
- $_SESSION['username'] = $name;
- /* Session end */
- $username = filter_input(INPUT_POST, 'email');
- $password = filter_input(INPUT_POST, 'password');
- if (!empty($username)){
- if (!empty($password)){
- $host = "127.0.0.1";
- $dbusername = "Webinterface";
- $dbpassword = "KrstpSx1JFfW7Cxb";
- $dbname = "Webinterface";
- /* $hash = crypt($dbpassword); */
- // Create connection
- $conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
- if (mysqli_connect_error()){
- die('Connect Error ('. mysqli_connect_errno() .') '
- . mysqli_connect_error());
- }
- else{
- $sql = "SELECT * FROM login WHERE password='$password' AND email='$username'";
- $result = $conn->query($sql);
- $count = mysqli_num_rows($result);
- if($count === 1){
- header('Location: home.php');
- }else {
- echo "Wrong Logindata. - ".$count;
- }
- /*if (){
- }
- else{
- echo "Error: ". $sql ."
- ". $conn->error;
- }
- $conn->close();
- }*/
- }
- }
- else{
- echo "Password should not be empty";
- die();
- }
- }
- else{
- echo "E-Mail should not be empty";
- die();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement