315 posts
  • Bought between 100 and 499 items
  • Has been a member for 7-8 years
  • 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

5074 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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.

315 posts
  • Bought between 100 and 499 items
  • Has been a member for 7-8 years
  • 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!

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 100 and 1 000 dollars
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…

315 posts
  • Bought between 100 and 499 items
  • Has been a member for 7-8 years
  • 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

5074 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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

315 posts
  • Bought between 100 and 499 items
  • Has been a member for 7-8 years
  • United States
timmylogue says

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

Thanks!

5074 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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.

315 posts
  • Bought between 100 and 499 items
  • Has been a member for 7-8 years
  • 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

by
by
by
by
by
by