Hey,
ich wollte fragen wie ich zu meinem login und der regestrierungseite eine captcha einbauen kann.
Ich habe es schon versucht aber ich weis nicht was für ein script man brauch das man nur sich einloggen/regestrieren kann wenn man das captcha macht.
Ich brauche hilfe welchen script ich brauche und wo ich ihn einsetzten sollte
Hier sind die php scripte: login.php + Regestrieren.php
Download link:
Login: http://www.mediafire.com/file/h8diw2i4stj8h97/login.php
Reg.: http://www.mediafire.com/file/chca7cab3bn71qa/register.php
PHP
<?php
ob_start();
if(file_exists("install.php") == "1"){ header('Location: install.php'); exit();}
include 'inc/database.php';
$result = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));while($row = mysqli_fetch_assoc($result)){ $website = $row['website']; $favicon = $row['favicon'];}$result = mysqli_query($con, "SELECT * FROM `users`") or die(mysqli_error($con));while($row = mysqli_fetch_assoc($result)){ $date = $row['date']; $ip = $row['ip'];}
if (!isset($_SESSION)) { session_start(); }
if (isset($_SESSION['username'])) { header('Location: index.php'); exit();}
if(isset($_POST['username']) && isset($_POST['password'])){
$username = mysqli_real_escape_string($con, $_POST['username']); $password = mysqli_real_escape_string($con, ($_POST['password'])); $result = mysqli_query($con, "SELECT * FROM `users` WHERE `username` = '$username'") or die(mysqli_error($con)); if(mysqli_num_rows($result) < 1){ header("Location: login.php?error=incorrect-password"); } while($row = mysqli_fetch_array($result)){ if($password != $row['password']){ header("Location: login.php?error=incorrect-password"); }elseif($row['status'] == "0"){ header("Location: login.php?error=banned"); }else{ $_SESSION['id'] = $row['id']; $_SESSION['username'] = $username; $_SESSION['email'] = $row['email']; $_SESSION['rank'] = $row['rank']; $_SESSION['ip'] = $row['ip']; $_SESSION['date'] = $row['date']; $_SESSION['last_online'] = $row['last_online']; header("Location: index.php"); } } }
?><!DOCTYPE html><html lang="en"><head>
<title><?php echo $website; ?> - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="<?php echo $favicon;?>"> <link href="css/stylesheets.css" rel="stylesheet" type="text/css" /> <link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'> <script type='text/javascript' src='js/plugins/jquery/jquery.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/jquery-ui.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/jquery-migrate.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/globalize.js'></script> <script type='text/javascript' src='js/plugins/bootstrap/bootstrap.min.js'></script> <script type='text/javascript' src='js/plugins/uniform/jquery.uniform.min.js'></script> <script type='text/javascript' src='js/plugins.js'></script> <script type='text/javascript' src='js/actions.js'></script> </head><body class="bg-img-num1"> <!--Start of Tawk.to Script--><script type="text/javascript">var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();(function(){var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];s1.async=true;s1.src='https://embed.tawk.to/5812090da4209520469a4aaf/default';s1.charset='UTF-8';s1.setAttribute('crossorigin','*');s0.parentNode.insertBefore(s1,s0);})();</script><!--End of Tawk.to Script--> <div class="container"> <br /><br /><br /> <center><p style="font-size: 100pt; font-family: 'Lobster', cursive; text-shadow: 3px 3px 3px #000; "> <?php echo $website; ?></p></center>
<div class="login-block"> <div class="block block-transparent"> <div class="head"> <div class="user"> <div class="info user-change"> <img src="../img/pb1.jpg" class="img-circle img-thumbnail"/> </div> </div> </div> <form class="form-signin" action="login.php" method="POST"> <div class="content controls npt"> <div class="form-row user-change-row"> <div class="col-md-12"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-user"></span> </div> <input type="text" class="form-control" placeholder="Login"/> </div> </div> </div> <div class="form-row"> <div class="col-md-12"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-user"></span> </div> <input type="text" id="username" name="username" class="form-control" placeholder="Username" autofocus> </div> </div> </div> <div class="form-row"> <div class="col-md-12"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-key"></span> </div> <input type="password" id="password" name="password" class="form-control" placeholder="Passwort"> </div> </div> </div> <div class="form-row"> <div class="col-md-6"> <a href="register.php" class="btn btn-default btn-block btn-clean">Registrieren</a> </div> <div class="col-md-6"> <button class="btn btn-default btn-block btn-clean" type="submit"> Login </button> </div> <html> </div> </form> </div> </div> </div>
</div> <marquee behavior="alternate" direction="left" scrolldelay="6" scrollamount="6"><font face="Comic Sans MS" size="6" color="#FF0000"> Zahlung nur per Paysafecard! ~> Facebook: Lasse Rau <~</marquee>
<!-- js placed at the end of the document so the pages load faster --> <script src="js/jquery.js"></script> <script src="js/bootstrap.min.js"></script> <?php if(isset($_GET['error'])){ echo "<script type='text/javascript'> $(document).ready(function(){ $('#error').modal('show'); }); </script>" ; } ?> <?php if($_GET['error'] == "banned"){ echo ' <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;"> <div class="modal-dialog modal-sm"> <div class="modal-content panel-danger"> <div class="modal-header panel-heading"> <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Ups..!</h3></center> </div> <div class="modal-body"> <center> <strong> Dein Account wurde gebannt.</strong> </center> </div> </div> </div> </div> '; }
if($_GET['error'] == "incorrect-password"){ echo ' <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;"> <div class="modal-dialog modal-sm"> <div class="modal-content panel-danger"> <div class="modal-header panel-heading"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><font color="black">×</button></font> <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Ups..</h3></center> </div> <div class="modal-body"> <center> <strong>Die Einloggdaten sind falsch, oder es gibt diesen Account nicht..</strong> </center> </div> </div> </div> </div> '; } if($_GET['error'] == "not-logged-in"){ echo ' <div class="modal fade" id="error" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true" style="padding-top: 15%; overflow-y: visible; display: none;"> <div class="modal-dialog modal-sm"> <div class="modal-content panel-warning"> <div class="modal-header panel-heading"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><font color="black">×</button></font> <center><h3 style="margin:0;"><i class="icon-warning-sign"></i> Ups..!</h3></center> </div> <div class="modal-body"> <center> <strong>Du musst dich zuerst einloggen</strong> </center> </div> </div> </div> </div> '; } ?><script> !function ($) { $(document).on("click","ul.nav li.parent > a > span.icon", function(){ $(this).find('em:first').toggleClass("glyphicon-minus"); }); $(".sidebar span.icon").find('em:first').addClass("glyphicon-plus"); }(window.jQuery);
$(window).on('resize', function () { if ($(window).width() > 768) $('#sidebar-collapse').collapse('show') }) $(window).on('resize', function () { if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide') }) </script> <embed id="player1" name="player1"width="0" height="0"src="Hund.mp3"allowscriptaccess="always"allowfullscreen="true"flashvars="Hund.mp3"></embed> </html
Alles anzeigen
PHP
<?php
ob_start();
if(file_exists("install.php") == "1"){ header('Location: install.php'); exit();}
include 'inc/database.php';
$result = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));while($row = mysqli_fetch_assoc($result)){ $website = $row['website']; $favicon = $row['favicon'];}
if (!isset($_SESSION)) { session_start(); }
if (isset($_SESSION['username'])) { header('Location: index.php'); exit();}
if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirmpassword']) && isset($_POST['email'])){
$username = mysqli_real_escape_string($con, $_POST['username']); $password = mysqli_real_escape_string($con, ($_POST['password'])); $confirmpassword = mysqli_real_escape_string($con, ($_POST['confirmpassword'])); $email = mysqli_real_escape_string($con, $_POST['email']); if($password != $confirmpassword){ die("The confirmation password was not equal to the password."); } if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { die("The email entered was not correct."); } $result = mysqli_query($con, "SELECT * FROM `users` WHERE `username` = '$username'") or die(mysqli_error($con)); if(mysqli_num_rows($result) > 0){ die("This username already exists."); } $result = mysqli_query($con, "SELECT * FROM `users` WHERE `email` = '$email'") or die(mysqli_error($con)); if(mysqli_num_rows($result) > 0){ die("This email already exists."); } $ip = mysqli_real_escape_string($con, $_SERVER['REMOTE_ADDR']); $date = date('Y-m-d'); $last_online = date('Y-m-d h:i:s'); mysqli_query($con, "INSERT INTO `users` (`username`, `password`, `email`, `date`, `ip`) VALUES ('$username', '$password', '$email', '$date', '$ip')") or die(mysqli_error($con)); header("Location: login.php?action=registered"); }
?><!DOCTYPE html><html lang="en"><head> <title><?php echo $website; ?> - Registrieren</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="<?php echo $favicon;?>"> <link href="css/stylesheets.css" rel="stylesheet" type="text/css" /> <link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'> <script type='text/javascript' src='js/plugins/jquery/jquery.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/jquery-ui.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/jquery-migrate.min.js'></script> <script type='text/javascript' src='js/plugins/jquery/globalize.js'></script> <script type='text/javascript' src='js/plugins/bootstrap/bootstrap.min.js'></script> <script type='text/javascript' src='js/plugins/uniform/jquery.uniform.min.js'></script> <script type='text/javascript' src='js/plugins.js'></script> <script type='text/javascript' src='js/actions.js'></script> <script type='text/javascript' src='js/settings.js'></script></head><body class="bg-img-num1"> <div class="container">
<div class="registration-block"> <div class="block block-transparent"> <div class="head tac"> <br /><br /><br /> <center><p style="font-size: 100pt; font-family: 'Lobster', cursive; text-shadow: 3px 3px 3px #000; "> <?php echo $website; ?></p></center> <br /><br /> </div> <div class="content controls npt">
<form class="form-signin" action="register.php" method="POST"> <div class="form-row" style="margin-top: 10px;"> <div class="col-md-6"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-key"></span> </div> <input type="text" id="username" name="username" class="form-control" placeholder="Username" autofocus> </div> </div> <div class="col-md-6"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-envelope"></span> </div> <input type="text" id="email" name="email" class="form-control" placeholder="Email"> </div> </div> </div> <div class="form-row"> <div class="col-md-6"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-lock"></span> </div> <input type="password" id="password" name="password" class="form-control" placeholder="Passwort"> </div> </div> <div class="col-md-6"> <div class="input-group"> <div class="input-group-addon"> <span class="icon-unlock-alt"></span> </div> <input type="password" id="confirmpassword" name="confirmpassword" class="form-control" placeholder="Passwort Wiederholung"> </div> </div> </div> <div class="form-row"> <div class="col-md-12"> <button class="btn btn-default btn-block btn-clean" type="submit"> Registrieren </button> </div> </div> <div class="form-row"> <div class="col-md-12 tac"><strong>OR USE</strong></div> </div> <div class="form-row"> <div class="col-md-12"> <a href="login.php" class="btn btn-default btn-block btn-clean">Login</a> </div> </div> </div> </div> </div>
</div>
</body></html>
Alles anzeigen
Vielen Dank für eure Hilfe