Jump to content
ZeroDoi

Formular de Contact Simplu - IP sender

Recommended Posts

Posted

Am un formular simplu de contact. si functioneaza ok, dar vreau sa ii mai adaug o mica optiune,

Cand primesc email de la cineva vreau sa imi apara si IP-ul celui care a trimis email. (nu vreau sa il folosesc pt treburi murdare, e mai mult pt jegosi care nu au ce face si stau sa completeze un formular cu injuraturi :)

Poate cineva sa imi spuna si mie cum adaug chestia asta ...

Am pus codul mai jos, poate mai au si alti nevoie de formular.

<?php 
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Numele tau:<br>
<input name="name" type="text" value="" size="30"/><br>
Adresa de email valida:<br>
<input name="email" type="text" value="" size="30"/><br>
Mesajul tau:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Trimite Mesaj"/>
</form>
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form";
mail("contact@google.ro", $subject, $message, $from);
echo "Mesajul a fost trimis, In cel mai scurt timp iti vom trimite un raspuns.";
}
}
?>

  • Active Members
Posted
Am un formular simplu de contact. si functioneaza ok, dar vreau sa ii mai adaug o mica optiune,

Cand primesc email de la cineva vreau sa imi apara si IP-ul celui care a trimis email. (nu vreau sa il folosesc pt treburi murdare, e mai mult pt jegosi care nu au ce face si stau sa completeze un formular cu injuraturi :)

Poate cineva sa imi spuna si mie cum adaug chestia asta ...

Am pus codul mai jos, poate mai au si alti nevoie de formular.

<?php 
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Numele tau:<br>
<input name="name" type="text" value="" size="30"/><br>
Adresa de email valida:<br>
<input name="email" type="text" value="" size="30"/><br>
Mesajul tau:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Trimite Mesaj"/>
</form>
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form";
mail("contact@google.ro", $subject, $message, $from);
echo "Mesajul a fost trimis, In cel mai scurt timp iti vom trimite un raspuns.";
}
}
?>

$name=$_REQUEST['name']."--".$_SERVER['REMOTE_ADDR'];

si vei primi prin mail ceva de genu numele--ip

sau la subject

$subject="Message sent using your contact form--".$_SERVER['REMOTE_ADDR'];

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...