php gebruiken om mailto in html te vervangen
veelgebruikte mailto kan vervangen.
Dit ter bescherming tegen virussen, wormen en spam. Zodat er in de html code niet op mailto: gescand kan worden.
Of indien niet mogelijk, een JavaScript?
Bedankt
Je pagina moet wel eindigen op .php
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?
$youremail = "[email protected]"; // E-mail adres waarnaar moet gestuurd worden
$subject = "Feedback"; // Onderwerp in de mail
$afterpg = "page.htm"; // pagina die na succesvol versturen moet worden weer gegeven
?>
$youremail = "[email protected]"; // E-mail adres waarnaar moet gestuurd worden
$subject = "Feedback"; // Onderwerp in de mail
$afterpg = "page.htm"; // pagina die na succesvol versturen moet worden weer gegeven
?>
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?
# Compliance check
if($youremail == "[email protected]") {
print "Please ensure that you have editted this file, as it told you to!"; exit;
}
?>
# Compliance check
if($youremail == "[email protected]") {
print "Please ensure that you have editted this file, as it told you to!"; exit;
}
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
if ($id) {
if ((!$name) || (!$email) || (!$message)) {
echo "<br><center><font face='Verdana' size='3' color='#FF0000'><b>Please correct the errors below:</b></font><br><br></center>";
} else {
print "<br><center><font face='Verdana' size='3'><b>Success! Your feedback was sent successfully - Thank-you.</b><br>Click <a href='".$afterpg."'>here</a> to continue...</font><br><br></center>";
$to = $youremail;
$from = $email;
mail ($to, $subject, "Name: $name\nE-mail: $email\nMessage: $message\n\nIP: $REMOTE_ADDR", "From: $email") or print "An unknown error occured.<br>";
}
}
?>
if ($id) {
if ((!$name) || (!$email) || (!$message)) {
echo "<br><center><font face='Verdana' size='3' color='#FF0000'><b>Please correct the errors below:</b></font><br><br></center>";
} else {
print "<br><center><font face='Verdana' size='3'><b>Success! Your feedback was sent successfully - Thank-you.</b><br>Click <a href='".$afterpg."'>here</a> to continue...</font><br><br></center>";
$to = $youremail;
$from = $email;
mail ($to, $subject, "Name: $name\nE-mail: $email\nMessage: $message\n\nIP: $REMOTE_ADDR", "From: $email") or print "An unknown error occured.<br>";
}
}
?>
<p align="center"><font size="4" face="Verdana"><strong>Feedback</strong></font></p>
<form method="POST" action="?id=1">
<div align="center"><center><table border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="right"><font face="Verdana">Name:</font></td>
<td><input type="text" size="20" maxlength="30" name="name" value="">
Code (php)
</tr>
<tr>
<td align="right"><font face="Verdana">E-mail:</font></td>
<td><input type="text" size="20" maxlength="72" name="email" value="">
Code (php)
</tr>
<tr>
<td align="right"><font face="Verdana">Message:</font></td>
<td><textarea name="message" value="" rows="4" cols="20"></textarea>
Code (php)
</tr>
<tr>
<td> </td>
<td><p align="center"><input type="submit" name="submit" value="Submit"><input type="reset" name="reset" value="Reset"></p></td>
</tr>
</div></center></table>
</form>