Advertisement
METAJIJI

Untitled

Apr 6th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <title>Search Domian</title>
  5. </head>
  6. <body>
  7.  
  8. <?php
  9. // define('APP', dirname(__DIR__));
  10. // require_once APP . '/PleskApiClient.php';
  11. require_once('PleskApiClient.php');
  12.  
  13. $HTML = array();
  14.  
  15. // Config.
  16. $cfg = array(
  17. 'login' => 'admin',
  18. 'password' => 'admin',
  19. 'domain' => isset($_GET['domain']) ? $_GET['domain'] : '',
  20. 'servers' => array(
  21. '213.145.129.2', // server one
  22. '213.145.129.3', // server two
  23. '213.145.129.4',
  24. '213.145.129.5')
  25. );
  26.  
  27. function request($cfg, $host) {
  28. $client = new PleskApiClient($host);
  29. $client->setCredentials($cfg['login'], $cfg['password']);
  30.  
  31. // $request = file_get_contents("_request.xml");
  32.  
  33. $request = <<<EOF
  34. <packet version="1.6.3.0">
  35. <site>
  36. <get>
  37. <filter>
  38. <name>$domain</name>
  39. </filter>
  40. <dataset>
  41. <gen_info/>
  42. </dataset>
  43. </get>
  44. </site>
  45. </packet>
  46. EOF;
  47.  
  48. $response = $client->request($request);
  49. $stats = new SimpleXMLElement($response);
  50.  
  51. return $stats->site->get->result->status;
  52. }
  53.  
  54. if (!empty($cfg['domain'])) {
  55. $HTML['STATUS'] = '';
  56. foreach ($cfg['servers'] as $host) {
  57. $status = request($cfg, $host);
  58. if ($status == 'ok') {
  59. $HTML['STATUS'] .= 'Сайт ' . $cfg['domain'] . ' найден на ' . $host . "<br />\n";
  60. } else {
  61. $HTML['STATUS'] .= 'Сайт ' . $cfg['domain'] . ' не найден на ' . $host . "<br />\n";
  62. }
  63. }
  64. }
  65. ?>
  66.  
  67. <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="GET">
  68. <input type="text" name="domain" placeholder="Введите домен" />
  69. <input type="submit" value="Найти" />
  70. </form>
  71. <br />
  72. <div class="vixlop"><?php if (isset($HTML['STATUS'])) echo $HTML['STATUS']; ?></div>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement