321 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

WARNING ::: You are gonna read the word “directory folder” allot lol.

I have a membership script. When the user logs into their account it allows them to create a directory folder on the server. Once that directory folder is created they can go to that directory folder with a click of a button.

I got the users going to their correct directory folder on the server by connecting to the database and looking up the users ID inside the table of the membership script. Once it finds the ID of that user it looks for the field “directory”, then places it inside their account.

  
<? 
mysql_connect ("localhost","USERNAME","PASSWORD"); 
mysql_select_db ("DATABASE"); 

$sql = "select * from members WHERE id = $c->id"; 
$result = mysql_query ($sql); 

while ($row = mysql_fetch_array($result)) 

if ($row['directory'] != "")
{
$field1= $row["directory"];  
echo "<a href="http://websitename.com/albums/".$field1."/gallery/">Go to my album</a>";
}
 else 
{
echo "You currently have no albums.";
}
?> 

Right now it only allows the user to add one directory folder at a time. If they try to create a another directory, it just replaces the current directory field inside the database. I want to be able to allow the user to create unlimited number of directories as they want and then place them inside their account based on that user. I never want to show the other directories to the other users.

I’m not asking for you guys to write the code for me, I just need help to learn how to do this.

Does this make any sense? I’ve tried my best to explain this.

Thanks
Timothy

5492 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Located in Australia
  • Has sold $1,000+ on Envato Market
+4 more
Australia says

Just from a usability point of view , why not.

myDomain.com/albums/username/gallery-1 etc. So the user becomes the folder and the gallery + appended id becomes subset.

321 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

Just from a usability point of view , why not. Domain.com/albums/username/gallery-1 etc. So the user becomes the folder and the gallery + appended id becomes subset.

I kinda see what you mean, but these directories are gonna be custom to whatever the user whats to use. The user will be giving out these directory (codes) to their customers.

So if the user created a directory called “SportTipsWorld” The code would be (SportTipsWorld).

The customer will go to www.domain.com/lookup and type in the directory code that the user gave them, and then it would send them to that directory – www.domain.com/albums/SportTipsWorld/gallery

I don’t want be adding numbers, symbols, letters…etc to the end of the directories.

Thanks for the reply!

633 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
Thecodingdude says


Just from a usability point of view , why not. Domain.com/albums/username/gallery-1 etc. So the user becomes the folder and the gallery + appended id becomes subset.

I kinda see what you mean, but these directories are gonna be custom to whatever the user whats to use. The user will be giving out these directory (codes) to their customers.

So if the user created a directory called “SportTipsWorld” The code would be (SportTipsWorld).

The customer will go to www.domain.com/lookup and type in the directory code that the user gave them, and then it would send them to that directory – www.domain.com/albums/SportTipsWorld/gallery

I don’t want be adding numbers, symbols, letters…etc to the end of the directories.

Thanks for the reply!

So then. Add a field called “code” with the code, then, in your file, run a check that the code is contained in the URL (via GET or something) and then run the rest of the query…

321 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says
So then. Add a field called “code” with the code, then, in your file, run a check that the code is contained in the URL (via GET or something) and then run the rest of the query…

Come on man! You can do better than that! You are the Thecodingdude :)

No but really… I don’t understand what you mean.

Thanks

5492 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Located in Australia
  • Has sold $1,000+ on Envato Market
+4 more
Australia says

Timmy how server and db structure are organsed does not reflect front end, necessarily.

One approach. User goes to youdomain.com/albums types username and they goto

yourdomain.com/albums/timmy/ where they can view that users albums.

User could have three albums , apples , pears, peaches.

Etc… So second scenario, user goes to your site and searches apples… See how the hierarchy works ?

Where the stuff gets saved means nothing, thats what url rewriting does.

If user wants to share gallery then its as easy as yourdomain.com/albums/timmy/apples/

Or even easier with a bit of work…. Yoursite.com/timmy/apples

321 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

hmmmm… Ok guys! I see what you mean. I’ll mess with it!

Thanks!

5492 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Located in Australia
  • Has sold $1,000+ on Envato Market
+4 more
Australia says

I guess my point is, dont compartmentalise how you think it should work, based on routes.

The db and good script can handle all that.

Creating multiple folders is stupid and a nightmare on resources.

User creates album. Calls that album BOB

That BOB is an ID , so your db then fetches any images under this ID and gives it a fancy route.

321 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 100+ items on Envato Market
  • Located in United States
timmylogue says

I guess my point is, dont compartmentalise how you think it should work, based on routes.

The db and good script can handle all that.

Creating multiple folders is stupid and a nightmare on resources.

User creates album. Calls that album BOB

That BOB is an ID , so your db then fetches any images under this ID and gives it a fancy route.

ahhhh I get what your saying… I think i’m just doing it the lazy/easy way. Seems like that to me.

I was doing it like this and it works. Screenshot

“testGallery” is what the user typed in the HTML form to submit to the database. Then I would display what the user created with mysql_fetch (field directoy) based on what the user ID is. Then put it into a URL .

Thanks

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by