Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function setting_email_smtp() {
- $host = $_POST["host"];
- $port = $_POST["port"];
- $username = $_POST["username"];
- $password = $_POST["password"];
- $send_from = $_POST["send_from"];
- $notice = $_POST["notice"];
- //insert
- if (isset($_POST['insert'])) {
- global $wpdb;
- $table_name = $wpdb->prefix . "dathangnhanh_email";
- $wpdb->insert(
- $table_name, //table
- array('host' => $host, 'port' => $port, 'username' => $username,
- 'password' => $password, 'send_from' => $send_from, 'notice' => $notice), //data
- array('%s', '%s') //data format
- );
- }
- else {// value to update selecting
- $donhang = $wpdb->get_results($wpdb->prepare("SELECT host,port,username,password,send_from,notice from $table_name where id=%s", $id));
- foreach ($donhang as $s) {
- $host = $s->host;
- $port = $s->port;
- $username = $s->username;
- $password = $s->password;
- $send_from = $s->send_from;
- $notice = $s->notice;
- }
- }
- ?>
- <div>
- <h2>Setup Email</h2>
- <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
- <table>
- <tr>
- <th>SMTP Host</th>
- <td><input type="text" name="host" value="<?php echo $host; ?>" placeholder="smtp.gmail.com" /></td>
- </tr>
- <tr>
- <th>SMTP Port</th>
- <td><input type="text" name="port" value="<?php echo $port; ?>" placeholder="465" /></td>
- </tr>
- <tr>
- <th>SMTP User</th>
- <td><input type="text" name="username" value="<?php echo $username; ?>" placeholder="email@gmail.com" /></td>
- </tr>
- <tr>
- <th>SMTP Password</th>
- <td><input type="password" name="password" value="<?php echo $password; ?>" placeholder="Your password" /></td>
- </tr>
- <tr>
- <th>SMTP Send From</th>
- <td><input type="text" name="send_from" value="<?php echo $send_from; ?>" placeholder="admin@gmail.com" /></td>
- </tr>
- <tr>
- <th>Notice Email</th>
- <td><input type="text" name="notice" value="<?php echo $notice; ?>" placeholder="youremail@gmail.com" /></td>
- </tr>
- </table>
- <input type='submit' name="insert" value='Save' class='button'>
- </form>
- </div>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement