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: additional info page  (Read 3113 times)

0 Members and 1 Guest are viewing this topic.

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
additional info page
« on: October 28, 2007, 04:08:35 pm »

hi all

is it possible / difficult to make a page called "infos.php" wich has following properties?

-background of the actual theme
-the text: "There are X new pics since your last login" (must work with bridged gallery too)
-the gallery infos "1 files in 15 albums and 5 categories with 0 comments viewed 2 times"


i would need a page like this in order to implement it on another page with an iframe. is tehre somebody who gently could make this? (ONLY if it is not too much work!)

thank you

igor
Logged

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: additional info page
« Reply #1 on: October 28, 2007, 05:50:44 pm »

i already solved part 1 and 3. the part with the new pics is still missing. i have an idea on how to solve it, but dont know if it is possible and how to program it. my idea is this: (maybe somebody can do it)

add 2 tables to the users called "oldnumber" and "displaynumber"
on login make this:

displaynumber = numberofpics - oldnumber
oldnumber = numberofpics

echo: there are displaynumber new pics.

just as idea.. i dont know if this is possible. and i dont know if it works with bridged boards.

bye

igor
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: additional info page
« Reply #2 on: October 28, 2007, 06:00:15 pm »

Code: [Select]
<?php
$sql 
mysql_query("SELECT user_lastvisit FROM {$CONFIG['TABLE_USERS']} WHERE user_id = $uid");
$last_pics $sql;
$time now() - $last_pics;
$result mysql_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE mtime = $time");
$since_last =mysql_num_rows($result);

echo 
'There are '$since_last' new pics since your last login';

?>


Try this for the number of pictures since last visit. I may be wrong around the now() part. It quite easy to do, i used code from this part of the manual to get the number of pictures and I worked out the time diffrence and retriving the results.

Good Luck!

just_some_guy

Logged
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: additional info page
« Reply #3 on: October 28, 2007, 10:37:40 pm »

hi! thank you for your help! unfortunately the code hangs somewhere.

if i have:

somecode
echo A

the result is "A" written in the page.

if i have:

somecode
yourcode
echo A

the page is empty.

i dont knwo anything of php.. so i hope somebody can help me out. ill post then the whole finished code. maybe somebody else needs it.

thank you again
Logged

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: additional info page
« Reply #4 on: October 28, 2007, 11:03:53 pm »

i googled a bit and discovered that the now() function is a sql function and not a php function. this means that i need to make a query to the database and assign the now() function result to a php variable.. but HOW? :D

bye

thanks

igor
Logged

Nibbler

  • Guest
Re: additional info page
« Reply #5 on: October 28, 2007, 11:08:03 pm »

The php equivalent is time(), however the code posted above is hopelessly wrong so don't waste much time on it.
Logged

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: additional info page
« Reply #6 on: October 28, 2007, 11:18:15 pm »

thank you nibler!

yeah something is wrong.. it gives allways "0" as value.

nibler do you know a solution to this problem?

thanks

igor
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: additional info page
« Reply #7 on: October 29, 2007, 07:52:26 am »

Running "regular" mysql queries is not recommended anyway, you better use the equivalent functions used by Coppermine. What you're up to is called "content syndication", i.e. displaying content taken from coppermine on another page. There's a whole sub-board dedicated to this that contains mods that do what you're up to.
Logged

sharky

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: additional info page
« Reply #8 on: October 29, 2007, 11:22:04 am »

hi gaugau!

thank you for pointing me in the correct direction!

i checked the section but was not able to find anything similar to this.

ty

igor
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 20 queries.