Viewing File: /people/testlab/www/testlab.com.pl/script/kontakt_bez_kodu.php
<?
$obst = rand(0, 100000000); //losujemy liczbę od 0 do 100000000 i przypisujemy ją do zmiennej obst
session_start(); //uruchamiamy sesję
session_register('obst'); //dla sesji rejestrujemy obst
$_SESSION['obst']=$obst; //przypisanie zawartości zmiennej obst do obst
$sprawdz = md5(md5($obst)); //generujemy 32-bitowy token zawartości zmiennej obst za pomocą algorytmu md5 i przypisujemy go do zmiennej sprawdz
$_SESSION['sprawdz']=$sprawdz;
$tresc =$row['tresc'];
$sql="select * from ustawienia where typ='s".$_GET['page']."'";
$db->query($sql);
$row=$db->fetchrow();
$params=explode(";",$row['text']);
if ($_GET['param']=='wyslij')
{
$db=new DBConnect();
$sql="select * from ustawienia where typ='title'";
$db->query($sql);
$row=$db->fetchrow();
$title=$row['text'];
$to=$params[1];
$vbCrLF="\n";
$tekst1="Wiadomość ze strony $title".$vbCrLF.$vbCrLF;
$tekst1=$tekst1."----------------------------------------------------".$vbCrLF;
$tekst1=$tekst1.$_POST['tresc'].$vbCrLF.$vbCrLF;
$tekst1=$tekst1."e-mail: ".$_POST['email'].$vbCrLF;
$tekst1=$tekst1."client IP: ".$_SERVER["REMOTE_ADDR"].$vbCrLF;
$message = $tekst1;
$charset='UTF-8';
$subject=$_POST['temat'];
$encoded_subject="=?$charset?B?".base64_encode($subject)."?=\n";
$from=$_POST['email'];
$body=$tekst1;
$headers="From: ".$from."\n"
. "Content-Type: text/plain; charset=$charset; format=flowed\n"
. "MIME-Version: 1.0\n"
. "Content-Transfer-Encoding: 8bit\n"
. "X-Mailer: PHP\n";
mail($to,$encoded_subject, $body,$headers);
komunikat('msg_ok',$languages['wyslano_wiadomosc']);
}
?>
<script>
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.indexOf(at,(lat+1))!=-1){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.indexOf(dot,(lat+2))==-1){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
if (str.indexOf(" ")!=-1){
$('msg_field').innerHTML="<?echo "".$languages['zly_email'];?>";
return false
}
return true
}
function validacja()
{
if (($('temat').value==null)||($('temat').value=="")){
$('msg_field').innerHTML="<?echo "".$languages['brak_tematu'];?>";
$('temat').focus();
return false;
}
if (($('tresc').value==null)||($('tresc').value=="")){
$('msg_field').innerHTML="<?echo "".$languages['brak_tresci'];?>";
$('tresc').focus();
return false;
}
//sprawdzenie emaila
var emailID=$('email');
if ((emailID.value==null)||(emailID.value=="")){
$('msg_field').innerHTML="<?echo "".$languages['brak_email'];?>";
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
// emailID.value=""
emailID.focus()
return false
}
$('contact_form').submit();
//sprawdzenie kodu
/*
if (($('ID').value=="")||($('ID').value==null)) {$('msg_field').innerHTML="<?echo "".$languages['podaj_kod'];?>";$('ID').focus();return false;}
var x = '0';
x = hex_md5($("ID").value);
x= hex_md5(x);
if (x==$('sprawdz').value) $('contact_form').submit();
else
{
$('msg_field').innerHTML="<?echo "".$languages['zly_kod'];?>";
$('ID').focus();
}
*/
}
</script>
<? echo "$tresc";
if ($params[0]=='true')
{
?>
<form action="index.php?page=<?=$_GET['page'];?>¶m=wyslij" name=contact_form id=contact_form method=post>
<table cellspacing=10 style='width:550px;'>
<tr><td valigon=top>
<label for=temat><?echo "".$languages['temat_wiadomosci'];?></label>
<input type=text name=temat id=temat style='width:250px'><br>
</td>
<td valign=top style='font-face:arial'>
<label for=email><?echo "".$languages['adres_email'];?></label>
<input type=text name=email id=email style='width:250px'><br>
</td>
</tr>
<tr><td colspan=2>
<label for=temat><?echo "".$languages['tresc_wiadomosci'];?></label>
<textarea name=tresc id=tresc style='width:520px;height:120px;' ></textarea><br>
</td></tr>
<tr><td id=msg_field></td><td style='text-align:right'><input type=button class=button value='<?echo "".$languages['wyslij_wiadomosc'];?>' onclick="validacja()"></td></tr>
</table>
</form>
<?
}
if ($params[2]=='true')
echo "<iframe src=\"http://www.map-generator.net/extmap.php?name=".$params[3]."&address=".$params[4]."&width=500&height=400&maptype=map&zoom=14&hl=en&t=1287324939\" width=\"500\" height=\"400\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\" id=map_frame></iframe>";
?>
Back to Directory
File Manager