SHARE
TWEET

Untitled

a guest Apr 25th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <h3>Wildlife Collision Record</h3>
  2.        
  3.         <?php
  4.             require_once("db.php");
  5.  
  6.             $species1 = $_REQUEST['species'];
  7.             $species2 = $_REQUEST['txtSpecies'];
  8.             $gender = $_REQUEST['rbGender'];
  9.             $age = $_REQUEST['rbAge'];
  10.             $date = $_REQUEST['rpDate'];
  11.             $location = $_REQUEST['location'];
  12.             $latitude = $_REQUEST['lat'];
  13.             $longitude = $_REQUEST['lng'];
  14.             if ($species1 === "Others");
  15.                 $species1 = $species2;
  16.             if (!empty($species1) && is_string($species1) && !empty($location)&& is_string($location))
  17.             {
  18.             $imgURL = null;}
  19.  
  20.             ?>
  21.  
  22.             <p>Your information been recorded.</p>
  23.             <dl>
  24.                 <dt>Species:</dt>
  25.                 <dd><?php print $species1; ?></dd>
  26.             </dl>
  27.    
  28.             <dl>
  29.                 <dt>Gender:</dt>
  30.                 <dd><?php print $gender; ?></dd>
  31.             </dl>
  32.    
  33.    
  34.             <dl>
  35.                 <dt>Age:</dt>
  36.                 <dd><?php print $age; ?></dd>
  37.             </dl>
  38.    
  39.    
  40.             <dl>
  41.                 <dt>Date:</dt>
  42.                 <dd><?php print $date; ?></dd>
  43.             </dl>
  44.    
  45.             <dl>
  46.                 <dt>Location:</dt>
  47.                 <dd><?php print $location; ?></dd>
  48.             </dl>
  49.    
  50.             <dl>
  51.                 <dt>Latitude:</dt>
  52.                 <dd><?$latitude = is_numeric($latitude)? $latitude : "NULL"; print $latitude; ?></dd>
  53.             </dl>
  54.    
  55.             <dl>
  56.                 <dt>Longitude:</dt>
  57.                 <dd><?$longitude = is_numeric($longitude) ? $longitude : "NULL"; print $longitude;; ?></dd>
  58.             </dl>
  59.         <?php
  60.  
  61.  if ($_FILES["imgFile"]["error"] > 0)
  62.  {
  63.      // Something happened that prevented the file from uploading...
  64.      print ("<p>File Upload Error: " . $_FILES["imgFile"]["error"] . "</p>");
  65.  }
  66.  elseif(
  67.      ($_FILES["imgFile"]["type"] == "image/gif") ||
  68.      ($_FILES["imgFile"]["type"] == "image/jpeg") ||
  69.      ($_FILES["imgFile"]["type"] == "image/jpg") ||
  70.      ($_FILES["imgFile"]["type"] == "image/png") &&
  71.      ($_FILES["imgFile"]["size"] < 1000000)
  72.  )
  73.  {
  74.      // The file uploaded without any issues, so get...
  75.      // - file name
  76.      $filename = $_FILES["imgFile"]["name"];
  77.      // - tmp name
  78.      $tmpname = $_FILES["imgFile"] ["tmp_name"];
  79.      // - path
  80.      $path = "uploads\\";
  81.      // ...set the destination...
  82.      $imgURL = $destpath  . $filename;
  83.      // ...and try to copy the file...
  84.      if(file_exists($imgURL))
  85.      {
  86.          // - The file already exists... That's an error!
  87.          print("<p>File Upload Error: " . $filename . " already exists.</p>");  
  88.      }
  89.      else
  90.      {
  91.          // - Try to move the uploaded file to the destination
  92.          if(move_uploaded_file($tmpname, $imgURL))
  93.          {
  94.              // - It worked, so let the user know it worked
  95.              print("<p>File "  .  $filename  .  " uploaded successfully.</p>");
  96.          }
  97.          else
  98.          {
  99.              // - An error occurred, so let the user know:
  100.              print("<p>File Upload Error: " .  "File cannot be moved.</p>");
  101.          }
  102.  
  103.     }
  104. }    
  105.  else
  106.  {
  107.      // - Some other error occurred, let the user know...
  108.      print("<p>File upload Error:Invalid File </p>");
  109.  }
  110.  
  111.  ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top