user's album by url http://site.com/gallery/username user's album by url http://site.com/gallery/username
 

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

user's album by url http://site.com/gallery/username

Started by newbie, April 05, 2005, 07:12:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

newbie

Hi!

I wrote a small addon for cpg132 together with the yabbse bridge
which might be usefull for somebody else ;)

If you change the $sql statement and define $boardurl
it can also be used without the yabbse bridge ;)
(standalone see 3 posts below)

create ../gallery/useralb.php:

<?php
define
('IN_COPPERMINE'true);
define('USERALB_PHP'true);
require(
'include/init.inc.php');

$sel_user $_GET['user'];
global 
$CONFIG$UDB_DB_NAME_PREFIX$UDB_DB_LINK_ID;
global 
$lang_register_php;

$sel_user mysql_escape_string($sel_user);

//query yabbse db to get userid:
$sql "SELECT ID_MEMBER FROM "$UDB_DB_NAME_PREFIX YS_TABLE_PREFIX YS_USER_TABLE " " .
       
"WHERE MEMBERNAME = '$sel_user'";

$result db_query($sql$UDB_DB_LINK_ID);
$row mysql_fetch_array($result);


$catid FIRST_USER_CAT $row['ID_MEMBER'];

// Free resultset
mysql_free_result($result);

$url $boardurl ."/gallery/index.php?cat=".$catid;

//redirect user:
header("Location: $url");
?>



and add this to .htaccess:

RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1


Now users can link to their album by using
http://site.com/gallery/newbie

;)

Bye, newbie

Tranz

Thank you for your contribution. So would this work for a standalone? Sounds like a handy mod. However, you would have to have greater restrictions on allowed characters in usernames since certain characters can cause issues when used in URLs.

Also, could you please work with the latest version, 1.3.2, if you want to contribute mods/hacks? This would ensure that whatever fixes that have been made would be included in your code.

Thank you.

Nibbler

It is yabbse specific, but can be modded for any bridge or standalone.

newbie

This should work for standalone coppermine (untestet, i only use it with yabbse):


<?php
define
('IN_COPPERMINE'true);
define('USERALB_PHP'true);
require(
'include/init.inc.php');

// ########################################################
// # set this to your website (gallery must be at $boardurl . "/gallery" or change it below)
$boardurl "http://www.your-server.de";

$sel_user $_GET['user'];
global 
$CONFIG;
global 
$lang_register_php;

$sel_user mysql_escape_string($sel_user);

//query db to get userid:
$sql "SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE username = '$sel_user'";

$result db_query($sql$UDB_DB_LINK_ID);
$row mysql_fetch_array($result);


$catid FIRST_USER_CAT $row['user_id'];

// Free resultset
mysql_free_result($result);

$url $boardurl ."/gallery/index.php?cat=".$catid;

//redirect user:
header("Location: $url");
?>



and add this to .htaccess:

RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1


Upps, sorry it was my mistake. I am running cpg 132 ;)

Bye, newbie

solei

I'm having some trouble with the quoted additions to the .htaccess file.

I added:
RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1

Just as described above, but it does nothing at all.

Any ideas as to why this might be?  I'm running apache2.

Nibbler

Did you change 'gallery' to the actual location of coppermine ?

nazcar

For cpg.1.3.5 the variable username in mysql is user_name u changes this:

search:

$sql = "SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE username = '$sel_user'";

change for:

$sql = "SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '$sel_user'";

if u cpg isn“t undes gallery change this:

$url = $boardurl ."/gallery/index.php?cat=".$catid;

for this if ur cpg is under root server

$url = "/index.php?cat=".$catid;

then u can change .httaccess

RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1

^gallery is a condicion if u want user write url domain/gallery/user or change it for ej:

http://domain/private ptu private in that condition.

Now u can change gallery/useralb.php?user=$1 if u cpg is under root server only write /useralb.php?user=$1 or put path cpg

Thats All
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.danasoft.com%2Fsig%2Fnazcar.jpg&hash=c74de0b0a7b32d4357e47fcc49a2cd41ce3c88d9)

mustang_lex

HAs anyone got this hack working for Vbulletin Bridge. Actually has anyone got this working period. I tried changing the
YS_TABLE_PREFIX . YS_USER_TABLE  to VB_TABLE_PREFIX . VB_USER_TABLE  but I get a There was an error while processing a database query   in coppermine. So it looks like the new PHP file is being utilized but somethings wrong. Oh and I used the original PHP and just changed what I mentioned above
Alex
www.stangette.com/showcase
my Coppermine Gallery!

Nibbler

This mod seems more complicated than necessary.

1.3.x (untested):


define('IN_COPPERMINE', true);
require('include/init.inc.php');

header('Location: ' . rtrim($CONFIG['ecards_more_pic_target'], '/') .'/index.php?cat='.(get_userid($_GET['user']) + FIRST_USER_CAT));


1.4.x


define('IN_COPPERMINE', true);
require('include/init.inc.php');

header('Location: ' . $CONFIG['site_url'] .'index.php?cat='.($cpg_udb->get_user_id($_GET['user']) + FIRST_USER_CAT));

mustang_lex

Nibbler kudos to you!!!!!

Heres for anyone else who wants a working version. Don't matter at all what your bridged too!

Create a file called useralb.php


<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

header('Location: ' rtrim($CONFIG['ecards_more_pic_target'], '/') .'/index.php?cat='.(get_userid($_GET['user']) + FIRST_USER_CAT));

?>


Save and upload to your root coppermine directory

then add this to your .htaccess file on your root (public_html for me) directory

RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1


MAKE SURE YOU RENAME both "gallery" to your folder you installed coppermine

Mine works and I run 1.3.X  goto http://www.stangette.com/showcase/Nikki as example
Alex
www.stangette.com/showcase
my Coppermine Gallery!

andrewshu329

Please help,
I've created the useralb.php file and put it in my coppermine root. However, there is no .htaccess file that i can find. Im running apache on my server w/ cpg 142.

Thanks in advance.
Andew
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

Nibbler


andrewshu329

Hi nibbler,
Thanks for helping me, but what I did still doesn't work.
I have my cpg install in a folder named "gallery" in my root directory.

I created a useralb.php file in my gallery folder with the code:


<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

header('Location: ' $CONFIG['site_url'] .'index.php?cat='.($cpg_udb->get_user_id($_GET['user']) + FIRST_USER_CAT));
?>



I didnt have an htaccess file in my root directory, so I created one with only these two lines of code in it:


RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1


This still doesn't work, so im pretty sure i mucked it up somewhere, please help.

Thanks a lot.
Andrew
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

Nibbler


andrewshu329

Hi nibbler,
Thanks again for helping.
I just enabled mod_rewrite, but it still doesnt work.
I suspect its something to do with my htaccess file since all i did was copy paste those two lines of code into notepad and saved as an htaccess file. Do i need anything else other than those two line of code?
I put my htaccess file in  \htdocs, whereas my cpg install is in \htdocs\gallery

Thanks for your time
Andrew
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

Tranz

Did you name it htaccess or .htaccess. There's a difference and the second one is the correct one.

andrewshu329

Hi,
The filename is .htaccess and I put it in my root.
Is there anything wrong with the code in it?
RewriteEngine On
RewriteRule ^gallery/([^\./]+)$ gallery/useralb.php?user=$1


Thanks
Andrew
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

mustang_lex

Are you sure your useralb.php file is in the gallery root?

If you go to mine and use this link. Although you get an error "No image to display" it shows that it works.
http://www.stangette.com/showcase/useralb.php

I'm just assuming here but if you go to your gallery and try the link below. You get a page cannot be displayed error.
Seems like its either not rename correctly or not in the folder or not CHMOD to at least 644

http://www.sasphotos.net/gallery/useralb.php

Alex
www.stangette.com/showcase
my Coppermine Gallery!

mustang_lex

Also make sure its all lowercase and not useralb.php.txt . Sometimes text editors will do that

I also noticed that http://www.sasphotos.net/gallery/ link doesn't work correctly. your index.php doesn't open up? It goes to a directory tree instead.
Alex
www.stangette.com/showcase
my Coppermine Gallery!

Nibbler