Changing system date, page hanging revisited

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nemesis
Forum Newbie
Posts: 12
Joined: Tue Feb 08, 2005 10:43 am

Changing system date, page hanging revisited

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Nemesis
Forum Newbie
Posts: 12
Joined: Tue Feb 08, 2005 10:43 am

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
Nemesis
Forum Newbie
Posts: 12
Joined: Tue Feb 08, 2005 10:43 am

Post 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?
Post Reply