xunpan-set.php
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
require_once('./admin.php');
if ( ! current_user_can( 'manage_options' ) )
wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
$title = __('General Settings');
$parent_file = 'options-general.php';
/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
/**
* Display JavaScript on the page.
*
* @since 3.5.0
*/
function options_general_add_js() {
?><?php
}
add_action('admin_head', 'options_general_add_js');
include('./admin-header.php');
?>
<body class="wp-admin wp-core-ui no-js profile-php auto-fold admin-bar branch-3-6 version-3-6-1 admin-color-fresh locale-zh-cn no-customize-support" >
<script type="text/javascript">
document.body.className = document.body.className.replace('no-js','js');
</script>
<script type="text/javascript">
(function() {
var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
request = true;
b[c] = b[c].replace( rcs, ' ' );
b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
}());
</script>
<?php
$email_info = get_post_meta(19,'_mail');
$email = $email_info[0]['recipient'];
//print_r($email_info);exit;
$phone = get_option('sms_phone_num',true);
if(isset($_POST)){
if(preg_match('/^[a-z0-9]+([._-][a-z0-9]+)*@([0-9a-z]+\.[a-z]{2,14}(\.[a-z]{2})?)$/i',$_POST['email'])){
$tmp_email = $_POST['email'];
if($email != $tmp_email){
$ttt = $email_info[0];
$ttt['recipient'] = $tmp_email;
//print_r($ttt);exit;
update_post_meta(19,'_mail',$ttt);
echo '邮箱修改成功<br>';
$email_info = get_post_meta(19,'_mail');
$email = $email_info[0]['recipient'];
}
}
if(preg_match("/^1[34578]{1}\d{9}$/",$_POST['phone'])){
$tmp_phone = $_POST['phone'];
if(!$phone){
add_option('sms_phone_num','15208206317');
}
$phone = get_option('sms_phone_num',true);
if($tmp_phone != $phone){
update_option('sms_phone_num',$tmp_phone);
echo '电话修改成功';
$phone = get_option('sms_phone_num',true);
}
}
}
?>
<div id="wpbody" style="text-align:left;padding-left: 20px;margin:-40px 0 0 0;">
<div id="wpbody-content" aria-label="Main content" tabindex="0">
<div aria-label="Main content" tabindex="0">
<div class="wrap" id="profile-page" style="background:#fff;margin:50px -20px 0px -20px;padding:20px;height:360px;">
<form id="your-profile" action="" method="post">
<table class="form-table">
<tr>
<th><label for="pass1">接收信息邮箱</label></th>
<td>
<input type="text" name="email" id="email" size="16" value="<?php echo $email;?>" autocomplete="off" />
</td>
</tr>
<tr>
<th scope="row"><label for="pass2">接收信息手机</label></th>
<td>
<input type="text" name="phone" id="phone" size="16" maxlength="11" value="<?php echo $phone;?>" autocomplete="off" />
<br />
</td>
</tr>
<tr>
<th colspan="2">用于接收信息的电子邮箱和手机号,如新询盘通知、排名情况、数据报表等</th>
</tr>
</table>
<p class="submit">
<input type="submit" name="submit" id="submit" class="button button-primary" value="保存设置" />
</p>
</form>
</div>