error

gak kebaca header,, gak simpan ke db
mail@pastecode.io avatar
unknown
php
2 years ago
5.6 kB
2
Indexable
<?php 
    if(isset($_POST['register'])){
        $email=cleanup($_POST['email']);
        $username=cleanup($_POST['username']);
        $fullname=cleanup($_POST['fullname']);
        $notel=cleanup($_POST['notel']);
        $password=cleanup($_POST['password']);

        if(empty($email)){
            $blankemail="email need to input";
        }else{
            $cleanemail=$email;
        }

        if(empty($username)){
            $blankusername="username need to input";
        }else{
            $cleanusername=$username;
        }

        if(empty($fullname)){
            $blankfullname="full name need to input";
        }else{
            $cleanfullname=$fullname;
        }

        if(empty($notel)){
            $blanknotel="notel need to input";
        }else{
            $cleannotel=$notel;
        }

        if(empty($password)){
            $blankpassword="Password need to input";
        }else{
            $cleanpassword=$password;
        }

        if(isset($cleanemail) && isset($cleanusername) && isset ($cleanfullname) && isset($cleannotell) && isset($cleanpassword)){
        echo $email,$cleanusername.$cleanfullname.$cleannotel.$cleanpassword;

        $query="INSERT INTO user_account(email,username,full_name,notel,password) VALUES ('$email','$username','$fullname','$notel','$password')";

        if(mysqli_query($connect,$query)){
            header("location:http://tudungstokmanegement.test/index.php?url=register&success=1");
            exit();
        }else{
            header("location:http://tudungstokmanegement.test/index.php?url=register&failed=0");
            exit();
        }

        // $query="SELECT * FROM stoktudung WHERE username='$username'";
        }    
    }

?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Managemant System</title>
    <link rel="stylesheet" href="<?php embed_css("style.css")?>">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap" rel="stylesheet">
</head>
<body>
    <div class="header">
        <div class="container">
            <div class="header-logo">
                <h1><a href="">Stock Management</a></h1>
            </div>
        </div>
    </div>
    <div class="formlogin">
        <div class="container">
            <div class="row jc-center">
                <div class="col5">
                    <div class="form">
                        <h2>Login System</h2>
                        <form action="" method="post">
                        <div class="form-group">
                            <label for="email">email</label>
                            <input type="email" name="email" id="email" class="form-control">
                            <?php if(isset($blankemail)){ ?>
                            <small class="red"><?php echo $blankemail ?></small>
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <label for="username">Username</label>
                            <input type="text" name="username" id="username" class="form-control">
                            <?php if(isset($blankusername)){ ?>
                            <small class="red"><?php echo $blankusername ?></small>
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <label for="fullname">Nama Penuh</label>
                            <input type="text" name="fullname" id="fullname" class="form-control">
                            <?php if(isset($blankfullname)){ ?>
                            <small class="red"><?php echo $blankfullname ?></small>
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <label for="notel">notel</label>
                            <input type="number" name="notel" id="notel" class="form-control">
                            <?php if(isset($blanknotel)){ ?>
                            <small class="red"><?php echo $blanknotel ?></small>
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <label for="password">Password</label>
                            <input type="password" name="password" id="password" class="form-control">
                            <?php if(isset($blankpassword)){ ?>
                            <small class="red"><?php echo $blankpassword ?></small>
                            <?php }?>
                        </div>
                        <div class="form-group">
                            <button type="submit" value="register" name="register" class="btn-login">Register</button>
                            <button type="reset" class="btn-login" value="clear">Clear</button>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
</body>
</html>