Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: How to delete all favorites  (Read 31377 times)

0 Members and 1 Guest are viewing this topic.

Pedros

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
[Solved]: How to delete all favorites
« on: July 06, 2004, 05:02:16 pm »

Is there a way i can delete all favorites by pressing one button??
I know it's a clientsite cookie...
Any code available?
« Last Edit: May 08, 2005, 09:48:04 am by GauGau »
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to delete all favorites
« Reply #1 on: July 06, 2004, 06:27:28 pm »

Just change the name of the cookie, in config.  it will mean all client saved data is cleared.
You will also find yourself logged out.  Just log back in.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Pedros

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: How to delete all favorites
« Reply #2 on: July 07, 2004, 12:35:00 pm »

sorry your answer was no help
I did it myself!! actualy very simpel

<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');

setcookie($CONFIG['cookie_name'] . '_fav', "", time() + 86400 * 30, $CONFIG['cookie_path']);

$location = "index.php";
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $location);
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"1;url=$location\">");
msg_box($lang_info, "Het zipbestand werd verwijderd", $lang_continue, $location);
pagefooter();
ob_end_flush();
?>
Logged

bit bit spears

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 240
    • TangibleBrit.com
Re: [Solved]: How to delete all favorites
« Reply #3 on: July 10, 2004, 09:35:29 am »

gives a database error after clearing favs!

"There was an error while processing a database query"
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: How to delete all favorites
« Reply #4 on: July 10, 2004, 04:26:56 pm »

you've been told before: if there's a database error, enable debug_mode in config and post what query actually failed. When will you learn to properly ask questions on this board?

GauGau
Logged

Pedros

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: [Solved]: How to delete all favorites
« Reply #5 on: July 16, 2004, 10:31:15 am »

gives a database error after clearing favs!

"There was an error while processing a database query"
The code dont need access to the database!
Just put this code in a new file : dellfav.php (example)
Make a new  button and link it
<a href="dellfav.php">Delete favorites </a>
Logged

littletomfool

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: [Solved]: How to delete all favorites
« Reply #6 on: November 11, 2004, 04:37:34 am »

Hi~~~ I'm new here, and I don't know PHP very much, can you please teach me what code should I add to let user automaticaly Delete Favorites after download the ZIP file??
Logged

kper

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: [Solved]: How to delete all favorites
« Reply #7 on: May 07, 2005, 05:48:17 pm »

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
Code: [Select]
define('INDEX_PHP', true); line is not needed because you aren't using any special language variables which pertain only to index.php pages.

Code: [Select]
<?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
Logged

kper

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: [Solved]: How to delete all favorites
« Reply #8 on: May 10, 2005, 11:14:55 am »

 :-[  Sorry: my last post contains an error. Replace the obvious line with the following. It will then work. Ooops.
Code: [Select]
$referer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_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
Craig
Logged

digitalravi

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 35
Re: [Solved]: How to delete all favorites
« Reply #9 on: August 23, 2006, 06:07:08 pm »

I followed the instructions by Kper, but I am unsure as to where to put this line "<a href="dellfav.php">Delete favorites </a>"
Logged

Nibbler

  • Guest
Re: [Solved]: How to delete all favorites
« Reply #10 on: August 23, 2006, 06:11:00 pm »

I thought you were running 1.4?
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.