9 Replies - 948 Views - Last Post: 11 April 2009 - 11:38 AM Rate Topic: -----

#1 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Hide context until user is register

Posted 11 April 2009 - 10:26 AM

can anyone give me the scripts on how to hide some context until a user is register. i want to hide a few pages. thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: Hide context until user is register

#2 Vomster  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 198
  • Joined: 15-May 08

Re: Hide context until user is register

Posted 11 April 2009 - 10:39 AM

Is this what you are wanting?

if(isset($_SESSION['username']))  
{
	//Show content for users logged in
} else  {
	//Show content for users not logged in
}

Was This Post Helpful? 0
  • +
  • -

#3 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: Hide context until user is register

Posted 11 April 2009 - 10:49 AM

yes! i believe that it is, is that the actually code for it? if so where do i insert that at?
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Hide context until user is register

Posted 11 April 2009 - 10:51 AM

We're not going to do it all for you dangmnx :)

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#5 Vomster  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 198
  • Joined: 15-May 08

Re: Hide context until user is register

Posted 11 April 2009 - 10:55 AM

Think outside the box for a minute...


Where would you put it if you are wanting to keep people who are not logged in from seeing it?

BIG HINT: Before it's put on the screen.


There is probably a better way but this is definitely a start. :D
Was This Post Helpful? 0
  • +
  • -

#6 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: Hide context until user is register

Posted 11 April 2009 - 10:58 AM

That is the whole point, i don't know where to start with this code and that's why i am seeking for help here.

i have already have everything ready i need, i just need the code on how to hide a certain context in my menu which is called "Upload" because i don't want non-register users to be able to upload. the code i have for that will be located in my menu.php but it is also in every other page.

<style>
A:visited  {color: #000000; text-decoration: underline}
A:link  {color: #000000; text-decoration: underline}
A:active  {color: #000000; text-decoration: underline}
A:hover   {color: #000000; text-decoration: none}
</style>

<ul id="cssdropdown">

<li class="mainitems">
<a href="index.php">Home</a>
</li>

<li class="mainitems">
<a href="#">League</a>
<ul class="subuls" style="width: 12em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="enter.php">ENTER 1v1 Ladder</a></li><br/><br/>
</ul>
</li>

[size=3]
This is the url i want to hide until user are register.[/size][u]
[b]<li class="mainitems">
<a href="report.php">Reporting</a>
<ul class="subuls" style="width: 13em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="report.php">Report 1v1 Ladder</a></li><br/><br/>
</ul>
</li>[/b]

<li class="mainitems">
<a href="#">Forums</a>
<ul class="subuls" style="width: 13em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">Members Login</a></li><br/><br/>
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">Sign up & Register</a></li><br/><br/>
</ul>
</li>

<li class="mainitems">
<a href="#">Maps</a>
<ul class="subuls" style="width: 12em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">Season 1 Map</a></li><br/><br/>
</ul>
</li>

<li class="mainitems">
<a href="#">Media</a>
<ul class="subuls" style="width: 9em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">Replays</a></li><br/><br/>
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">ScreenShots</a></li><br/><br/>
</ul>
</li>

<li class="mainitems">
<a href="#">TGL Support</a>
<ul class="subuls" style="width: 8em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">Admin</a></li><br/><br/>
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="#">F.A.Q's</a></li><br/><br/>
</ul>
</li>

</ul>

<div id="restofcontent">
<br />
</div>

Was This Post Helpful? 0
  • +
  • -

#7 Vomster  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 198
  • Joined: 15-May 08

Re: Hide context until user is register

Posted 11 April 2009 - 11:03 AM

Fairly easy, you answerd your own question... you'd put it right there.
Was This Post Helpful? 0
  • +
  • -

#8 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: Hide context until user is register

Posted 11 April 2009 - 11:04 AM

okay, so here is what i tired,

<?php
if(isset($_SESSION['username']))
{
	//Show content for users logged in
} else  {
	//Show content for users not logged in
}

<li class="mainitems">
<a href="report.php">Reporting</a>
<ul class="subuls" style="width: 13em">
<li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="report.php">Report 1v1 Ladder</a></li><br/><br/>
</ul>
</li>
?>



and i get an error that says
Parse error: syntax error, unexpected '<' in /home/dangmnne/public_html/hp/menu.php on line 29
Was This Post Helpful? 0
  • +
  • -

#9 Vomster  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 198
  • Joined: 15-May 08

Re: Hide context until user is register

Posted 11 April 2009 - 11:14 AM

<?php
if(isset($_SESSION['username']))
{
	//Show content for users logged in
?>
  <li class="mainitems">
  <a href="report.php">Reporting</a>
  <ul class="subuls" style="width: 13em">
  <li><img border="0" src="http://www.dangmn.net/hp/images/menuarrow.gif" /><a href="report.php">Report 1v1 Ladder</a></li><br/><br/>
  </ul>
  </li>
<?php } else  { 
	//Show content for users not logged in
	//In this situation, you really have no need for an 'else'
?>
<?php
}
?>


Was This Post Helpful? 1
  • +
  • -

#10 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: Hide context until user is register

Posted 11 April 2009 - 11:38 AM

Thank you very much :) it works now, i'll let you know if i have any other issues. thanks again! :^:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1