Advertisement
John148

Untitled

Jul 24th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. <?php
  2. require_once('appvars.php');
  3. require_once('connectvarsT.php');
  4.  
  5. if(isset($_POST['submit'])) {
  6. // Grab the score data from the POST
  7. $image= $_FILES['image']['name'];
  8. $image_type= $_FILES['image']['type'];
  9. $image_size= $_FILES['image']['size'];
  10. $prefix= $_POST['prefix'];
  11. $lname= $_POST['lname'];
  12. $info= $_POST['info'];
  13. $fname= $_POST['fname'];
  14. $suffix=$_POST['suffix'];
  15. $mname=$_POST['mname'];
  16. $email=$_POST['email'];
  17. $iid=$_POST['iid'];
  18. $eid=$_POST['eid'];
  19.  
  20. if(!empty($fname) && !empty($lname) && !empty($email)) {
  21. if((($image_type == 'image/jpeg') || ($image_type =='image/pjpeg') || ($image_type == 'image/png'))
  22. && ($image_size > 0) && ($image_size <= GW_MAXFILESIZE)){
  23. if ($_FILES['image']['error'] == 0) {
  24. //Move the file to the target upload folder
  25. $target = GW_UPLOADPATH . $image;
  26. if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
  27.  
  28. // Connect to the database
  29. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  30.  
  31. //Write the data to the database
  32. $query = "INSERT INTO login VALUES ('$image', '$prefix', '$lname', '$info', '$fname', '$suffix', '$mname', '$email', '$iid', '$eid')";
  33. mysqli_query($dbc, $query);
  34.  
  35. // Clear the score data to clear the form
  36.  
  37. $image="";
  38. $prefix="";
  39. $lname="";
  40. $info="";
  41. $fname="";
  42. $suffix="";
  43. $mname="";
  44. $email="";
  45. $iid="";
  46. $eid="";
  47. mysqli_close($dbc);
  48. }
  49. else {
  50. echo '<p class="error">Sorry, there was a problem uploading your image.</p>';
  51. }
  52. }
  53. }
  54. else {
  55. echo '<p class="error">The screen shot must be a JPEG, or PNG image file.</p>';
  56. }
  57. }
  58. else {
  59. echo '<p class="error">Please enter all of the information.</p>';
  60. }
  61. }
  62. ?>
  63. <!DOCTYPE html>
  64. <html lang="en">
  65. <head>
  66. <title>Bootstrap Example</title>
  67. <meta charset="utf-8">
  68. <meta name="viewport" content="width=device-width, initial-scale=1">
  69. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  70. <link rel="stylesheet" type="text/css" href="Tripnologies.css">
  71. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  72. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  73. </head>
  74. <body>
  75. <form enctype="multipart/form-data" method="post" action="<?PHP echo $_SERVER['PHP_SELF']; ?>" >
  76. <input type="hidden" name="MAX_FILE_SIZE" value="32768" />
  77.  
  78. <div class="container">
  79. <table class="table">
  80. <tr>
  81. <td>
  82. <p class="text-primary">Remove</p>
  83. </td>
  84. <td>
  85. <label class="btn btn-default btn-file">
  86. Choose File <input type="file" name="image" style="display: none;">
  87. </label><br />
  88. <small>image size(130x130)... jpg or png only.</small></h4>
  89. </td>
  90. <td>
  91. <button type="submit" class="btn btn-primary btn-lg" name="submit">Save Changes</button>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td>
  96. <div class="form-group">
  97. <label class="col-xs-3 control label">Prefix:</label><br />
  98. <div class="col-xs-5 selectContainer">
  99. <select name="prefix" class="form-control">
  100. <option value="Mr">Mr</option>
  101. <option value="Miss">Miss</option>
  102. <option value="Ms">Ms</option>
  103. </select>
  104. </div>
  105. </div>
  106. </div>
  107. </td>
  108. <td>
  109. <div class="form-group">
  110. <label for="lname">Last Name:</label>
  111. <input type="text" class="form-control" id="lname" name="lname">
  112. </div>
  113. </td>
  114. <td>
  115. <div class="form-group">
  116. <label for="info">Information:</label>
  117. <textarea class="form-control" rows="4" id="info" name="info"></textarea>
  118. </div>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td>
  123. <label for="fname">First Name:</label>
  124. <input type="text" class="form-control" id="fname" name="fname">
  125. </td>
  126. <td>
  127. <label for="suffix">Suffix:</label>
  128. <input type="text" class="form-control" id="suffix" name="suffix">
  129. </td>
  130. </tr>
  131. <tr>
  132. <td>
  133. <label for="mname">Middle Name:</label>
  134. <input type="text" class="form-control" id="mname" name="mname">
  135. </td>
  136. <td>
  137. <label for="lg">Login Email:</label>
  138. <input type="text" class="form-control" id="email" name="email">
  139. </td>
  140. </tr>
  141. <tr>
  142. <td>
  143. <label for="id">ID:</label>
  144. <input type="text" class="form-control" id="id" name="id" disabled>
  145. </td>
  146. <td>
  147. <label for="ii">Internal ID:</label>
  148. <input type="text" class="form-control" id="ii" name="iid">
  149. </td>
  150. <td>
  151. <label for="ei">External ID:</label>
  152. <input type="text" class="form-control" id="ei" name="eid">
  153. </td>
  154. </tr>
  155. </table>
  156. </div>
  157. </form>
  158. </body>
  159. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement