Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['desc'])) {
  3. if (!isset($_POST['iscorrect']) || $_POST['iscorrect'] == "") {
  4. echo "Sorry, important data to submit your question is missing. Please press back in your browser and try again and make sure you select a correct answer for the question.";
  5. exit();
  6. }
  7. if (!isset($_POST['type']) || $_POST['type'] == "") {
  8. echo "Sorry, there was an error parsing the form. Please press back in your browser and try again";
  9. exit();
  10. }
  11. require_once("scripts/connect_db.php");
  12. $name = $_POST['name'];
  13. $email = $_POST['email'];
  14. $name = mysqli_real_escape_string($connection, $name);
  15. $name = strip_tags($name);
  16. $email = mysqli_real_escape_string($connection, $email);
  17. $email = strip_tags($email);
  18. if (isset($_FILES['image'])) {
  19. $name = $_FILES['image']['tmp_name'];
  20. $image = base64_encode(
  21. file_get_contents(
  22. $_FILES['image']['tmp_name']
  23. )
  24. );
  25. }
  26. $sql = mysqli_query($connection, "INSERT INTO users (name,email,image) VALUES ('$name', '$email','$image')")or die(mysqli_error($connection));
  27. header('location: index.php?msg=' . $msg . '');
  28. $msg = 'merge';
  29. }
  30. ?>
  31. <?php
  32. $msg = "";
  33. if (isset($_GET['msg'])) {
  34. $msg = $_GET['msg'];
  35. }
  36. ?>
  37. <!doctype html>
  38. <html lang="en">
  39. <head>
  40. <meta charset="utf-8">
  41. <title>Licenta Ionut</title>
  42. <meta name="viewport" content="width=device-width, initial-scale=1">
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  44. <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
  45. <!-- font files -->
  46. <link href='//fonts.googleapis.com/css?family=Muli:400,300' rel='stylesheet' type='text/css'>
  47. <link href='//fonts.googleapis.com/css?family=Nunito:400,300,700' rel='stylesheet' type='text/css'>
  48. <!-- /font files -->
  49. <!-- css files -->
  50. <link href="css/style.css" rel='stylesheet' type='text/css' media="all" />
  51. <link href="web.js" rel='stylesheet' type='text/css' media="all" />
  52. <script type="text/javascript" src="web.js"></script>
  53. <!-- /css files -->
  54. </head>
  55. <body>
  56. <p style="color:#06F;"><?php echo $msg; ?></p>
  57. <h1>LogIn with Webcam Password</h1>
  58. <div class="log">
  59. <div class="content1">
  60. <h2>Sign In Form</h2>
  61. <form>
  62. <input type="text" name="userid" value="USERNAME" onfocus="this.value = '';" onblur="if (this.value == '') {
  63. this.value = 'USERNAME';
  64. }">
  65. <input type="password" name="psw" value="PASSWORD" onfocus="this.value = '';" onblur="if (this.value == '') {
  66. this.value = 'PASSWORD';}">
  67. <div class="button-row">
  68. <input type="submit" class="sign-in" value="Sign In">
  69. <input type="reset" class="reset" value="Reset">
  70. <div class="clear"></div>
  71. </div>
  72. </form>
  73. </div>
  74. <div class="content2">
  75. <h2>Register</h2>
  76. <form action="index.php", name="index.php" method="post" enctype="multipart/form-data">
  77. <input type="text" id="name" name="name" value="Nume">
  78. <input type="text" id="email" name="email" value="EmailAdress">
  79. <br>
  80.  
  81. <script type="text/javascript" src="webcam.js"></script>
  82. <script language="JavaScript">
  83. document.write(webcam.get_html(320, 240));
  84. </script>
  85. <div class="button-row">
  86. <input class="sign-in" type=button value="Configure" onClick="webcam.configure()" class="shiva">
  87. <input class="reset" type="submit" value="Register" id="image" onClick="take_snapshot()" class="shiva">
  88. </div>
  89. </form>
  90. </div>
  91. <div class="clear"></div>
  92. </div>
  93. </body>
  94. </html>
  95.  
  96. <?php
  97.  
  98. $db_host = "localhost";
  99. // Place the username for the MySQL database here
  100. $db_username = "Ionut";
  101. // Place the password for the MySQL database here
  102. $db_pass = "1993";
  103. // Place the name for the MySQL database here
  104. $db_name = "users";
  105.  
  106. // Run the connection here
  107. $connection=mysqli_connect("$db_host","$db_username","$db_pass") or die (mysqli_connect_error());
  108. mysqli_select_db($connection,"$db_name") or die ("no database");
  109. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement