Advanced search  

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

Pages: [1]   Go Down

Author Topic: Trying to make Random POTD.  (Read 2987 times)

0 Members and 1 Guest are viewing this topic.

MonkeyManx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Trying to make Random POTD.
« on: April 26, 2005, 12:43:50 am »

Hello, I am trying to create a random Pic of the day script. I started by Modifying the POTD script that Casper wrote. Eventually I am going to try and make it so I can force images to be the pic of the day. Any ways here is what I have so far. My php skills are very rusty.
Code: [Select]
define('POTD_PHP', true);
define('IN_COPPERMINE', true);

global $prefix, $dbi, $lang_meta_album_names;

starttable("100%", "{$lang_meta_album_names['potd']}");

{
   

$today = date("Ymd");
$result = db_query("SELECT pid, aid, filepath, filename, owner_name, owner_id  from

{$CONFIG['TABLE_PICTURES']} WHERE potd_date='$today'", $dbi);
$picture = mysql_fetch_array($result);
 
  $img = "<img src=\"albums/{$picture['filepath']}thumb_{$picture['filename']}\"  border=\"0\">";
$content .= "<center><tr><td><center><a

href=\"displayimage.php?pos=-{$picture['pid']}\">$img</a><br /><br

/><big>{$lang_meta_album_names['potd']}</big><br><small>by</small><b> <a

href=\"thumbnails.php?album=lastupby&uid={$picture['owner_id']}\">{$picture['owner_name']}</a></b>

<br />
<a href=\"thumbnails.php?album=potdarch\">{$lang_meta_album_names['potdarch']}</a>
</center></td></tr>";
 

 
if (!$result) {
$result = db_query("SELECT * from {$CONFIG['TABLE_PICTURES']}", $dbi);
$num_rows = mysql_num_rows($result);
$result = db_query("UPDATE " . $CONFIG['TABLE_PICTURES'] . ", SET potd_date = '$today', WHERE pid

= '$num_rows'", $dbi);
if (!$result)
{
die('Could not update the POTD');
}
}

}

 
print $content;

endtable();

It isn't working yet, and I am not sure why. Could someone please look at it to see what I am doing wrong? Thanks.
Logged

OmegaGOD

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • I approve.
Re: Trying to make Random POTD.
« Reply #1 on: April 26, 2005, 07:39:59 pm »

I'm not really sure what you are trying to do. Casper's script needs no modification to work as POTD. See the tread regarding POTD http://forum.coppermine-gallery.net/index.php?topic=14600.0
Logged
Please do not PM me with support questions. Please read the manual and then if posting questions please place them in the proper sub-boards.

MonkeyManx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Trying to make Random POTD.
« Reply #2 on: April 26, 2005, 08:39:24 pm »

Im trying to modify caspers script so that it checks to see if there is a POTD for today, if there is then it displays it, and if there isnt then it makes a random pic to be the potd.... The thing I dont like about caspers script is that every day you must move the current potd to the archive.
Logged
Pages: [1]   Go Up
 

Page created in 0.015 seconds with 19 queries.