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 [2]   Go Down

Author Topic: another question (regarding user album urls)  (Read 40226 times)

0 Members and 1 Guest are viewing this topic.

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
another question (regarding user album urls)
« Reply #20 on: September 27, 2003, 11:56:00 pm »

Quote
One last question though... Is there a way I could do it so the the url doesn't change automatically? What I mean is that currently when the page loads the url in the address bar is changed... what should I do to keep it there? Is there any other function other than header(location: URL) ? One that will keep the shortened url in the address bar.

The easiest way is to use frames.  A buddy of mine does this so the url never changes in the address bar.  Make an index.html file with two frames, one that is only one pixel wide.  Use that frame to call cpg into the large frame.

That should keep your url in place.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
another question (regarding user album urls)
« Reply #21 on: September 28, 2003, 06:08:56 am »

Quote from: "oasis"
One last question though... Is there a way I could do it so the the url doesn't change automatically? What I mean is that currently when the page loads the url in the address bar is changed... what should I do to keep it there? Is there any other function other than header(location: URL) ? One that will keep the shortened url in the address bar.

There is something in the rewrite rules which allows this ... Can't recall

BTW - thanks for the files, this should go into the FAQ....
Logged
SANIsoft PHP applications for E Biz

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
another question (regarding user album urls)
« Reply #22 on: September 28, 2003, 08:58:18 am »

OK I've done it!

I tweaked it a bit, and removed useless code. I've also made it so that the url will stay in place.

HTACCESS hasn't changed much, but the most important thing is that now it points to index.php not album.php as it previously did.
Quote
RewriteEngine On
RewriteRule ^([a-z0-9&_=]+)$ index.php?username=$1


Second, ALBUM.PHP has change A LOT!:
Quote
<?php
require('include/init.inc.php')
if (isset($HTTP_GET_VARS['username'])) {
        $username = $HTTP_GET_VARS['username'];
        $results = mysql_query("SELECT user_id FROM cpg11d_users WHERE user_name = '$username'");
        list($row) = mysql_fetch_row($results);
        if (!$row) {
                $row = -10000;
        }
        $idnum=$row+10000;
        $catid = $idnum;
        $cat = $catid;
$HTTP_GET_VARS['cat'] = $cat;
}
?>


Lastly, I'm afraid I had to chang a tiny bit of INDEX.PHP:
I removed from the top:
Quote
require('include/init.inc.php');

and added
Quote
require('album.php');


the removed line has been moved to album.php, where it still gets called.
What it does now is when I enter http://photo.enctu.org/USERNAME in the browser,
mod_rewrite makes it call index.php?username=USERNAME
ALBUM.PHP will process the variable and turn it into the user_id $cat,
which is the variable INDEX.PHP uses for calling out the albums of a specific category(in this case a user). INDEX.PHP will be tricked into thinking that the user specified a cat, and will go to that category. And best of all, since INDEX.PHP is giving all the information, there is no need for redirection, which means that the url will not change!!!

Try: http://photo.enctu.org/stunion

Oh god, I can't help feeling pleased with myself for doing all this with hardly any knowledge of PHP. Thanks to everyone who helped me. Coppermine RULES!
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

moorey

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 404
another question (regarding user album urls)
« Reply #23 on: September 28, 2003, 09:20:09 am »

Very nice. Great work!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
another question (regarding user album urls)
« Reply #24 on: September 28, 2003, 12:25:31 pm »

Quote from: "tarique"
BTW - thanks for the files, this should go into the FAQ....

hehe, and what exactly should go there? This thread is somewhat "oversized" for the faq... :wink:
Could anyone do a resumé that I can put into the faq?

Thanks

GauGau
Logged

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Not User, but Album
« Reply #25 on: October 07, 2003, 08:58:22 pm »

Very nice script!
Can you please rewrite this script?
I want to use it for albums, not for the users.

Lasa.

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
another question (regarding user album urls)
« Reply #26 on: October 08, 2003, 02:14:33 am »

Quote
Can you please rewrite this script?

Are you kidding?  :roll:
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
another question (regarding user album urls)
« Reply #27 on: October 08, 2003, 08:15:28 am »

Some small PHP modifications. :wink:
I can't code PHP.... :oops:

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
another question (regarding user album urls)
« Reply #28 on: October 08, 2003, 09:54:36 am »

Quote from: "lasa"
Some small PHP modifications. :wink:
I can't code PHP.... :oops:
Then how do you know these are going to be small modifications if you can't code php? :evil:

GauGau
Logged

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
another question (regarding user album urls)
« Reply #29 on: October 08, 2003, 11:15:38 am »

Because the only thing you have to change is the album instead of the user. I have tried it, but it don't work out...

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
another question (regarding user album urls)
« Reply #30 on: October 08, 2003, 11:32:55 am »

I have made this, but it doesn't work:

.htaccess
Code: [Select]

RewriteEngine On
RewriteRule ^([a-z0-9&=]+)$ album.php?album=$1


album.php
Code: [Select]

<?php 

/************************************************************************** 
Database functions 
**************************************************************************/ 

// Connect to the database 
mysql_connect &#40;***,***,'***'&#41;;
mysql_select_db &#40;***'&#41;;


// Perform a database query 
function db_query&#40;$query&#41; 
&#123; 
global $query_stats

$query_start getmicrotime&#40;&#41;; 
$result mysql_query&#40;$query&#41;; 
$query_end getmicrotime&#40;&#41;; 
$query_stats[&#93; = $query_end - $query_start; 

if &#40;!$result&#41; db_error&#40;"While executing query \"$query\""&#41;; 

return $result
&
#125; 

// Error message if a query failed 
function db_error&#40;$the_error&#41; 
&#123; 
global $CONFIG

if &
#40;!$CONFIG['debug_mode'&#93;&#41; &#123; 
cpg_die&#40;CRITICAL_ERROR, 'There was an error while processing a database query', __FILE__, __LINE__&#41;; 
&#125; else &#123; 

$the_error .= "\n\nmySQL error&#58; ".mysql_error&#40;&#41;."\n"; 

$out "<br />There was an error while processing a database query.<br /><br/> 
<form name='mysql'><textarea rows=\"8\" cols=\"60\">"
.htmlspecialchars&#40;$the_error&#41;."</textarea></form>"; 

cpg_die&#40;CRITICAL_ERROR, $out, __FILE__, __LINE__&#41;; 
&#125; 
&#125; 

// Fetch all rows in an array 
function db_fetch_rowset&#40;$result&#41; 
&#123; 
$rowset = array&#40;&#41;; 

while &#40;$row = mysql_fetch_array&#40;$result&#41;&#41; $rowset[&#93; = $row; 

return $rowset
&
#125; 

function getmicrotime&#40;&#41;&#123; 
list&#40;$usec, $sec&#41; = explode&#40;" ",microtime&#40;&#41;&#41;; 
return &#40;&#40;float&#41;$usec + &#40;float&#41;$sec&#41;; 
&#125; 

function cpg_die&#40;$msg_code, $msg_text, $error_file, $error_line, $output_buffer = false&#41; 
&#123; 
$ob ob_get_contents&#40;&#41;; 
if &#40;$ob&#41; ob_end_clean&#40;&#41;; 
exit; 
&
#125; 


$album $HTTP_GET_VARS['album'&#93;; 
$results mysql_query&#40;"SELECT aid FROM cpg00d_albums WHERE title = '$album'"&#41;; 

list&#40;$row&#41; = mysql_fetch_row&#40;$results&#41;; 
if &#40;!$row&#41; &#123; 
$row 0
&
#125; 
$idnum=$row
Header&#40;"Location&#58; thumbnails.php?album=".$idnum&#41;; 
exit; 
?>



I have replaced my MySQL data by *** for my privacy.

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
another question (regarding user album urls)
« Reply #31 on: October 10, 2003, 08:35:29 pm »

Nobody can help me?

intranet

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
another question (regarding user album urls)
« Reply #32 on: October 14, 2003, 01:37:35 pm »

Is this the complete Mod ? I was trying to follow along, but got a bit confused once it was completed.

Will adding the following code to the appropriate files work as is ( also moving the line from index.php to album.php )
, or is there other code previous in the thread that is required?

Quote from: "oasis"
OK I've done it!

I tweaked it a bit, and removed useless code. I've also made it so that the url will stay in place.

HTACCESS hasn't changed much, but the most important thing is that now it points to index.php not album.php as it previously did.
Quote
RewriteEngine On
RewriteRule ^([a-z0-9&_=]+)$ index.php?username=$1


Second, ALBUM.PHP has change A LOT!:
Quote
<?php
require('include/init.inc.php')
if (isset($HTTP_GET_;VARS['username'])) {
        $username = $HTTP_GET_VARS['username'];
        $results = mysql_query("SELECT user_id FROM cpg11d_users WHERE user_name = '$username'");
        list($row) = mysql_fetch_row($results);
        if (!$row) {
                $row = -10000;
        }
        $idnum=$row+10000;
        $catid = $idnum;
        $cat = $catid;
$HTTP_GET_VARS['cat'] = $cat;
}
?>


Lastly, I'm afraid I had to chang a tiny bit of INDEX.PHP:
I removed from the top:
Quote
require('include/init.inc.php');

and added
Quote
require('album.php');


the removed line has been moved to album.php, where it still gets called.
What it does now is when I enter http://photo.enctu.org/USERNAME in the browser,
mod_rewrite makes it call index.php?username=USERNAME
ALBUM.PHP will process the variable and turn it into the user_id $cat,
which is the variable INDEX.PHP uses for calling out the albums of a specific category(in this case a user). INDEX.PHP will be tricked into thinking that the user specified a cat, and will go to that category. And best of all, since INDEX.PHP is giving all the information, there is no need for redirection, which means that the url will not change!!!

Try: http://photo.enctu.org/stunion

Oh god, I can't help feeling pleased with myself for doing all this with hardly any knowledge of PHP. Thanks to everyone who helped me. Coppermine RULES!
Logged

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
another question (regarding user album urls)
« Reply #33 on: October 15, 2003, 08:03:54 am »

Quote from: "intranet"
Is this the complete Mod ? I was trying to follow along, but got a bit confused once it was completed.

Will adding the following code to the appropriate files work as is ( also moving the line from index.php to album.php )
, or is there other code previous in the thread that is required?


No intranet, this is all you need. When I said I tweaked the code a bit, actually I meant I rewrote it.  :lol:
So all you will need is the new .htaccess file, the new(shorter) album.php file and the slight change in index.php.
Oh by the, if you changed your table prefix, you will have to edit "cpg11d_users" in album.php

@lasa: try editing the newer version and not that old one... you do realise that albums are called by thumbnail.php and not index.php... also, it will not work if you have special characters(it will only take numbers, characters, hyphens and underscores) or spaces in the album name. Also, instead of cpg11d_users you'll have to call the table with the information about the albums. Good luck~
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
another question (regarding user album urls)
« Reply #34 on: October 15, 2003, 08:20:04 am »

NOTE: This is not the user album url rewrite code! If you're looking for that, look further back.

@lasa: try this

.htaccess
Quote
RewriteEngine On
RewriteRule ^([a-z0-9&_=]+)$ thumbnails.php?albumname=$1


albumname.php
Quote
<?php
require('include/init.inc.php')
if (isset($HTTP_GET_VARS['albumname'])) {
$albumname = $HTTP_GET_VARS['albumname'];
$results = mysql_query("SELECT aid FROM cpg11d_album WHERE title = '$albumname'");
list($row) = mysql_fetch_row($results);
if (!$row) {
$row = 0;
}
$album = $row;
$HTTP_GET_VARS[album'] = $album;
}
?>


replace in thumbnails.php
Quote
require('include/init.inc.php');

with
Quote
require('include/albumname.php');


I have not tested this because my gallery is now live so I can't change the settings. But, hopefully, if you enter http://yourdomain.com/pathtocoppermine/THISISALBUMNAME
it will go to the album with that name.

IF YOU HAVE TWO ALBUMS WITH THE SAME NAME, IT WILL NOT WORK!
IF YOU HAVE ALBUM NAMES WITH SPACES OR ANY SPECIAL CHARACTERS IT WILL NOT WORK.
So use this only if you are the sole admin and users can't create albums.
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

TheGamer1701

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 52
    • PartyNation.tv - Always the newest Party Facs from North Germany
Re: another question (regarding user album urls)
« Reply #35 on: July 26, 2005, 03:14:36 pm »

Hey,

it works great for, only that I just can see the last 4 uploaded pictures, not more.
But I want to see the category of the user (album overview)

Any idea what I have to change?
Or where this come from?

Thx
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.037 seconds with 19 queries.