Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Registo</title>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <style type="text/css">
- #principal{
- margin: auto;
- width: 23%;
- border: 3px solid #0099ff;
- padding: 10px;
- border-radius: 5px;
- margin-top: 50px;
- margin-left: 200px;
- float: left;
- }
- body{
- background-color: white;
- color: black;
- font-family: cursive;
- }
- #registo{
- cursor: pointer;
- border-radius: 10px;
- width: 100%;
- height: 100%;
- }
- legend{
- font-size: 30px;
- font-family: Rockwell;
- }
- img{
- float: left;
- width: 30%;
- height: 25%;
- border-radius: 10px;
- border: 3px solid #0099ff;
- margin-left: 10%;
- margin-top: 5%;
- cursor: pointer;
- }
- img:hover {
- /* Start the shake animation and make the animation last for 0.5 seconds */
- animation: shake 0.5s;
- /* When the animation is finished, start again */
- animation-iteration-count: infinite;
- }
- @keyframes shake {
- 0% { transform: translate(1px, 1px) rotate(0deg); }
- 10% { transform: translate(-1px, -2px) rotate(-1deg); }
- 20% { transform: translate(-3px, 0px) rotate(1deg); }
- 30% { transform: translate(3px, 2px) rotate(0deg); }
- 40% { transform: translate(1px, -1px) rotate(1deg); }
- 50% { transform: translate(-1px, 2px) rotate(-1deg); }
- 60% { transform: translate(-3px, 1px) rotate(0deg); }
- 70% { transform: translate(3px, 1px) rotate(-1deg); }
- 80% { transform: translate(-1px, -1px) rotate(1deg); }
- 90% { transform: translate(1px, 2px) rotate(0deg); }
- 100% { transform: translate(1px, -2px) rotate(-1deg); }
- }
- .ok{
- background-color: #00ff00;
- color: white;
- border-radius: 10px;
- width: 100%;
- height: 30px;
- text-align: center;
- }
- .alert{
- background-color: #ff0000;
- color: white;
- border-radius: 10px;
- width: 100%;
- height: 50px;
- text-align: center;
- }
- </style>
- </head>
- <body>
- <?php
- $bd_host="localhost";
- $bd_user="root";
- $bd_password="";
- $bd_database="website";
- $ms = new mysqli($bd_host,$bd_user,$bd_password,$bd_database);
- if ($ms->connect_error) {
- die('Erro: ('. $ms->connect_errno .') '. $ms->connect_error);
- }
- $msg="";
- if (isset($_POST["registar"])) {
- if($_POST["mail"]=="" || $_POST["password"]=="" || $_POST["nome"]==""){
- $msg="<div class='alert'>Tem de completar a informação!</div>";
- }
- else{
- $query = "INSERT INTO login(mail,password,nome) VALUES(?,?,?)";
- $statement = $ms->prepare($query);
- $statement->bind_param('sss', $_POST["mail"],
- $_POST["password"],
- $_POST["nome"]);
- if ($statement->execute() && $statement->affected_rows>0){
- $msg= "<div class='ok'>Carregue no botão e faça Login</div>";
- }
- else{
- $msg= "<div class='alert'>Já Foi inserido esse E-mail!</div>";
- }
- $statement->close();
- }
- }
- ?>
- <img src="pc.jpg" class="img-fluid" alt="Responsive image">
- <div id="principal">
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
- <legend>Registo</legend>
- <label>Nome:</label><input class="form-control mr-sm-2" type="text" name="nome" placeholder="Nome" aria-label="Search"><br>
- <label>Email: </label><input class="form-control mr-sm-2" type="email" name="mail" placeholder="E-mail" aria-label="Search" autocomplete="on"><br>
- <label>Password:</label><input class="form-control mr-sm-2" type="password" name="password" placeholder="Password" aria-label="Search"><br>
- <br>
- <button type="submit" class="btn btn-outline-info" name="registar" id="registo">Registar</button>
- <br>
- </form>
- <br>
- <?php
- echo "$msg";
- ?>
- <br>
- <button class="btn btn-outline-primary" type="submit" id="butao" onclick="window.open('index.php');">Visitar WebSite</button>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment