MOD automatic daily picture MOD automatic daily picture
 

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]

Main Menu

MOD automatic daily picture

Started by antisa33, October 20, 2005, 07:44:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

antisa33

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 :


<?
//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