<!DOCTYPE html> <html> <head> <title>Power Tricks by fk</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <script src='js/bootstrap.min.js'></script> <script src='js/jquery.js'></script> <script type="text/javascript"> $(document).ready(function(){ //jquery script $("#username").change(function(){ var username = $(this).val(); //now sending this username to ajax page for geting img saved against this username. $.ajax({ url:"ajaxpage.php", data:{data:username} }).done(function(result) { //now assign result to its related place $(".img").html(result); }) }); }); </script> <style type="text/css"> .cntr {width: 50% ;margin: auto} </style> </head> <body> <div class="well well-sm cntr"> <h3 class="well well-sm " style="text-align: center;">Login here</h3> <div class="img "> <img src="photo/user.png" class="img-responsive center" style="width: 233px;margin: auto;"> </div><br> <input type="text" placeholder="username" class="form-control cntr input-sm" id="username"> <input type="text" placeholder="password" class="form-control cntr input-sm" name=""><br> <button class="btn btn-primary btn-sm btn-block cntr">Login</button> </div> </body> </html>
<?php //now here we have to receive that data $username = $_REQUEST['data']; //now if you want to get img from database //conect database here and get back the img //lets concet database here. $conn = new mysqli('localhost','root','','powertricks'); $query = $conn->query("select userimg from login where username = '$username'"); if($query->num_rows > 0) { $userData = $query->fetch_assoc(); echo "<img src='photo/".$userData['userimg']."'class='img-responsive center' style='width: 233px;margin: auto;' >"; } else echo "<img src='photo/unknown.png' class='img-responsive center' style='width: 233px;margin: auto;' >"; //if not found then unknown.png will be returned ?>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <script src='js/bootstrap.min.js'></script> <script src='js/jquery.js'></script>
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.