Advertisement
Guest User

Untitled

a guest
Apr 6th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. $password = "AjCj196312249694";
  3. $servername = "localhost";
  4. $username = "root";
  5. // Create connection
  6. $conn = new mysqli($servername, $username, $password);
  7. // Check connection
  8. if ($conn->connect_error) {
  9. die("Connection failed: " . $conn->connect_error);
  10. }
  11. echo "Connected successfully <br>";
  12. $db = "use eco";
  13. if (mysqli_query($conn, $db)) {
  14. echo "Connected to Database <br>";
  15. } else {
  16. echo "Error Connecting to database: " . mysqli_error($conn);
  17. }
  18.  
  19.  
  20.  
  21. $sql = "SELECT * FROM servers";
  22. $result = $conn->query($sql);
  23. if ($result->num_rows > 0) {
  24. //Create an Array for the Data
  25. while($row = $result->fetch_assoc()) {
  26. $pid = $row["pid"];
  27. $output = shell_exec("ps -o etime= -p '".$pid."'");
  28. echo $output;
  29. }
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement