MOD automatic daily picture MOD automatic daily picture
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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