-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddsubscription.inc.php
More file actions
73 lines (59 loc) · 1.54 KB
/
addsubscription.inc.php
File metadata and controls
73 lines (59 loc) · 1.54 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
<?php
include("mylibrary/login.php");
include("mylibrary/ip-tor-blocker.php");
getUserHostIP();
getUserHostIP2();
getUserHostIP3();
getUserHostIP4();
getUserHostIP5();
getUserHostIP6();
getUserHostIP7();
login();
$visitorIp = getUserIP();
$denied_ips = ipfreely();
$status = array_search($visitorIp, $denied_ips);
if($status !== false){
header("Location: unauthorized.php");
die();
};
$email = $_POST['email'];
if (get_magic_quotes_gpc())
{
$email = stripslashes($email);
}
$email = mysql_real_escape_string($email);
$baduser = 0;
if (trim($email) == '')
$baduser = 1;
$query = "SELECT * from subscriptions where email = '$email'";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
if ($rows != 0)
$baduser = 2;
if ($baduser == 0)
{
$query = "INSERT INTO subscriptions (email)" . " VALUES ('$email')";
$result=mysql_query($query);
if ($result)
{
header("Location: confirmsubscription.inc.php");
}
else
{
echo "<h2>Sorry, I could not process your subscription at this time</h2>\n";
}
} else
{
switch($baduser)
{
case(1):
header("Location: baduser1.inc.php");
//echo "<h2>Please enter an e-mail address</h2>\n";
break;
case(2):
header("Location: baduser2.inc.php");
//echo "<h2>I'm sorry, that e-mail address already exists.</h2>\n";
break;
}
}
?>