Guest User

Untitled

a guest
May 9th, 2016
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <meta name="generator" content=
  3. "HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  5.  
  6. <link rel="stylesheet" href="bootstrap.min.css">
  7. <script src="jquery.min.js"></script>
  8. <script src="bootstrap.min.js"></script>
  9.  
  10.  
  11. <?php
  12. require_once( '../auth.php' );
  13. require_once( '../config.php' );
  14.  
  15. $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  16. if(! $conn )
  17. {
  18. die('Could not connect: ' . mysql_error());
  19. }
  20.  
  21. mysql_select_db($db);
  22.  
  23. $sql = "select Server,From_address,Username,Password,Auth_enabled,TLS_Enabled,Enabled from MailServer where Id=1";
  24.  
  25. $result = mysql_query( $sql, $conn );
  26. if(! $result )
  27. {
  28. die('1 Could not get data: ' . mysql_error());
  29. }
  30.  
  31. $data = mysql_fetch_array($result, MYSQL_NUM);
  32. $server = $data[0];
  33. $from_addr = $data[1];
  34. $username = $data[2];
  35. $password = $data[3];
  36. $auth_en = $data[4];
  37. $tls_en = $data[5];
  38. $mail_en = $data[6];
  39.  
  40. if(isset($_POST['save']))
  41. {
  42. $server = "";
  43. if(isset($_POST['server']))
  44. {
  45. $server = $_POST['server'];
  46. }
  47. $from_addr = "";
  48. if(isset($_POST['from_addr']))
  49. {
  50. $from_addr = $_POST['from_addr'];
  51. }
  52. $username = "";
  53. if(isset($_POST['username']))
  54. {
  55. $username = $_POST['username'];
  56. }
  57. $password = "";
  58. if(isset($_POST['password']))
  59. {
  60. $password = $_POST['password'];
  61. }
  62. $auth_en = "0";
  63. if(isset($_POST['auth_en']))
  64. {
  65. $auth_en = $_POST['auth_en'];
  66. }
  67. $mail_en = "0";
  68. if(isset($_POST['mail_en']))
  69. {
  70. $mail_en = $_POST['mail_en'];
  71. }
  72. $tls_en = "0";
  73. if(isset($_POST['tls_en']))
  74. {
  75. $tls_en = $_POST['tls_en'];
  76. }
  77.  
  78. @ $sql = "update MailServer set Server='$server',From_address='$from_addr',Username='$username',Password='$password',Auth_enabled=$auth_en,TLS_Enabled=$tls_en,Enabled=$mail_en where Id=1";
  79. $result = mysql_query( $sql, $conn );
  80. if(! $result )
  81. {
  82. die('Unable to write to database: ' . mysql_error());
  83. }
  84. else
  85. echo "<script type='text/javascript'>alert('Successfully Saved!');</script>";
  86. }
  87.  
  88. ?>
  89. <style type="text/css">
  90. body{
  91. background-color: #1f2e2e;
  92. }
  93. </style>
  94.  
  95. <html>
  96.  
  97.  
  98.  
  99.  
  100. <script>
  101. $(document).ready(function(){
  102.  
  103. $("#myModal").modal({backdrop: 'static', keyboard: false});
  104. });
  105. </script>
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113. <style>
  114. <?php include '../style.css'; ?>
  115. </style>
  116.  
  117. <style>
  118. th,td{
  119. border-bottom: none;
  120. color: black;
  121. }
  122. table{
  123. background-color: #fff;
  124. }
  125.  
  126. .modal-header, h4, .close {
  127. /*background-color: #527a7a;*/
  128. background-color: #5cb85c;
  129. color:white !important;
  130. text-align: center;
  131. font-size: 30px;
  132. }
  133. .modal-footer {
  134. background-color: #f9f9f9;
  135. }
  136. #myModal{
  137. background-color: #222;
  138. }
  139. </style>
  140. <!-- Modal -->
  141. <div class="modal" id="myModal" role="dialog">
  142. <div class="modal-dialog">
  143.  
  144. <!-- Modal content-->
  145. <div class="modal-content">
  146. <div class="modal-header" style="padding:35px 50px;">
  147. <button type="button" class="close" data-dismiss="modal" onclick='window.location="configure-mail.php?user=<?php echo $user; ?>&key=<?php echo $key; ?>"'>&times;</button>
  148. <h4><span class="glyphicon glyphicon-lock"></span> Add details</h4>
  149. </div>
  150. <div class="modal-body" style="padding:40px 50px;">
  151.  
  152.  
  153.  
  154. <form id="form" name="form" method="post" action="">
  155. <table cellspacing=1 cellpadding=2 style="font-family: sans-serif;font-size: 13px;">
  156. <tr>
  157. <td><label>Server:</label></td>
  158. <td><input style="color: black;" type="text" name="server" id="server" value="<?php echo $server ?>" ></td>
  159. </tr>
  160. <tr>
  161. <td><label>From Address:</label></td>
  162. <td><input style="color: black;" type="text" name="from_addr" id="from_addr" value="<?php echo $from_addr ?>"></td>
  163.  
  164. </tr>
  165. <tr>
  166. <td><label>Authentication Enabled:</label></td>
  167. <td>
  168. <input type="checkbox" name="auth_en" <?php echo ($auth_en == "1") ? 'checked="checked"': '' ?> value="1">
  169.  
  170. </td>
  171. </tr>
  172. <tr>
  173. <td><label>Username:</label></td>
  174. <td><input style="color: black;" type="text" name="username" id="username" value="<?php echo $username ?>"></td>
  175. </tr>
  176. <tr>
  177.  
  178. <td><label>Password:</label></td>
  179. <td><input style="color: black;" type="password" name="password" id="password" value="<?php echo $password ?>"></td>
  180. </tr>
  181. <tr>
  182. <td><label>TLS Enabled:</label></td>
  183.  
  184. <td><input type="checkbox" name="tls_en" <?php echo ($tls_en == "1") ? 'checked="checked"': '' ?> value="1">
  185. </td>
  186. </tr>
  187. <tr>
  188. <td><label>Mail Enabled:</label></td>
  189. <td>
  190. <input type="checkbox" name="mail_en" <?php echo ($mail_en == "1") ? 'checked="checked"': '' ?> value="1">
  191. </td>
  192. </tr>
  193. </table>
  194. <br><input class="btn btn-primary" type="submit" name="save" id="save" value="Save" /></br>
  195. </form>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. </html>
  201. <script type="text/javascript">
  202. $("input[name='auth_en']").click(function(){
  203. $('#username').prop('disabled', function(i, v) { return !v; });
  204. $('#password').prop('disabled', function(i, v) { return !v; });
  205.  
  206. })
  207. </script>
Add Comment
Please, Sign In to add comment