Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
I'm stuck with member's website!
Old 05-05-2005, 04:50 PM I'm stuck with member's website!
Novice Talker

Posts: 11
Location: Dundee, UK
Trades: 0
Right Ive researched and managed to create a password system using PHP and a database for my members only site. I'm stuck with one or two more things, so I hope you can help me out. Hope this is the right place to put this.

Basically members sign up to a basic or premium account, I've been able to alter the content they see depending on the type of account with PHP so no problems there. Now every month for a year they will get a selection of photos of my lovely model. Now I only want them to have access to the photoshoots that fall within their membership. So using a database I have put the month they signed up and the month the membership ends and the PHP checks to see if the page which contains this months photos falls within those dates. I can also use a number system like shoot/month 2-13 etc.

All of that works fine but here are the problems I'm now having. I want a page, like an archive page, that displays thumbnails with links to the shoots that they have paid for. Also I want to include the ability to buy individual more shoots which would be added to this page. If they buy individual shoots then the 2-13 thing wont work because say they sign up 10-22 and they buy shoots 2 and 8, how do I include them in the database? Also if they renew their membership then it would be easy to extend it, just put the expiry date a year ahead or add 12 onto the end number.

What happens if they wait a few months before they resign up? They would want to have access to the photos they paid for previously as well as the new ones. I mean if they signed up at the beginning ended their membership at 12 then waited then signed back up at 15. I couldn't put 1-26 because that would include 13 and 14 they are not entitled to.

Is there an easy way of doing this or would I need to put every number or dates into the database like "1" "2" "3" "4" "5", etc instead of doing "2"-"13"

How would I do this? If Im not being too clear please ask me the bits you want clarified.
Thanks
Mike
M.Millis is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-06-2005, 03:06 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
personally I would use a second table for the allowed areas/months to make querying and updating much simpler. You only need 3 columns id, user_id and month_code. Then you can query in several ways to check for allowed access.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-06-2005, 05:47 PM
Novice Talker

Posts: 11
Location: Dundee, UK
Trades: 0
Ok another table, I'll try that thanks. However, I'm still stuck. If you'll forgive me I'm new to PHP and Databases.

I still have no idea how to work out what months the user is entitled to. At the moment I have the date the user signed up in one column and then the date the users membership expires in another. Each page of a monthly shoot checks to see whether the date it was published is equal to or greater than the sign-up date and equal to or less than expiry date.

As you can see this will not allow me to add additional months that may fall before or after the persons membership. Also if the member waits several months before resigning up then surely there must be an easier way than putting four columns. One for the first sign-up one for the first expiry then another for the second sign-up and the last for the second expiry, such as "01/01/05" "01/01/06" then "01/05/06" "01/05/07" As you can see that would be the only way of preventing him from accessing shoots from Feb-May. If I just put the end date a year ahead it wouldn't work.

I'm sure there is a php or mysql command I'm missing here but as I say I'm new. Anyone got any ideas? It's a pity I can just number months then put all the ones the user is entitled to into one column like, "1 2 3 4 5 6 7 8 9 10 11 12 16 18" etc then check to see if the month number is contained in that. I'm pretty sure doing it that way i'd need to put each number it seperate columns

Im stuck!
Mike
M.Millis is offline
Reply With Quote
View Public Profile
 
Old 05-06-2005, 06:52 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
that's the general idea of using normalised tables. You don't have to keep adding columns where many may be empty.

extra table consisting of user id and shoot ref codes, to check if a user is valid for any month it's a simple SQL query
Code:
$sql = "SELECT user_id FROM table WHERE user_id = " . $user_id ." AND shoot_code = " . $shoot_code . " ;"
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if ($rows > 0) {
    $allowed = true;
} else {
    $allowed = false;
}
so to add extra shoots to any user you just insert another row with the user_id and the shoot code.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-07-2005, 02:52 PM
Novice Talker

Posts: 11
Location: Dundee, UK
Trades: 0
DOH! It seems soooooo simple now! I better read up on this stuff better! I was going to do a webmaster course but don't have a spare £2,000 lying around so have to learn it all myself.

Thanks much! I can finish this project now!
Cheers again
Mike
M.Millis is offline
Reply With Quote
View Public Profile
 
Old 05-07-2005, 08:10 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
You won't need £2k! Use this website, online tutorials, and perhaps a book or two (£20 or £30 each tops).
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to I'm stuck with member's website!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23079 seconds with 12 queries