-
Notifications
You must be signed in to change notification settings - Fork 1
/
artist_emails.php
70 lines (64 loc) · 1.53 KB
/
artist_emails.php
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
<?php
if(isset($_POST['ae_pwd']))
{
session_start();
if(isset($_SESSION['ae_pwd_tries']) && $_SESSION['ae_pwd_tries'] > 3)
{
echo '<html>
<body>
</body>
<pre>
You tried to access this page with a wrong password more than 3 times.
Please contact '.get_bloginfo('admin_email').' if you think you should be granted to access this page.
</pre>
</html>
';
return;
}
if($_POST['ae_pwd'] === $post->post_password)
{
header('Content-Type:text/plain; charset=UTF-8');
global $wpdb;
$query = "
SELECT * FROM ".$wpdb->posts." AS p
INNER JOIN ".$wpdb->postmeta." AS m
ON p.ID = m.post_id
WHERE (p.post_type = 'soe_artist' AND m.meta_key = 'artist_email')
ORDER BY p.post_date DESC;
";
$artists = $wpdb->get_results($query, OBJECT);
foreach($artists as $artist)
{
echo $artist->post_title. ' <'.$artist->meta_value . ">\n";
}
}
else
{
if(isset($_SESSION['ae_pwd_tries']))
$_SESSION['ae_pwd_tries'] += 1;
else
$_SESSION['ae_pwd_tries'] = 1;
echo '<html>
<body>
</body>
<h3>Wrong password, please try again.</h3>
<form name="ae" method="post" action="'.get_permalink($post->ID).'">
<div><em>Password:</em></div>
<input size="25" type="password" name="ae_pwd"/> <input type="submit" value="Ok">
</html>
';
}
}
else
{
echo '<html>
<body>
</body>
<h3>This page is password protected</h3>
<form name="ae" method="post" action="'.get_permalink($post->ID).'">
<div><em>Password:</em></div>
<input size="25" type="password" name="ae_pwd"/> <input type="submit" value="Ok">
</html>
';
}
?>