Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. $mysql_host = "";
  3. $mysql_database = "";
  4. $mysql_user = "";
  5. $mysql_password = "";
  6.  
  7. $con = mysql_connect($mysql_host, $mysql_user, $mysql_password);
  8. if (!$con)
  9. {
  10. die('Could not connect to the database: ' . mysql_error());
  11. }
  12.  
  13. mysql_select_db($mysql_database, $con);
  14.  
  15. foreach($_POST as $key => $value)
  16. {
  17. $pieces = explode("_", $value);
  18.  
  19. $id = $pieces[0];
  20. $name = $pieces[1];
  21. $cur = $pieces[2];
  22. $max = $pieces[3];
  23. $state = $pieces[4];
  24.  
  25. $sql = "UPDATE serverstats SET name=\"$name\", cur=$cur, max=$max, state=$state WHERE id=$id";
  26. mysql_query($sql) or die('Could not query the database: ' . mysql_error());
  27. }
  28.  
  29. mysql_close($con);
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement