Page 1 of 1

Changing system date, page hanging revisited

Posted: Mon Feb 14, 2005 9:46 am
by Nemesis
hey, after hours and hours of looking into this:

viewtopic.php?t=30438

I have still no solution, however, a better understanding of the problem:

I can no longer assume that the page hangs only when I set the date back, as the user is logged out automatically when setting the date forward (the session expires).

I have reproduced the problem in other situations (not setting the date at all).
So, the problem is now that when I change the date with this page, the success page loads and renders correctly now. However, after loading the page, the browser does not stop loading....it loads indefinately.

This problem is not related to one browser, and is reproductible in IE, mozilla, netscape.

Here is my current code:

Code: Select all

<?
if(file_exists("mtsiLib2.inc") && file_exists("mtsi_top.php3") && file_exists("style.inc"))
&#123;
	include("mtsiLib2.inc"); 

	if(@mtsiConnect() == 0) 
		exit("mtsiConnect() failed.");

	$date = $month.$day.$hour.$min.$year.".".$sec;
	$date = trim($date);

	mtsiExecuteCommand("date $date",$linearray);
	sleep(1);

	mtsiExecuteCommand("hwclock --systohc &",$linearray2);
	sleep(2);

	$msg = "Date and Time changed successfully";
	$msg = str_replace(" ",":",$msg);
	@mtsiDisconnect();

        //this is instead of redirecting....
        include ("date.php3");
&#125;
else
&#123;
	$pages = "mtsiLib2.inc|mtsi_top.inc|style.inc";
	include("error.php3");
&#125;
?>
I tried everything, exit()s, return()s, Im all out of ideas. Can anyone help?

Nemesis.

Posted: Mon Feb 14, 2005 10:10 am
by feyd
this seems like a dangerous utility to have available via a browser. What's the purpose of doing so? I don't quite understand the purpose of setting the date on the machine's hardware..

Posted: Mon Feb 14, 2005 10:20 am
by Nemesis
It's kinda like a web-configuration utility for your router....only on a larger scale industrial signaling equipement. This is just a customer requirement, and works nicely....just having problems with the page.....it's really weird, Ive never had this kind of problem before.

Posted: Mon Feb 14, 2005 11:49 am
by timvw
still wondering:
how does the mtsiExecuteCommand function look like?

my guess is that you put the process to the background (&) and that php process control doesn't return untill all processes are finished.

Posted: Mon Feb 14, 2005 12:33 pm
by Nemesis
The mtsiExecutCommand function writes the specified command to the system, it's my own PHP exec() function since the exec() function causes issues with our hardware and operating system.
It also reads all output generated, and returns this in linearay.

As far as I know, the command hwclock does not start a process....and consistently takes less then a second to run.

Just to be sure though, I ran the command through an application that I wrote for this specific purpose a while ago, when I had to deal with the problem you described (the symptom then was that the back end software would no longer accept connections from the Web UI).

This application is seperate from the webUI and takes care of running all commands passed to it, without interrupting any Web UI activity.

This didnt work, but thanks for trying. Can you think of anything else?