Editing records does not work

Ann

New member
I have some problems with DaDaBIK, as well on our local testing site as on the server.

We are using following versions:

MAMP
php 5.3.6
Apache/2.2.21

chrome 22.0.1229.79
firefox 15.0.1


When we put $enable_authentication=1 we are not able to login. It just returns the same login page (back/login.php?function=show_login_form). The login and password are correct as when i use a wrong login and or password, it is mentioned on the login page.

When $enable_authentication=0 everything works except editing a current record. With firefox we always get following message:
You dont't have or have lost your lock on this record, it is not safe to update, please start again the edit
I did tested several times to be sure the record was not locked before starting to use it.
The same issue is described on the forum (Problem with locking records http://www.dadabik.org/forum/read.php?1,15400)
You suggest that it is a session problem on the forum.
The strange thing is that editing the record does work with chrome but not with firefox. The authentication fails with both chrome and firefox.
I did a test on a test.php file in the same folder if sessions worked and it worked, using following code.
session_start();
$_SESSION['color'] = 'green';
echo session_id();
I got the session id and I could pass the session variable to a second page.

It's the first time we use DaDaBIK, but we have already developed multiple sites on our MAMP and did not encounter any problems with sessions.

Is there anyway you could help us out with the authentication problem and edit problem.
 

eugenio

Administrator
Staff member
Let's first check if the sessions really work correctly; open index.php and add these few lines after include ("./include/check_table.php");

if (!isset($_SESSION['test'])){
$_SESSION['test'] = 1;
}
else{
$_SESSION['test']++;
}
echo $_SESSION['test'];
exit;

Run index.php and reload it several times, if everything is working fine you should see the increment of the variable: 1, 2, 3, and so on, otherwise you'll see 1 all the time.
 

Ann

New member
I see the increment of the variable each time I reload: 1, 2 ,3, 4, 5 ... and so on.
 

Ann

New member
Please, do you have a solution for me. Since sessions work on my server, the problem must be in the programmation.
thxs
 

eugenio

Administrator
Staff member
Hi,
sorry, for some reason I missed your first reply!
About authentication: another reason usually is a wrong $site_url or $site_path, please double check them.

About editing: it is impossible that the editing is browser-dependent, all the logic about record locking is in PHP. Is there a public URL where I can see the application? If yes, please also provide a index_2.php page, which should be index.php with the session check as explained before.
 

Ann

New member
Hello,

I have found a solution, it indeed has to do something with the sessions. Apparently the session was not started.
When I add session()_start; at the top of the login page. The authentication works (also your little session test) and I can go editing records.
I offcource get a notice on the login.php at the moment that the include common_start.php wants to start the session.

This explains also the reason why it sometimes worked with one browser and not with the other one. If I opened in other tab a test.php page with session()_start;, authentication and edits do also works on the initial tab.

Could it have to do something with php settings? I noticed that session.auto_start = off
I don't know if that is a normal setting or not. I never had issues with sessions before.

thanks for your help.
 

eugenio

Administrator
Staff member
Now I am confused, you said the session test worked; it actually didn't work?

session_start is already in common_start.php and it is enough, you don't need to add it again, so I guess either you changed the code somewhere or, as I said before, you have a wrong $site_path. Please double check $site_path, it affects sessions.
 
Top