PHP help, Report Broken Link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
james155
Forum Newbie
Posts: 1
Joined: Thu May 22, 2008 6:22 pm

PHP help, Report Broken Link

Post 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 :)
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: PHP help, Report Broken Link

Post 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
whiterabbit
Forum Newbie
Posts: 14
Joined: Thu May 22, 2008 6:58 pm

Re: PHP help, Report Broken Link

Post 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.
Post Reply