ihostct Posted May 5, 2008 Share Posted May 5, 2008 I am trying to add a page that will be ONLY viewable by clients who have a reseller hosting account, but I am confused about what I need to use in the code. I see that what I need has to go here: if ($_SESSION['uid']) { # User is Logged In - put any code you like here } but not sure of what I need to replace the session userid variable with to get the reseller product group. I hope I am asking the question correctly, thank you in advance! 0 Quote Link to comment Share on other sites More sharing options...
ihostct Posted May 5, 2008 Author Share Posted May 5, 2008 Hmm, sorry, I'm not a PHP person and have very little knowledge in that area but after some investigating I see that I do need the session userid variable stuff. So, would I be correct in then assuming that I need to create another if statement that checks to see if the client has a reseller account, by checking the user login against the database, and then the code I want to show if the condition is met? I basically just want to create a page that shows only for a client who has a resellers account, and that page is just going to have some text and a link. 0 Quote Link to comment Share on other sites More sharing options...
Darren Posted May 5, 2008 Share Posted May 5, 2008 The $_SESSION['uid'] will give you the client's ID number. You would then need to query the database to see if they have a reseller package. If they have, then show the reseller content, if not show something else. 0 Quote Link to comment Share on other sites More sharing options...
ihostct Posted May 6, 2008 Author Share Posted May 6, 2008 Thank you Darrin. I'll keep poking away at it and see what I end up with 0 Quote Link to comment Share on other sites More sharing options...
Nick Posted May 6, 2008 Share Posted May 6, 2008 $result = mysql_query("SELECT `id`, `type` FROM `tblproducts`;"); $producttypes = array(); while($row = mysql_fetch_assoc($result)) { $producttypes[$row['id']] = $row['type']; } $reseller = false; $rq = mysql_query("SELECT `packageid` FROM `tblhosting` WHERE `domainstatus` = 'Active';"); if(mysql_num_rows($rq) != 0) { while($row = mysql_fetch_assoc($rq)) { if($producttypes[$row['packageid']] == "reselleraccount") { $reseller = true; break; } } } if($reseller) { // User is a reseller, add code here } else { // User is not a reseller, add code here } Untested, but that should work. 0 Quote Link to comment Share on other sites More sharing options...
ihostct Posted May 7, 2008 Author Share Posted May 7, 2008 Great! Thank you Nick, I'll give that a try! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.