Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Defcon
Regular
Regular



Joined: Mar 10, 2005
Posts: 90

PostPosted: Tue Jan 30, 2007 4:40 am Reply with quote

Hye All! I need a help for my PHP programming. Let say a PHP code like this:


<?php
system("uptime");
?>


So it will display a web server uptime on your browser. However it need to use in "echo" command. For example like this:


<?php
echo "uptime";
?>


Can someone help me? Thanxs
 
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Tue Jan 30, 2007 5:24 am Reply with quote

If you just want to echo something.....

Code:


echo "what I want to echo goes here";


If you want sytem uptime try this....
Code:


<?php
echo "system uptime: ";
$uptime = exec("uptime");
$a = strstr($uptime,"up");
$a = substr($a,2);
$a = strrev($a);
$a = strstr($a,"sresu");
$a = strstr($a,",");
$a = substr($a,1);
$a = strrev($a);
echo $a;

?>
[ Only registered users can see links on this board! Get registered or login! ]

Dawg
 
View user's profile Send private message
Defcon







PostPosted: Tue Jan 30, 2007 5:34 am Reply with quote

Thanxs Dawg for your reply, i'm really appreciate it. Beside server uptime i also would like to know how to recall a PHP script via echo command. Is that this can be done such as with this code?


<?php
$test = '<php script here>';
echo $test;
?>


Situation on my web page is, i cant use command "include" to recall that script because i have to give a output on "echo" command.
 
Dawg







PostPosted: Tue Jan 30, 2007 5:39 am Reply with quote

So why not echo it out in your script.

You just want to display the results of the srcipt is that correct?

Post your script and I will "Try" to help.....

Use the code button in the post window to post code....

Dawg
 
Dawg







PostPosted: Tue Jan 30, 2007 5:42 am Reply with quote

Is this what you are trying to so?



Code:
<table width="100%">

  <tr>
    <td><div align="center">
   <?php
echo "system uptime: ";
$uptime = exec("uptime");
$a = strstr($uptime,"up");
$a = substr($a,2);
$a = strrev($a);
$a = strstr($a,"sresu");
$a = strstr($a,",");
$a = substr($a,1);
$a = strrev($a);
echo $a;

?>
</div></td>
  </tr>
</table>
 
Defcon







PostPosted: Tue Jan 30, 2007 6:02 am Reply with quote

HUhuhuhu

You have been blocked from entering this text and/or this site.

You may have attempted a Scripting attack on this site or tried to use some HTML tags that are not allowed, due to the danger that they posess.


Wait i solve my posting text/script first
 
Defcon







PostPosted: Tue Jan 30, 2007 6:03 am Reply with quote

Thanxs Dawg for your reply again,

Here a full of script that i want to put:

Code:


<!---
Advanced server information
Get advanced information about disk usage, memory, cpu, and uptime. -->
<pre>
<b>Uptime:</b>
<?php system("uptime"); ?>

<b>System Information:</b>
<?php system("uname -a"); ?>

<b>Memory Usage (MB):</b>
<?php system("free -m"); ?>

<b>Disk Usage:</b>
<?php system("df -h"); ?>

<b>CPU Information:</b>
<?php system("cat /proc/cpuinfo | grep \"model name\\|processor\""); ?>
</pre>


So from that previous code i want to put on echo "<php script/code output here>"; .

Other more thing, is that we can create an output such as like this let say a PHP script name is abc1234.php . So with echo i want to display it that script. Sound like if with HTML look alike "iframe" code or maybe "include" .. HUhuhuhu
 
Dawg







PostPosted: Tue Jan 30, 2007 3:13 pm Reply with quote

You do not have to call it....per say....you are already calling it with what you posted above.

Build your html how ever you like then were ever you want the uptime to dsplay....drop in the php code for uptime.

Also there are a TON of scripts for this sort of thing. Why reinvent the wheel? Just look around Hotscripts....
 
Defcon







PostPosted: Wed Jan 31, 2007 3:38 am Reply with quote

Heeheehehe... i already got my answer. Let say original PHP code is like this:

<?php system("uptime"); ?>

But i want to give output on "echo" so what we have to do is:


<?php
$uptime = exec("uptime");

echo "$uptime";
?>


However thanxs Dawg for your feedback
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©