How to code "Report bad link" using php

Post Reply
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

How to code "Report bad link" using php

Post by Neo » Sat Mar 13, 2010 6:45 pm

Following is the code to display the Report! bad link.

Code: Select all

<html>
<head>
<title>Report Bad Link</title>
</head>
<body>
<form action="badlink.php" method="POST">
Link that is bad:<input type="text" name="link" value="" /><br />
<input type="submit" value="Report!" />
</form>
</body>
</html>
 
badlink.php

Code: Select all

<?php
$bad_link = $_POST['<span class="posthilit">link</span>'];
if ($bad_link != "") {
  $message = "A user has reported this <span class="posthilit">link</span>: " . $bad_link . ", as being bad.";
  mail('[email protected]', 'Bad <span class="posthilit">Link</span> <span class="posthilit">Report</span>', $message);
}
header("Location: thankyou.html");
?>
Make sure you [email protected] to your email address. you will receive an email that says: A user has reported this link: LINKHERE, as being bad.

Here is the thank you page to thank the user.

thankyou.html

Code: Select all

<html>
<head>
<title>Thank you</title>
</head>
<body>
Thank you so much for reporting that bad link!
</body>
</html>
 
Post Reply

Return to “PHP & MySQL”