Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start();
- $emaillogin = '';
- $action = $_GET[action];
- //code for adding new user
- $lnamenew = $_POST['Lname'];
- $fnamenew = $_POST['Fname'];
- $emailnew = $_POST['Email'];
- $passnew = $_POST['Pass'];
- if($fnamenew != "")
- {
- $query = "INSERT INTO users VALUES (seq_ID.nextval,'$fnamenew','$lnamenew','','','','','','','','$emailnew','$passnew')"; //case insensitive
- /* Set oracle user login and password info */
- $dbuser = "lmacfarl"; /* your deakin login */
- $dbpass = "newpassword"; /* your deakin password */
- $db = "SSID";
- $connect = oci_connect($dbuser, $dbpass, $db);
- if (!$connect) {
- echo "An error occurred connecting to the database";
- exit;
- }
- /* check the sql statement for errors and if errors report them */
- $stmt = oci_parse($connect, $query);
- //echo "SQL: $query<br>";
- if(!$stmt) {
- echo "An error occurred in parsing the sql string.\n";
- exit;
- }
- oci_execute($stmt);
- $_SESSION["loggedin"] = "true";
- $_SESSION["fname"] = $fnamenew;
- $_SESSION["lname"] = $fnamenew;
- $_SESSION["email"] = $fnamenew;
- oci_close($connect);
- }
- //code for logging in
- $emaillogin = $_POST["email"];
- $password = $_POST["password"];
- if($emaillogin != "")
- {
- $query = "SELECT * FROM users WHERE EMAIL LIKE '$emaillogin' AND PASSWORD LIKE '$password'"; //case insensitive
- //echo("$query");
- /* Set oracle user login and password info */
- $dbuser = "lmacfarl"; /* your deakin login */
- $dbpass = "newpassword"; /* your deakin password */
- $db = "SSID";
- $connect = oci_connect($dbuser, $dbpass, $db);
- if (!$connect) {
- echo "An error occurred connecting to the database";
- exit;
- }
- /* check the sql statement for errors and if errors report them */
- $stmt = oci_parse($connect, $query);
- //echo "SQL: $query<br>";
- if(!$stmt) {
- echo "An error occurred in parsing the sql string.\n";
- exit;
- }
- oci_execute($stmt);
- while (oci_fetch_array($stmt)) {
- $_SESSION["loggedin"] = "true";
- $_SESSION["fname"] = oci_result($stmt,"FIRSTNAME");
- $_SESSION["lname"] = oci_result($stmt,"LASTNAME");
- $_SESSION["email"] = oci_result($stmt,"EMAIL");
- oci_close($connect);
- }
- }
- if($action == 'logout')
- {
- $_SESSION["loggedin"] = "false";
- $_SESSION["fname"] = '';
- $_SESSION["lname"] = '';
- $_SESSION["email"] = '';
- }
- ?>
Add Comment
Please, Sign In to add comment