Page 1 of 1
PHP help, Report Broken Link
Posted: Thu May 22, 2008 6:46 pm
by james155
hey, wondering if anyone could lend a hand.
I'm creating a custom link database. for an anime site,
and sometimes a video might get deleted at its source, veoh.com etc deleting a video.
how could i make a simple
"report broken link" button, where if someone clicks it, it sends the current URL to an email address?
is this possible?
thanks

Re: PHP help, Report Broken Link
Posted: Thu May 22, 2008 7:04 pm
by yacahuma
Code: Select all
<a href="reportbrokenlink.php?url=www.brokenlink.com">Report Broken Link</a>
I got this code from here
http://www.swiftmailer.org/wikidocs/v3/tutorials/basic
this will be your reportbrokenlink.php file
Code: Select all
<?php
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
//Start Swift
$swift =& new Swift(new Swift_Connection_SMTP("smtp.your-host.tld"));
//Create the message
$message =& new Swift_Message("BROKEN LINK NOTIFICATION", $_GET['URL']);
//Now check if Swift actually sends it
if ($swift->send($message, "foo@bar.tld", "me@mydomain.com")) echo "Sent";
else echo "Failed";
just read the swift documentation to actually configure your email
Re: PHP help, Report Broken Link
Posted: Thu May 22, 2008 7:49 pm
by whiterabbit
If you are going to have this link available for the public to click, you might want to use a captcha as well for users to validate, otherwise plan on getting spammed. Just remember, you are going to get an email for every time someone (or some bot) 'clicks' on this link.