הרשם שאלות ותשובות רשימת חברים לוח שנה חיפוש הודעות מהיום סמן פורומים כנקראו

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 07-02-06, 21:42   # 11
Alon.R
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 2,435

Alon.R לא מחובר  

ציטוט:
נכתב במקור על ידי Israel-Serv.Net
יש איזה סקריפט שעובד בצורה אחרת ויכול להראות את הUPTIME בלי השימוש בפונקציה הזאת..
רק אני לא זוכר את השם שלו....
אם מישהו מכיר במקרה שיביא לו...

עריכה : אחלה ראיתי שמצאת
כן למי שמעוניין הינה הסקריפט:
PHP קוד:
<?php 
// format the uptime in case the browser doesn't support dhtml/javascript
// static uptime string
function format_uptime($seconds) {
  
$secs intval($seconds 60);
  
$mins intval($seconds 60 60);
  
$hours intval($seconds 3600 24);
  
$days intval($seconds 86400);
  
  if (
$days 0) {
    
$uptimeString .= $days;
    
$uptimeString .= (($days == 1) ? " יום" " ימים");
  }
  if (
$hours 0) {
    
$uptimeString .= (($days 0) ? ", " "") . $hours;
    
$uptimeString .= (($hours == 1) ? " שעה" " שעות");
  }
  if (
$mins 0) {
    
$uptimeString .= (($days || $hours 0) ? ", " "") . $mins;
    
$uptimeString .= (($mins == 1) ? " דקה" " דקות");
  }
  if (
$secs 0) {
    
$uptimeString .= (($days || $hours || $mins 0) ? ", " "") . $secs;
    
$uptimeString .= (($secs == 1) ? " שניה" " שניות");
  }
  return 
$uptimeString;
}

// read in the uptime (using exec)
$uptime exec("cat /proc/uptime");
$uptime split(" ",$uptime);
$uptimeSecs $uptime[0];

// get the static uptime
$staticUptime "השרת באוויר רצוף כבר: ".format_uptime($uptimeSecs);
?>
<script language="javascript">
<!--
var upSeconds=<?php echo $uptimeSecs?>;
function doUptime() {
var uptimeString = "השרת באוויר רצוף כבר: ";
var secs = parseInt(upSeconds % 60);
var mins = parseInt(upSeconds / 60 % 60);
var hours = parseInt(upSeconds / 3600 % 24);
var days = parseInt(upSeconds / 86400);
if (days > 0) {
  uptimeString += days;
  uptimeString += ((days == 1) ? " יום" : " ימים");
}
if (hours > 0) {
  uptimeString += ((days > 0) ? ", " : "") + hours;
  uptimeString += ((hours == 1) ? " שעה" : " שעות");
}
if (mins > 0) {
  uptimeString += ((days > 0 || hours > 0) ? ", " : "") + mins;
  uptimeString += ((mins == 1) ? " דקה" : " דקות");
}
if (secs > 0) {
  uptimeString += ((days > 0 || hours > 0 || mins > 0) ? ", " : "") + secs;
  uptimeString += ((secs == 1) ? " שניה" : " שניות");
}
var span_el = document.getElementById("uptime");
var replaceWith = document.createTextNode(uptimeString);
span_el.replaceChild(replaceWith, span_el.childNodes[0]);
upSeconds++;
setTimeout("doUptime()",1000);
}
// -->
</script>
ולהוסיף את הקוד הבא לאיפה שאתם רוצים שיהיה הפלט של הUPTIME:
HTML קוד:
<div id="uptime" class="btext"><?php echo $staticUptime; ?></div>
ועוד משהו קטן, להכניס לתוך תגית ה<body> את הגדרה הבאה:
HTML קוד:
onLoad="doUptime();"
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 

כלים לאשכול
תצורת הצגה

חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 07:43.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ