Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php session_start();?>// session for this user has been started
- <?php
- $con = oci_connect("SYSTEM", "123456", "localhost:1521/ORCL");//connection string
- if (!$con) {
- $m = oci_error();
- echo $m['message'], "\n";
- //error fuction returns an oracle message.
- exit;
- $query = "SELECT ID FROM LOGIN WHERE USERNAME =: and PASSWORD=:PASSWORD";
- //query is sent to the db to fetch row id.
- $stid = oci_parse($con, $query);
- /*oci_parse fuction prepares the db to execute the statement.
- requires two parameters resource($con)and sql string.*/
- if (isset($_POST['USERNAME']) ||isset($_POST['PASSWORD'])){
- $USERNAME = $_POST['USERNAME'];
- $PASSWORD=$_POST['PASSWORD'];
- }
- oci_bind_by_name($stid, ':USERNAME', $user);
- oci_bind_by_name($stid, ':PASSWORD', $name);
- oci_execute($stid);
- $row = oci_fetch_array($stid, OCI_ASSOC);
- //oci_fetch_array returns a row from the db.
- if ($row) {
- $_SESSION['USERNAME']=$_POST['USERNAME'];
- echo"log in successful";
- }
- else {
- echo("The person " . $name . " is not found .
- Please check the spelling and try again or check password");
- exit;
- }
- $USERNAME = $row['USERNAME'];
- oci_free_statement($stid);
- oci_close($con);
- header('Location: wel.php');
- //header function locates you to a welcome page saved s wel.php
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement