Advertisement
Guest User

ERR

a guest
Aug 14th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <html>
  2. <body>
  3. <?php session_start();?>// session for this user has been started
  4. <?php
  5. $con = oci_connect("SYSTEM", "123456", "localhost:1521/ORCL");//connection string
  6. if (!$con) {
  7. $m = oci_error();
  8. echo $m['message'], "\n";
  9. //error fuction returns an oracle message.
  10. exit;
  11. $query = "SELECT ID FROM LOGIN WHERE USERNAME =: and PASSWORD=:PASSWORD";
  12. //query is sent to the db to fetch row id.
  13. $stid = oci_parse($con, $query);
  14. /*oci_parse fuction prepares the db to execute the statement.
  15. requires two parameters resource($con)and sql string.*/
  16. if (isset($_POST['USERNAME']) ||isset($_POST['PASSWORD'])){
  17. $USERNAME = $_POST['USERNAME'];
  18. $PASSWORD=$_POST['PASSWORD'];
  19.  
  20. }
  21. oci_bind_by_name($stid, ':USERNAME', $user);
  22. oci_bind_by_name($stid, ':PASSWORD', $name);
  23.  
  24. oci_execute($stid);
  25. $row = oci_fetch_array($stid, OCI_ASSOC);
  26. //oci_fetch_array returns a row from the db.
  27.  
  28. if ($row) {
  29. $_SESSION['USERNAME']=$_POST['USERNAME'];
  30. echo"log in successful";
  31. }
  32. else {
  33. echo("The person " . $name . " is not found .
  34. Please check the spelling and try again or check password");
  35. exit;
  36. }
  37. $USERNAME = $row['USERNAME'];
  38. oci_free_statement($stid);
  39. oci_close($con);
  40. header('Location: wel.php');
  41. //header function locates you to a welcome page saved s wel.php
  42. ?>
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement