To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
Code CritiqueHaving someone critique your code is always a great way to hone the skills. Stop in and post your code to see what your peers may have done differently.
i had a few people ask me how can they get the uptime on windows to display it on a webpage like i do on my site on linux.
after doing some research i found its almost impossible unless you:
1) get some exe file from microsoft and execute it to get the uptime.
2) use the operating system pagefile that resets the time everytime the os is rebooted.
so after i found the location of the pagefile i came up with this script:
PHP Code:
<?php
$pagefile = 'c:\pagefile.sys'; // Path to system pagefile. Default is c:\\pagefile.sys
function ifif ($value, $true, $false)
{
if ($value == 0)
{
return $false;
}
else
{
return $true;
}
}
its only been tested on windows 2000, and windows xp. It works on php 4.x.x, although i don't see why it shouldn't work on php 3.x
if you run a windows webserver, win95,98 i would like to know if it works on it. the system pagefile could possible be located elsewhere on these operating systems.
pagefile.sys is an invisible file, so you would have to search for it using the operating system search tool.
just change c:\ to the letter of your operating system.
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,124
I found a wee Windows port of the Unix uptime program. Sorry, no link; but there are packages floating around out there with quite a few useful little utilities in them (like uptime, whois, gzip, make, uniq, grep and suchlike).
PHP Code:
<?php
echo `c:\\unix\\uptime`;
?>
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
disabling the page file makes sense from a securiy point of view.
Example: The user enters data. You encrypt this data. If that data is only stored in ram the user can easily overwrite the nonencrypted data with the encrypted data and remove all traces of the data from ram this way. However if you're using virtual memory then the data could have been written to the disk and the programmer has no control over when that gets changed.
Hi am I new here but thanks I found this very very helpfull I found it searching google. I have to say I run a server from my house on windows and wanted something like phpsysinfo for my server. And this didn't work at first lol. Because I made a partion only for my paging file on my 200 gig storage drive and had none on c thought it would speed it up since it wasn't loading from c when all the other things were seems it did. But when I first ran the script it say my pc had been up for like 123 days plus or something since like 1942 lol. I don't know how it got that but I added paging file to c and it worked thanks. If my paging file is on say K can I change it to that?