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

Author Topic: short url to user albums  (Read 108991 times)

0 Members and 1 Guest are viewing this topic.

newage40

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
share private album mod?
« Reply #20 on: February 25, 2004, 02:32:10 am »

Anyone working on having this feature available?

Like yahoo photos where you have your album private and only the people you send the secret link can view that private album.

Can anyone mod this?

[edit GauGau]
do not try to hijack other's threads, and do not double-post nor cross-post.
You have posted exactly the same question already in feature requests (where it belongs) :evil:
[/edit]
[/b]
Logged

spellspoil

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
HACK: short url to user albums
« Reply #21 on: February 28, 2004, 08:57:06 pm »

Is there a way to make the url to be:

http://www.domain.com/gallery/party

to go the album thats named party or something...
Logged

Ravage

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
HACK: short url to user albums
« Reply #22 on: February 29, 2004, 03:29:31 am »

Would be great to have this work with vb intergration.
Logged

WreckRman2

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
    • http://www.indywebdesign.com
HACK: short url to user albums
« Reply #23 on: February 29, 2004, 04:13:02 am »

I'll share what I did for vb intergration... it's more an addon than a hack.

I created a folder called "user" then add this code to a file called index.php


Code: [Select]


<?php

$dbuser 
"";
$dbpass "";
$dbname "";
$domain "";

$db mysql_connect&#40;"localhost", $dbuser, $dbpass&#41;;
mysql_select_db&#40;$dbname,$db&#41;;

$username=$HTTP_SERVER_VARS["QUERY_STRING"&#93;;
$username eregi_replace &#40; '%20', ' ', $username&#41;;

$user_result mysql_query&#40;"SELECT * FROM user WHERE username='$username'"&#41;;
while &#40;$user = mysql_fetch_array &#40;$user_result&#41;&#41; &#123;

        
$u $user["userid"&#93;; 
    
$cat sprintf&#40;"1%04d",$u&#41;;

        
header &#40;"Location&#58;http&#58;//www.".$domain."/gallery/index.php?cat=$cat"&#41;;

&#125;

mysql_free_result &#40;$user_result&#41;;

?>




Edit the variables... then you can view a users gallery with the URL:

http://www.yourdomain.com/gallery/user?MEMBERNAME

Substitute MEMBERNAME for your members username.


All this code does is convert the username to the gallery id and redirects the user to that page. Nothing fancy but it's a temp solution until someone comes up wit something better.
Logged
David Smith
Indy Web Design - http://www.indywebdesign.com
317-573-2486

We offer web hosting that includes easy installation for Coppermine Photo Gallery, phpBB2, PHP-Nuke, and a lot more...

EliteRides

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
    • EliteRides.com
HACK: short url to user albums
« Reply #24 on: February 29, 2004, 10:21:59 pm »

Quote from: "FishnReef"
Error crítico
There was an error while processing a database query


Quote from: "gaugau"
you'll have to switch on debug_mode


I get the same thing with YaBBSE.  Here's what my errors say in debug_mode:

Quote
There was an error while processing a database query.

While executing query "SELECT user_id FROM **ERROR** WHERE user_name = 'damon'" on 0

mySQL error: You have an error in your SQL syntax near '**ERROR** WHERE user_name = 'damon'' at line 1

Debug info
USER:
Array
(
    [ID] => 46025dc00ee3bd09acc1a8272ee0f64e
    [am] => 1
    [liv] => Array
        (
           
  • => 31
  • [1] => 38
                [2] => 43
                [3] => 44
                [4] => 45
            )

    )

     
    GET :
    Array
    (
        [damon] =>
    )

     
    POST :
    Array
    (
    )

pkulak

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • PKulak.com
Re: HACK: short url to user albums
« Reply #25 on: May 04, 2004, 09:12:12 am »

Is there a way to make the url to be:

http://www.domain.com/gallery/party

to go the album thats named party or something...

You can do it with mod_rewrite. Something like this in a .htaccess file:

Code: [Select]
RewriteEngine On
RewriteBase /gallery/
RewriteRule ^([A-Za-z_0-9\-]+)\/*$ /gallery/index.php?album=$1 [R]

Then you would have to add a bit to index to have it look up the album by it's name and return the number, but it's really not much different then by user. What I would love to do is make it toally mod_rewrite compatible so that /user/album works and the links all work that way to.
Logged
"To do any good at all, just believing you are right and you motives are good isn't enough." - Ursula K. Le Guin

cerberus

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 46
    • Pocket PC Russia
Re: HACK: short url to user albums
« Reply #26 on: May 19, 2004, 02:44:04 pm »

I'll share what I did for vb intergration... it's more an addon than a hack.
but it's a temp solution until someone comes up wit something better.
It isn't working with YaBB SE ???
Logged
With Best Regards, Cerberus
Edamus, bibamus, gaudeamus.
http://www.pocketpcrussia.com - My Main Site

XBleed

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
Re: HACK: short url to user albums
« Reply #27 on: May 19, 2004, 05:38:05 pm »

I'll share what I did for vb intergration... it's more an addon than a hack.

I created a folder called "user" then add this code to a file called index.php


Code: [Select]

<?php

$dbuser 
"";
$dbpass "";
$dbname "";
$domain "";

$db mysql_connect("localhost"$dbuser$dbpass);
mysql_select_db($dbname,$db);

$username=$HTTP_SERVER_VARS["QUERY_STRING"];
$username eregi_replace '%20'' '$username);

$user_result mysql_query("SELECT * FROM user WHERE username='$username'");
while (
$user mysql_fetch_array ($user_result)) {

        
$u $user["userid"]; 
    
$cat sprintf("1%04d",$u);

        
header ("Location:http://www.".$domain."/gallery/index.php?cat=$cat");

}

mysql_free_result ($user_result);

?>



Edit the variables... then you can view a users gallery with the URL:

http://www.yourdomain.com/gallery/user?MEMBERNAME

Substitute MEMBERNAME for your members username.


All this code does is convert the username to the gallery id and redirects the user to that page. Nothing fancy but it's a temp solution until someone comes up wit something better.

I tried this but there are a bunch of errors in the code..   The "%04d" things.   They're everyhwere!
Does anyone know what they are in actual php code so I can attempt this again?
Logged

jarekn

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
Vbulletin 3.0.0 integration???
« Reply #28 on: June 16, 2004, 05:58:00 am »

Hello,

Was anyone able to get this to work with vbulletin 3.0?

I'd like to have a link from user's profile to their own gallery.

THANX
Logged

dafreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: HACK: short url to user albums
« Reply #29 on: June 17, 2004, 02:25:38 am »

Well I got Wreckmans deal to work *thanks wreckman!*

i couldnt get it to work via ..gallery/user?Username :(  *going to try to figure out why

in the meantime i just used his code and made user.php and put it in the gallery folder.. so it works as ..gallery/user.php?Username

btw i'm using VB3.01

Logged

elBarto

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: HACK: short url to user albums
« Reply #30 on: July 14, 2004, 11:04:54 pm »

After reading a lot of posts in the past few days, I still have a bit confuse to doing something like this:

http://www.domain.com/coppermine/user/ <- Users' home

http://www.domain.com/coppermine/user/gallery_1 <- User's gallery 1

Would that be possible? ???
Logged

Moodi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: HACK: short url to user albums
« Reply #31 on: July 18, 2004, 12:40:45 am »

My change for work with PHPBB intregration

Look the original post
http://forum.coppermine-gallery.net/index.php?topic=1659.msg7910#msg7910
and change the code by

Code: [Select]

$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = urlencode($qq);
      $sql = "SELECT user_id " . "FROM " . $UDB_DB_NAME_PREFIX . PHPBB_TABLE_PREFIX . PHPBB_USER_TABLE . " " . "WHERE username = '". mysql_escape_string($qq) ."'";

    $result = db_query($sql, $UDB_DB_LINK_ID);

    if (mysql_num_rows($result)>0) {
        $u = mysql_fetch_array($result);
        $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  else {
    cpg_die(ERROR, '"' . $qq . '" YOUR ERROR MESSAGE HERE', __FILE__, __LINE__);
  }

}


« Last Edit: July 18, 2004, 01:25:22 am by Moodi »
Logged
Paris IS MAGIC !!!!!!!!!!! :D:D

Moodi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: HACK: short url to user albums
« Reply #32 on: July 18, 2004, 12:53:35 am »

My change for work with vbulletin3 intregration

Look the original post
http://forum.coppermine-gallery.net/index.php?topic=1659.msg7910#msg7910
and change the code by

Code: [Select]

$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = urlencode($qq);
    $sql = "SELECT userid as user_id " . "FROM " . $UDB_DB_NAME_PREFIX . VB_TABLE_PREFIX . VB_USER_TABLE . " " . "WHERE username = '". mysql_escape_string($qq) ."'";

    $result = db_query($sql, $UDB_DB_LINK_ID);

    if (mysql_num_rows($result)>0) {
        $u = mysql_fetch_array($result);
        $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  else {
    cpg_die(ERROR, '"' . $qq . '" YOUR ERROR MESSAGE HERE.', __FILE__, __LINE__);
  }

}


« Last Edit: July 18, 2004, 01:27:48 am by Moodi »
Logged
Paris IS MAGIC !!!!!!!!!!! :D:D

Moodi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: HACK: short url to user albums
« Reply #33 on: July 18, 2004, 12:58:41 am »

My change for work with Invision Power Board v1.1 Integration

Look the original post
http://forum.coppermine-gallery.net/index.php?topic=1659.msg7910#msg7910
and change the code by

Code: [Select]

$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = urlencode($qq);
      $sql = "SELECT id as user_id " . "FROM " . $UDB_DB_NAME_PREFIX . IB_TABLE_PREFIX . IB_USER_TABLE . " " . "WHERE name = '". mysql_escape_string($qq) ."'";

    $result = db_query($sql, $UDB_DB_LINK_ID);

    if (mysql_num_rows($result)>0) {
        $u = mysql_fetch_array($result);
        $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  else {
    cpg_die(ERROR, '"' . $qq . '" YOUR ERROR MESSAGE HERE.', __FILE__, __LINE__);
  }

}


« Last Edit: July 18, 2004, 01:27:30 am by Moodi »
Logged
Paris IS MAGIC !!!!!!!!!!! :D:D

Moodi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: HACK: short url to user albums
« Reply #34 on: July 18, 2004, 01:09:05 am »

My change for YaBB SE 1.5.4 Integration

Look the original post
http://forum.coppermine-gallery.net/index.php?topic=1659.msg7910#msg7910
and change the code by

Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = urlencode($qq);
    $sql = "SELECT ID_MEMBER as user_id " . "FROM " . $UDB_DB_NAME_PREFIX . YS_TABLE_PREFIX . YS_USER_TABLE . " " . "WHERE realName = '". mysql_escape_string($qq) ."'";

    $result = db_query($sql, $UDB_DB_LINK_ID);

    if (mysql_num_rows($result)>0) {
        $u = mysql_fetch_array($result);
        $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  else {
    cpg_die(ERROR, '"' . $qq . '" YOUR ERROR MESSAGE HERE', __FILE__, __LINE__);
  }

}
« Last Edit: July 18, 2004, 01:27:11 am by Moodi »
Logged
Paris IS MAGIC !!!!!!!!!!! :D:D

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: HACK: short url to user albums
« Reply #35 on: July 18, 2004, 01:16:29 am »

Hi Moodi,

If you have made mods to the code that will make these bridges work better, then you help is much appreciated, but please explain on each post, to which file you are refering, and show not just the new code, but the old code it is replacing, or if just additional code, where to put it.

Thanks.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Moodi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 5
Re: HACK: short url to user albums
« Reply #36 on: July 18, 2004, 01:31:01 am »

Yes Casper !! ;)

I modified my post 

it's better like that? :-[
Logged
Paris IS MAGIC !!!!!!!!!!! :D:D

hevangel

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: HACK: short url to user albums
« Reply #37 on: August 13, 2004, 10:29:13 am »

Hi,

I found a bug (or feature) of this hack.
If I change the theme, I got bounce back to the main page.
So I modified the code by introducing a user_gallery option that overwrite the cat option in URL.

The shortcut URL become
http://www.yourdomain.com/album/user_gallery=user_name

Replace the orginial code with
Code: [Select]
if (isset($HTTP_GET_VARS['user_gallery'])) {
$user_gallery = $HTTP_GET_VARS['user_gallery'];
$sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " .
"WHERE user_name = '". mysql_escape_string($user_gallery) . "'";
 
$result1 = db_query($sql);
    if (mysql_num_rows($result1)>0) {
    $u = mysql_fetch_array($result1);
    $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
mysql_free_result($result1);
}
« Last Edit: August 13, 2004, 10:46:12 am by hevangel »
Logged

Allo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: HACK: short url to user albums
« Reply #38 on: August 18, 2004, 06:05:18 am »

Error checking code -

Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
 if (!strstr($qq,'=') and !empty($qq)) {
   $qq = urlencode($qq);
   $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '". mysql_escape_string($qq) . "'";
   $result1 = db_query($sql);
   if (mysql_num_rows($result1)>0) {
     $u = mysql_fetch_array($result1);
     $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
   }
   else {
     cpg_die(ERROR, '"' . $qq . '" is an invalid username.  Please try again.', __FILE__, __LINE__);
   }
   mysql_free_result($result1);
}


I still have problem with this.

The site is: www.artsrater.com

the gallery is in first page but when i'm typing  www.artsrater.com/?allo   (where  "allo" is the username)

I receive this:

There was an error while processing a database query.

While executing query "SELECT user_id FROM nuke_users WHERE user_name = 'allo'" on 0

mySQL error: Unknown column 'user_name' in 'where clause'


Nuke ver is 7 and coppermine 1.2
 :-\\ i'm totally out.
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: HACK: short url to user albums
« Reply #39 on: August 18, 2004, 06:11:08 am »

Quote
Nuke ver is 7 and coppermine 1.2
i'm totally out.

This isn't for the nuke version.  This is for the standalone version.  Nuke support can be found at http://www.nukephotogallery.com.
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
Pages: 1 [2] 3 4   Go Up
 

Page created in 0.031 seconds with 19 queries.