ZeroDoi Posted November 30, 2013 Report Posted November 30, 2013 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."; } } ?> Quote
Active Members dancezar Posted November 30, 2013 Active Members Report Posted November 30, 2013 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--ipsau la subject $subject="Message sent using your contact form--".$_SERVER['REMOTE_ADDR']; Quote
ZeroDoi Posted November 30, 2013 Author Report Posted November 30, 2013 Merge, doar ca imi ia Ip-ul de la cloudflare .. 141.101.70.133 ( am cloudflare pus ca NS ) in loc sa imi apara IP-ul utilizatorului care a trimis email Quote
Active Members dancezar Posted November 30, 2013 Active Members Report Posted November 30, 2013 atunci incerca in loc de $_SERVER['REMOTE_ADDR'] pune $_SERVER["HTTP_CF_CONNECTING_IP"] Quote
ZeroDoi Posted November 30, 2013 Author Report Posted November 30, 2013 Acum merge, Multumesc raman dator, Quote