RaitisRR Posted March 6, 2007 Report Share Posted March 6, 2007 reku skriepts <? $kam = "xxx@xxx.lv"; if (ISSET($_POST['send'])){ $from = $_POST['from']; $vards = $_POST['vards']; $message = $_POST['message']; if ($from == "") {$from = "xxxxx.cxxxx.lv";} if ($vards == "") {$vards = "Web lapa";} $subject = "E-pastu atsutija ".$vards; if ($message == "") {echo "Dodies atpakaļ un aizpildi teksta lauku!";} else { $ip = $_SERVER['REMOTE_ADDR']; $kad = date("H:m / d.m.Y"); $message = $message."\r\n \r\n -------- Nosutits: ".$kad.", no sekojošas IP adreses: ".$ip; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=windows-1257\r\n"; $headers .= "From: $from\r\n"; $headers .= "Reply-To: $from\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; mail($kam,$subject,$message,$headers) or die("E-pastu nosūtit neizdevās!!"); echo("E-pasts veiksmigi nosutits"); } } else { ?> <table width="100%" border="0" cellpadding="4" cellspacing="0"><form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>"> <tr> <td width="21%" align="right" valign="middle">Vārds Uzvārds:</td> <td width="79%"><input name="vards" type="text"size="40"></td> </tr> <tr> <td align="right" valign="middle"> <input name="to" type="hidden" value="<? echo $kam; ?>"> E-pasts:</td> <td><input name="from" type="text"size="40"> </td> </tr> <tr> <td valign="top" align="right">Jautājums:</td> <td><textarea name="message" cols="40" rows="9"></textarea></td> </tr> <tr align="center" > <td colspan="2"> <input name="send" type="submit" value="Sūtit"></td> </tr> </form></table> <? } ?> taisi kko piem - if ($message == ".lv") if ($message == ".com") ? ka lai pareizi aisargaju pret spamu ? Link to comment Share on other sites More sharing options...
andrisp Posted March 6, 2007 Report Share Posted March 6, 2007 Kodu vajag indentēt! Nesapratu, ko tu domā ar if ($message == ".lv") if ($message == ".com"). Aizsardzības vari likt dažādas: 1) Visefektīvākā - CAPTCHA attēls. Tādu jau tu būsi redzējis daudz kur. 2) Sākumā formai ielikt nepareizu action, bet pie lapas ielādes nomaina to uz pareizo (ar javascript). 3) Pie formas parādīšanas iesetojam sessijas mainīgo. Piem., $_SESSION['allow_email'] = true; un pie sūtīšanas pārbaudam vai tāds ir iesetots. Ir vēl ziljons dažādu veidu un variāciju kā atsist spambotus. Link to comment Share on other sites More sharing options...
RaitisRR Posted March 6, 2007 Author Report Share Posted March 6, 2007 nu a ka lai uztaisu piem ja vestulees texts satur .com .lv un tml to zinju vnks vnk nesuta un izdruka pazinjojumu par spam? varbut varat palidzet un paradit ka tas butu jadara ... Link to comment Share on other sites More sharing options...
andrisp Posted March 6, 2007 Report Share Posted March 6, 2007 Nu es nez, vai tā būtu labi, bet nu: if (strpos($message, '.lv') !== false || strpos($message, '.com') !== false) { die(); } Bet is stipri apšaubu šādas pārbaudes efektivitāti, jo domāju, ka tādā veidā tiks atsijāti daudzi nespameri. Link to comment Share on other sites More sharing options...
hackerman Posted March 7, 2007 Report Share Posted March 7, 2007 Tur jau tā lieta ;) Daudzi jau izmanto gmail, mail.ru utt Link to comment Share on other sites More sharing options...
v3rb0 Posted March 7, 2007 Report Share Posted March 7, 2007 ne jau tur ka gmail, bet tāpēc ka ļoti bieži mailos raksta url. thipa skaties tur, tad te , un beigās googlē ieraksti. Link to comment Share on other sites More sharing options...
rpr Posted March 7, 2007 Report Share Posted March 7, 2007 ko noziimee indenteet? Link to comment Share on other sites More sharing options...
andrisp Posted March 7, 2007 Report Share Posted March 7, 2007 Salikt atkāpes kodam. http://en.wikipedia.org/wiki/Indent_style Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 7, 2007 Report Share Posted March 7, 2007 kas ir ieverots: 1) nevajag likt Input laukiek angliskus nosaukumus Ja ieliksi name="from" un name ="send" tad spambotam nebuus nekaadu probleemu identificeet kas kur jaaraksta + taa pat ir medusmaize, jo tiek aisutiits uz e-mailu.... labaa ieliec name="no_xxx" name="nosutiit" utt... taapat var izveidot tukshu Input lauku ar name="username" kuraa NEKAS nedriiks tikt ierakstiits --> idejiski spambots tur kautko iekjekses, bet cilveeks ignorees.... un tad parbaudiit ja ieraksts ir tad mailu nesutam un uzskatam ka to aispilda botts P.S. Padomaa Logjiski kaa Spam boots var zinaat kas un kur jaaraksta.... Link to comment Share on other sites More sharing options...
Recommended Posts