homepage.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. if (isset($_POST['confirm']) && !empty($_POST['msgid'])) {
  3. $error = $cnfrmSuccess = '';
  4. $pollCnfrm = $SWITCHEPP->WgsSwitchEppAckConfirm($_POST['msgid']);
  5. if ($pollCnfrm['status'] == 'error')
  6. $error = $pollCnfrm['msg'];
  7. elseif ($pollCnfrm['status'] == 'success')
  8. $cnfrmSuccess = $pollCnfrm['msg'];
  9. } elseif (isset($_POST['confirm']) && empty($_POST['msgid']))
  10. $error = 'msgId is missing!';
  11. if (isset($_POST['getpoll']) && !empty($_POST['getpoll'])) {
  12. $error = $success = '';
  13. $pollList = $SWITCHEPP->WgsSwitchEppGetPoll();
  14. if ($pollList['status'] == 'error')
  15. $error = $pollList['msg'];
  16. elseif ($pollList['status'] == 'success')
  17. $success = $pollList['msg'];
  18. if (!empty($success)) {
  19. $pollArr = simplexml_load_string($pollList['resp']);
  20. $msgid = $pollList['msgid'];
  21. $domainName = $pollArr->response->resData->children("domain", true)->trnData->name;
  22. $status = $pollArr->response->resData->children("domain", true)->trnData->trStatus;
  23. $reDate = substr($pollArr->response->resData->children("domain", true)->trnData->reDate, 0, 10);
  24. $pollMsg = $pollArr->response->msgQ->msg;
  25. }
  26. }
  27. ?>
  28. <style>
  29. .poll_cont {
  30. text-align: center;
  31. }
  32. .poll_cont input[type="submit"] {
  33. background: green;
  34. border: 1px solid green;
  35. color: #fff;
  36. padding: 8px 20px;
  37. }
  38. .pollsuccess {
  39. background: #cbf39f;
  40. margin: 10px;
  41. padding: 10px;
  42. color: #406f0b;
  43. }
  44. .pollerror {
  45. background: #f5d2d2;
  46. margin: 10px;
  47. padding: 10px;
  48. color: #bb1313;
  49. }
  50. </style>
  51. <div class="poll_cont">
  52. <form method="post" action="">
  53. <input type="submit" name="getpoll" value="Get Poll">
  54. </form>
  55. <?php
  56. if (!empty($error))
  57. echo '<div class="pollerror">' . $error . '</div>';
  58. elseif (!empty($cnfrmSuccess))
  59. echo '<div class="pollsuccess">' . $cnfrmSuccess . '</div>';
  60. elseif (!empty($success)) {
  61. echo '<div class="pollsuccess">' . $success . '</div>';
  62. ?>
  63. <form action="" method="post">
  64. <input type="hidden" name="msgid" value="<?php echo $msgid ?>">
  65. <table class="datatable" style="width: 100%;">
  66. <thead>
  67. <th>Domain Name</th>
  68. <th>Status</th>
  69. <th>Msg</th>
  70. <th>Reg. Date</th>
  71. <th>Action</th>
  72. </thead>
  73. <tbody>
  74. <?php if (!empty($msgid)) { ?>
  75. <td><?php echo $domainName; ?></td>
  76. <td><?php echo $status; ?></td>
  77. <td><?php echo $pollMsg; ?></td>
  78. <td><?php echo $reDate; ?></td>
  79. <td><input type="submit" name="confirm" value="Confirm"></td>
  80. <?php } else { ?>
  81. <td colspan="100%">No messages</td>
  82. <?php } ?>
  83. </tbody>
  84. </table>
  85. </form>
  86. <?php } ?>
  87. </div>