Jump to content

Add Page for resellers


Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

$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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated