Pedros' code does not quite work from a UI point of view because the page is refreshed before the message box can be output.
It also summarily returns you to the index page, whether you came from there or not.
The following should do the job if you paste it into an empty delfav.php file (which you need to create yourself in Coppermine's root directory).
The define('INDEX_PHP', true);
line is not needed because you aren't using any special language variables which pertain only to index.php pages.
<?php
/*************************
Coppermine Photo Gallery
************************
Code to clear all files from the user's favorites (lightbox).
It does this simply by clearing the data in the appropriate cookie.
To use it, add a button link to this file in your template theme.php file,
eg. <a href="delfav.php">Clear Lightbox</a>
**********************************************/
define('IN_COPPERMINE', true);
require('include/init.inc.php');
setcookie($CONFIG['cookie_name'] . '_fav', "", time() + 86400 * 30, $CONFIG['cookie_path']); //The "" bit is what resets the cookie data to nothing
$referer = $HTTP_GET_VARS['referer'] ? $HTTP_GET_VARS['referer'] : 'index.php'; //Sets the index page as your previous location if it can't determine where you came from by reading the referer from the browser
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"3;url=$referer\">"); //Sends you back to the page you came from (or index.php) after 3 secs if you don't click the continue button
msg_box($lang_info, "Your lightbox has been cleared", $lang_continue, $referer);
pagefooter();
ob_end_flush(); //Sends all this to the browser and flushes the php output buffer
?>
Hope that helps. Please do correct me if I've got anything wrong.
Craig