Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <meta name="generator" content=
- "HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <link rel="stylesheet" href="bootstrap.min.css">
- <script src="jquery.min.js"></script>
- <script src="bootstrap.min.js"></script>
- <?php
- require_once( '../auth.php' );
- require_once( '../config.php' );
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- if(! $conn )
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db($db);
- $sql = "select Server,From_address,Username,Password,Auth_enabled,TLS_Enabled,Enabled from MailServer where Id=1";
- $result = mysql_query( $sql, $conn );
- if(! $result )
- {
- die('1 Could not get data: ' . mysql_error());
- }
- $data = mysql_fetch_array($result, MYSQL_NUM);
- $server = $data[0];
- $from_addr = $data[1];
- $username = $data[2];
- $password = $data[3];
- $auth_en = $data[4];
- $tls_en = $data[5];
- $mail_en = $data[6];
- if(isset($_POST['save']))
- {
- $server = "";
- if(isset($_POST['server']))
- {
- $server = $_POST['server'];
- }
- $from_addr = "";
- if(isset($_POST['from_addr']))
- {
- $from_addr = $_POST['from_addr'];
- }
- $username = "";
- if(isset($_POST['username']))
- {
- $username = $_POST['username'];
- }
- $password = "";
- if(isset($_POST['password']))
- {
- $password = $_POST['password'];
- }
- $auth_en = "0";
- if(isset($_POST['auth_en']))
- {
- $auth_en = $_POST['auth_en'];
- }
- $mail_en = "0";
- if(isset($_POST['mail_en']))
- {
- $mail_en = $_POST['mail_en'];
- }
- $tls_en = "0";
- if(isset($_POST['tls_en']))
- {
- $tls_en = $_POST['tls_en'];
- }
- @ $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";
- $result = mysql_query( $sql, $conn );
- if(! $result )
- {
- die('Unable to write to database: ' . mysql_error());
- }
- else
- echo "<script type='text/javascript'>alert('Successfully Saved!');</script>";
- }
- ?>
- <style type="text/css">
- body{
- background-color: #1f2e2e;
- }
- </style>
- <html>
- <script>
- $(document).ready(function(){
- $("#myModal").modal({backdrop: 'static', keyboard: false});
- });
- </script>
- <style>
- <?php include '../style.css'; ?>
- </style>
- <style>
- th,td{
- border-bottom: none;
- color: black;
- }
- table{
- background-color: #fff;
- }
- .modal-header, h4, .close {
- /*background-color: #527a7a;*/
- background-color: #5cb85c;
- color:white !important;
- text-align: center;
- font-size: 30px;
- }
- .modal-footer {
- background-color: #f9f9f9;
- }
- #myModal{
- background-color: #222;
- }
- </style>
- <!-- Modal -->
- <div class="modal" id="myModal" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header" style="padding:35px 50px;">
- <button type="button" class="close" data-dismiss="modal" onclick='window.location="configure-mail.php?user=<?php echo $user; ?>&key=<?php echo $key; ?>"'>×</button>
- <h4><span class="glyphicon glyphicon-lock"></span> Add details</h4>
- </div>
- <div class="modal-body" style="padding:40px 50px;">
- <form id="form" name="form" method="post" action="">
- <table cellspacing=1 cellpadding=2 style="font-family: sans-serif;font-size: 13px;">
- <tr>
- <td><label>Server:</label></td>
- <td><input style="color: black;" type="text" name="server" id="server" value="<?php echo $server ?>" ></td>
- </tr>
- <tr>
- <td><label>From Address:</label></td>
- <td><input style="color: black;" type="text" name="from_addr" id="from_addr" value="<?php echo $from_addr ?>"></td>
- </tr>
- <tr>
- <td><label>Authentication Enabled:</label></td>
- <td>
- <input type="checkbox" name="auth_en" <?php echo ($auth_en == "1") ? 'checked="checked"': '' ?> value="1">
- </td>
- </tr>
- <tr>
- <td><label>Username:</label></td>
- <td><input style="color: black;" type="text" name="username" id="username" value="<?php echo $username ?>"></td>
- </tr>
- <tr>
- <td><label>Password:</label></td>
- <td><input style="color: black;" type="password" name="password" id="password" value="<?php echo $password ?>"></td>
- </tr>
- <tr>
- <td><label>TLS Enabled:</label></td>
- <td><input type="checkbox" name="tls_en" <?php echo ($tls_en == "1") ? 'checked="checked"': '' ?> value="1">
- </td>
- </tr>
- <tr>
- <td><label>Mail Enabled:</label></td>
- <td>
- <input type="checkbox" name="mail_en" <?php echo ($mail_en == "1") ? 'checked="checked"': '' ?> value="1">
- </td>
- </tr>
- </table>
- <br><input class="btn btn-primary" type="submit" name="save" id="save" value="Save" /></br>
- </form>
- </div>
- </div>
- </div>
- </div>
- </html>
- <script type="text/javascript">
- $("input[name='auth_en']").click(function(){
- $('#username').prop('disabled', function(i, v) { return !v; });
- $('#password').prop('disabled', function(i, v) { return !v; });
- })
- </script>
Add Comment
Please, Sign In to add comment