Hi all, this is just a quick question with regards to php session data. . .

I have a php built website and I am trying to develop a mobile html / php website to connect to the desktop website.

I can enter my username / password / and secure code, but when ever I try and load the members area it seems the session data is being lost, and the session fails. So I am unable to login through my phone.

I have check, double checked and triple checked the session data variables and they are correct.

Can anyone help, or point me in the right direction

Cheers

Create a php page to display cookies and session values and then open it with iphone and a desktop. This will help you to understand what is not working. Also check error and access log files in apache.

Hi, many thanks for replying, Its strange as I can login to the website from the desktop m.website.com. . .

but when ever I try to login from my mobile, It's like it doesnt understand the session data. . .

Hi, could you show me how to start with creating cookies and integrating / reading from them into php. . .

I have three session variables ? Do i need to create a cookie for each variable I want to read from ?

How would I read the cookie variable ?

Here's what you can try:

<?php session_start(); ?>
<h3>Cookies</h3>
<pre>
<?php
print_r($_COOKIE);
?>
</pre>
<h3>Session</h3>
<pre>
<?php
print_r($_SESSION);
?>
</pre>

After your login go to this page and check if you get same variables or if something is missing, do this test with the iphone and desktop. I mentioned cookies because I didn't know if you used them or not. I can't help more than this without the code.

Hi, thanks, Iw ill give this a go. I have never used cookies, only session data, im new to php and web design.

When a user enters username and password, it reads from the databse correctly and then sends securecode.php?id=$id (this is also working) as I get the correct id number.

Its just when I enter the securecode, if the code is correct, it will then take the user to the members area, where is reads from the session data and brings back user details from mysql.

The above is working great on the desktop.

Here is the responce from the file u said to upload from the desktop m.website.co.uk

Still unable to login through mobile tho ?

Cookies

    Array
(
    [__utma] => 67449875.1691414763.1322683205.1331604699.1331644165.360
    [__utmz] => 67449875.1331644165.360.38.utmcsr=m.website.co.uk|utmccn=(referral)|utmcmd=referral|utmcct=/directory/
    [__utmc] => 67449875
    [PHPSESSID] => 4dgt5bar5eg1h0np1aeebuhgg3
    [__utmb] => 104626524.3.10.1331649966
)
    

Session

    Array
(
    [SESS_MEMBER_ID] => 81
    [SESS_SECURE_CODE] => a15807d6cc5bd083512906f76b5ca744b25ef5b2
    [SESS_CREFF] => 59632273
)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.