Advertisement
jmillard

Untitled

Dec 4th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. #!/usr/local/bin/php
  2. <?php
  3.  
  4.  
  5.  
  6. $uVIN = $_GET['VIN'];
  7. //echo $uVIN;
  8.  
  9. $uMake = $_GET['MAN'];
  10. //echo $uMake;
  11.  
  12. $uModel = $_GET['MON'];
  13. //echo $uModel;
  14.  
  15. $uYear = $_GET['Y'];
  16. //echo $uYear;
  17.  
  18. $uMPG = $_GET['MPG'];
  19. //echo $uMPG;
  20.  
  21. $uTrans = $_GET['T'];
  22. //echo $uTrans;
  23.  
  24. $uCondition = $_GET['C'];
  25. //echo $uCondition;
  26.  
  27. $uMiles = $_GET['MILES'];
  28. //echo $uMiles;
  29.  
  30. $uIncidents = $_GET['I'];
  31. //echo $uIncidents;
  32.  
  33. $uOwners = $_GET['NO'];
  34. //echo $uOwners;
  35.  
  36. $uCost = $_GET['COST'];
  37. //echo $uCost;
  38.  
  39. $uColor = $_GET['COLOR'];
  40. //echo $uColor;
  41.  
  42. $uState = $_GET['STATE'];
  43. //echo $uState;
  44.  
  45. $uRegion = $_GET['REGION'];
  46. //echo $uRegion;
  47. ?>
  48.  
  49.  
  50.  
  51.  
  52.  
  53. <?php
  54. //Script for adding VIN to currentUserFavorites
  55. $connection = oci_connect($username = '*******',
  56. $password = '*************',
  57. $connection_string = '//oracle.cise.ufl.edu/orcl');
  58.  
  59. //Test to see if seperate php block can echo variable from php block above
  60. echo "Lower VIN Test";
  61. echo $uVIN;
  62.  
  63. //Retrive current user. Store as $uname
  64. $loginpls = oci_parse($connection, "SELECT * FROM currentUser");
  65. oci_execute($loginpls);
  66. $row = oci_fetch_array($loginpls);
  67. $uname = $row[0];
  68. oci_free_statement($loginpls);
  69.  
  70. //Check to see if vehicle is already in favorites or current user
  71. $favBool = oci_parse($connection, "Select case when favusername is NULL then '0' else '1' end from FAVORITES where favusername = '$uname' and favvin = '$uVIN'");
  72. oci_execute($favBool);
  73. $test = oci_fetch_array($favBool);
  74.  
  75. echo $uVIN;
  76. echo $uname;
  77. //Should echo a 1 if vehicle is already in current user's favorites WORKING!
  78. //echo "$test[0]";
  79. oci_free_statement($favBool);
  80.  
  81. //Checks to see if VIN is already in user's favorites
  82. if ($test[0] != 1){
  83.     $addFav = oci_parse($connection, "Insert into Favorites(favusername, favvin) VALUES ('$uname', '$uVIN')");
  84.     oci_execute($addFav);
  85.     echo "Attempted to execute favoriting";
  86. }
  87.  
  88. oci_close($connection);
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement