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: MOD automatic daily picture  (Read 2581 times)

0 Members and 1 Guest are viewing this topic.

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
MOD automatic daily picture
« on: October 20, 2005, 07:44:23 pm »

Hello, i done a script to put a pic by day automaticaly.

I use the "approved" column because i dont use it in my gallerie.

1/ Put all  pictures normally with "FTP" button
2/ Go database to put new pictures column "approved" in cpg_pictures to "no"

Put maj.php at the racine of the site :

Code: [Select]
<?
//Tous les jours à 3h update la date et le champs valide à yes de la video
//update approved to yes all the day

define('IN_COPPERMINE', true);

require('include/init.inc.php');

pageheader("mise a jour");

MYSQL_CONNECT($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']) or die("can't connect to mysql server");
MYSQL_SELECT_DB($CONFIG['dbname']);

$date = date("Y-m-d");
$time = date("H:i:s");

$sql1 = mysql_query("SELECT min(pid) FROM cpg132_pictures WHERE approved='NO'");

while($data = mysql_fetch_array($sql1)) 
    {
    $result1 = $data['min(pid)'];   
   
    } 

$var=time();


$sql = "UPDATE cpg132_pictures SET mtime='$date $time',ctime='$var',approved='YES' WHERE approved='NO' and pid='$result1'";
$result = mysql_query($sql);


echo "La photo $result1 a bien été ajoutée";

?>



Go on crontab.fr for example to run maj.php daily, or do a cron in your dedicated server if you have.

For me it 's ok, my gallerie has automatic pic daily  :)

Bye
Logged
Pages: [1]   Go Up
 

Page created in 0.015 seconds with 19 queries.