-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-form.php
163 lines (133 loc) · 5.23 KB
/
get-form.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?
if (!$_SESSION)
{
session_start();
}
$name=$_REQUEST['name'];
$country=$_REQUEST['country'];
$mail=$_REQUEST['mail'];
$captcha = $_REQUEST['sco'];
$captcha_check_value = $_SESSION['captcha_a'];
//$pattern = "/[.]+(aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs
//|mobi|mil|museum|name|net|org|pro|root|tel|travel|ac
//|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az
//|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bw|by
//|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx
//|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj
//|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr
//|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|htm|html|php|il|im|in|io|iq
//|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la
//|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm
//|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|asp|cgi
//|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk
//|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd
//|se|sg|sh|si|sk|sl|sm|sn|sr|st|sv|sy|sz|tc|td|tf|tg|th
//|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va
//|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw|levitra|viagra|casino|sex|loan|finance|slots|debt|free|html)$/i";
//$http = substr_count($des, "http");
//$href = substr_count($des, "href");
//$url = substr_count($des, "[url");
//$www = substr_count($des, "www");
//$httphrefurl = $http + $href + $url + $www;
//$http_web = substr_count($web, "http://");
$a_name = count(explode(" ",$_REQUEST[name]));
$b_name = strlen($name);
$c_name = str_word_count($name);
include 'check_spl_char.php';
$ch_name = checkSplChar($name);
$a_country = str_word_count($country);
//$b_des = strlen($des);
include 'get_real_ip.php';
$ip = getIP();
//------------- Name Checking --------------
if(($name == '') || ($c_name == 0)){
$cont_error = "Error! Plz enter your name.";
}elseif($a_name > 2){
$cont_error = "Error! More than a space is not allowed on the name field.";
}elseif($b_name > 21){
$cont_error = "Error! Name consists of maximum 21 characters.";
}elseif($ch_name == 0){
$cont_error = "Error! Special characters are not allowed on the name field.";
}
//------------- Email ID Checking --------------
elseif($mail == ''){
$cont_error = "Error! Please enter an e-mail id.";
}elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_REQUEST[mail])) {
$cont_error = "Error! The e-mail you entered was not in the proper format.";
}
//------------- Website URL checking -------------
//--------------- Comment checking---------------
elseif(($country == '') || ($a_country == 0)){
$cont_error = "Error! Comment cannot be blank.";
}
elseif($a_country > 250){
$cont_error = "Error! Comment consists of maximum 250 words.";
}
//------------- Spam comment checking ------------
//elseif (($des != '') && (preg_match($pattern, $des))){
//$cont_error = "Error! Comment looks a bit spammy. Rewrite it please.";
//}
//elseif (($des != '') && ($http > 0 OR $href > 0 OR $url > 0 OR $www > 0 OR $httphrefurl > 0)){
//$cont_error = "Error! Comment looks a bit spammy. Rewrite it please.";
//}
// Get the IP/ensure that what we have is a real IP
elseif(($ip == '') || ($ip == 'unknown'))
{
$cont_error = "Error! IP not found. Rewrite it please.";
}
//------------- Security Code Checking --------------
elseif(($captcha == '') || ($captcha == 'Enter the security code')){
unset($captcha_check_value);
$cont_error = "Error! Please enter the security code.";
}elseif($captcha != $captcha_check_value){
unset($captcha_check_value);
$cont_error = "Error! Please enter the security code correctly.";
}
else{
//------------------------------------- Please change the matter =----------------------------------
$headers .= "From:" . $name . "<" .$mail . ">" ."\r\n";
$headers .= "AktivSvenska - ".$name." wants to contact us.";
$to="[email protected]";
$message ="Name = $name\nEmail = $mail\nWebsite Url = $web\nComments = $des\n";
if(mail($to,"AktivSvenska - INQUIRY FORM",$message,$headers)) {
$contact_msg = "Thanks for your mail. Shall contact you soon at earliest.";
$name='';
$mail='';
$web='';
$des='';
} else {
$cont_error = "There was a problem sending the mail. Please contact to [email protected]";
}
}
?>
<?
if($contact_msg != ''){
echo "<b>".$contact_msg."</b><br>";
}else{
?>
<FORM name="ajax" method="POST" action="">
<?
if($cont_error != ''){
echo "<b><span style=\"color:#FF3366\">".$cont_error."</span></b><br><br>";
}
?>
<strong>Name:</strong><span class="textstar">*</span> <br>
<input name="name" type="text" id="name" maxlength="30" class="formin1" value="<?=$name;?>">
<input type="hidden" name="dyn" size="32" value="">
<br><br />
<strong>Country of Origin:</strong><span class="textstar">*</span><br>
<input name="country" type="text" maxlength="255" class="formin1" id="country" value="<?=$country;?>">
<br>
<br>
<strong>E-mail:</strong><span class="textstar">*</span><br>
<input name="mail" type="text" maxlength="255" class="formin1" id="mail" value="<?=$mail;?>">
<br>
<br>
<img src="/captcha.php" alt=""><br>
<strong>Enter security code here:</strong><span class="textstar">*</span><br>
<input type="text" name="sco" id="sco" maxlength="30" class="formin1"><br>
<INPUT type="BUTTON" value="Submit" ONCLICK="submitForm()" alt="" class="subm">
</FORM>
<?
}
?>