When I exit an Android app that is currently running a CodeIgniter web application within the Android mobile browser, the CodeIgniter session remains active and does not properly

Hello there, I am currently working on developing a Mobile App with CodeIgniter and PhoneGap/Cordova.

My application is designed to open a local static HTML file in the android web browser, followed by using window.open to redirect to an external URL on the server where my web application runs. After logging into the web application, closing the mobile app, and reopening it, I noticed that the session on the web application did not close as expected. This issue arises even though I have set the variable

$config['sess_expire_on_close'] = TRUE;

in the config.php file of CodeIgniter, which should terminate sessions when all browser windows are closed. Surprisingly, this functionality works flawlessly on desktop browsers but fails within the android web browser inside my app built using phonegap and compiled with phonegap build.

I would greatly appreciate any assistance or guidance on how to resolve this. Thank you in advance.

Answer №1

To tackle the issue at hand, I utilized the PHP variable $_SERVER['HTTP_REFERER'] to differentiate between a URL being accessed from the Mobile App or the Web Application. Depending on this distinction, I then proceeded to load either one HTML document or another.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Include a new XML child element using PHP

I've encountered an issue with my PHP code while trying to add multiple nodes from an XML file. Currently, the code only adds the first node, but I need it to include all child nodes under the name 'node'. XML Structure: <root> <re ...

Tips for organizing the output of wp_query

I'm looking to organize the results of my wp_query, wanting to arrange them by different parameters without needing to run the query again. Here is what I have so far: $the_query = new WP_Query( $args ); I’d like to sort $the_query; WP_Query gives ...

When an Ajax post request is made, the data being sent is appended to the JSON response

Having a dilemma with my ajax call: $.ajax({ url: '/assets/functions.php', type: 'POST', data: { "functionCall": "get-uploads", "type": type }, dataType: 'json', success: function (data ...

Wordpress is having issues running jQuery

I've developed a function inside js/custom.js. The purpose of this function is to arrange posts in my Wordpress site by applying a class called articleAlign. This class will enhance the spacing between the article title and its excerpt, but only when ...

Send a letter when there is no accompanying file attached

I am experiencing an issue with my email code. It is sending emails successfully when there are attachments, but if I send a file without an attachment, the email goes through with a blank white content instead of the text. I'm puzzled as to why it&a ...

Wordpress is experiencing a recurring issue with scripts being loaded multiple times

Currently, I am attempting to load some of my scripts from CDNs such as CDNjs and Google. While the scripts are loading correctly, I have noticed a strange issue where each script seems to generate two or even three HTTP requests (for the same script). You ...

Generating a multiplication grid using PHP

I'm currently facing a challenge regarding the presence of an additional "0" box on my multiplication table. Below is the code that I have been working with: $cols = 10; $rows = 10; $number = 0; $number2 = 0; echo "<table border=\"1\"> ...

Inquiry regarding the encryption methods I am using

After implementing a login system, I took steps to enhance its security. First, I generated a salt for the passwords: $salt = openssl_random_pseudo_bytes(1024); file_put_contents("salt.txt", $salt); Then, I hashed the passwords using the whirlpool algori ...

What is the cost associated with connecting to a MySQL database in terms of operation expenses?

During certain functions within the code, PHP performs numerous queries on the same tables using loops. Each query currently creates a new database connection, but how costly is this operation? Would reusing the same connection result in a noticeable speed ...

Can AJAX be used when submitting an HTML form with a select input field?

I have been working on an Ajax search suggest input and have successfully implemented it. However, I would like to tweak the script so that when a suggestion is selected, the form auto-submits. Below is my JavaScript code: <script> function suggest ...

Transferring PHP and JavaScript variables via AJAX to PHP page and storing in MySQL database table

After searching through numerous similar questions, I still haven't found the exact answer I need. I have a set of js variables that are sent via ajax to a location.php file, where they will be inserted into a mysql table. The current ajax call looks ...

Quirky PHP Chat feature you'll love

I have been developing a jQuery/PHP chat system for my website to facilitate communication among visitors. I anticipate up to 200 simultaneous users on the website, with only 10-20 users actively engaging in conversations. Here's the issue: On rare ...

What is the best method for running a MongoDB query in PHP using the CodeIgniter framework?

This is the MongoDB query I am working with: db.getCollection('fe_report').aggregate([{ $match: { date: { $gte: ISODate("2017-07-01T00:00:00.000Z"), $lte: ISODate("2017-07-19T00:00:00.000Z")} } }, { $group: ...

Android experiencing issues with dynamically loading Border XML

I am having trouble setting a border dynamically for a RelativeLayout. Oddly enough, when I manually add the border in the activity XML file, it displays perfectly. However, when I try to generate the border dynamically, it doesn't appear. border.xml ...

The functionality for inserting data via Ajax in WordPress is failing

Greetings, I am currently in the process of developing a popup plugin for WordPress that involves inserting data into a database using AJAX. Everything in my code is functioning correctly up until the jQuery section, where the data fails to insert into the ...

Performing subtraction operation on a selected floating-point value from a database using PHP

I am facing an issue with my code where I need to subtract a float value selected from the database and update the subtracted values in the database table. Below is my code snippet: $AmountGiven = $_POST['AmountGiven']; $conn = mysqli_connect("l ...

An issue with calling the fetch_() function on a member in PHP

Having issues with this code snippet: $query = "SELECT * FROM blog"; $posts = $pdo->query($query); $resultaat = $posts->rowCount(); $row = $resultaat->fetch_(PDO::FETCH_ASSOC); if($resultaat > 0){ while ($row){ echo $row['tit ...

Leveraging the power of Symfony 5 for validating a recently created entity using the validation

Currently utilizing Symfony version 5.3.7 and incorporating the @Assert annotations for validating a new user during registration. Struggling to grasp the documentation and looking to comprehend how to apply these annotations for entity validation. Tried e ...

CKEDITOR returns a NULL value when trying to insert into the database

Apologies for my poor English, I am trying to add data to a database using CKEDITOR and ajax submit, here is the code $('#add').submit(function(e) { var fd = new FormData(this); e.preventDefault(); // CKEDITOR.instances.isiForm.updateElement() ...

Finding the earliest date in a Laravel collection

I have a collection named promotions which contains several promotions, each of which has multiple exceptions: foreach ($promotions as $p) { $t = $p->exceptions() ->where('sunday','on') ->whereDate( ...