Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
srhh
Involved
Involved



Joined: Dec 27, 2005
Posts: 296

PostPosted: Sat Sep 23, 2006 8:18 pm Reply with quote

Hmm, I am trying to put two of the IsSet user function thingy into my main menu block.
I have one of the IsSet User thingy for my members control panel.
I wanted to put another one in the block for another section of sublinks I just want to show up when users log in.
I went the obvious route and copied the full function from the login section of the block and pasted it down below.
Apparently, the simplest solution is not the correct one because that just made my entire site go away.

How do I do this?

Here is truncated version of my failed code:
Code:


<?php
if (eregi("block-menuTest.php",$PHP_SELF)) {
   Header("Location: index.php");
   die();
}
global $user, $admin;
$title = "Main Menu";

$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">

<br />
<strong><big>&middot;</big></strong>
<a href=index.php>Home</a><br />   <strong><big>&middot;</big></strong>
   <a href=\"faq.html\">F.A.Q's</a><br ><br />
<u>Control Panel</u>
<br />";
if (!IsSet($user)) {
   $content .= "
   <strong><big>&middot;</big></strong>
   <a href=\"account.html\">Login</a><br >
   <strong><big>&middot;</big></strong>
   <a href=\"modules.php?name=Your_Account&amp;op=new_user\">Register</a><br />";
}

if ((IsSet($user)) or (IsSet($admin))) {
   $content .= "
   <strong><big>&middot;</big></strong>
   <a href=\"account.html\">Account Info</a><br >
   <strong><big>&middot;</big></strong>
   <a href=\"modules.php?name=Your_Account&amp;op=edituser\">Edit Profile</a><br />
   <strong><big>&middot;</big></strong>
   <a href=\"modules.php?name=Your_Account&amp;op=logout\">Logout</a><br />
   
   ";
}

$content .= "
<br />
<u>Community</u>
<br />
<strong><big>&middot;</big></strong>
<a href=\"forums.html\">Forums</a><br >
<strong><big>&middot;</big></strong>
<a href=\"modules.php?name=gallery2\">Gallery</a><br >
<strong><big>&middot;</big></strong>
<a href=\"modules.php?name=Blog_List\">Blogs</a><br >
<strong><big>&middot;</big></strong>
<a href=\"messages.html\">Private Messages</a><br />
<br />
<u>Musick & Media</u>
<br />
<br />";
if (!IsSet($user)) {
   $content .= "
   <strong><big>&middot;</big></strong>
<a href=\"modules.php?name=NukeWrap&page=musick\">Music</a>
}

if ((IsSet($user)) or (IsSet($admin))) {
   $content .= "
   <strong><big>&middot;</big></strong>
   <a href=\"modules.php?name=NukeWrap&page=podcasts\">Podcast</a><br >

   ";
}

$content .= "
<br >
<br />
<u>Library</u><br />
<strong><big>&middot;</big></strong>
<a href=\"content-cat-3.html\">Biographies</a><br >
<strong><big>&middot;</big></strong>
<a href=\"content-cat-4.html\">Documents & Writings</a><br >
<strong><big>&middot;</big></strong>
<a href=\"content-cat-2.html\">Misc.</a><br >

<br />

 
View user's profile Send private message
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Sat Sep 23, 2006 8:42 pm Reply with quote

I hadn't seen that isset(user) function before but I'm a relative newbie too. The one in mainfile is "function is_user($user) {" and there is a similar one for is_admin. Is that what you want to use? Or if not where did you copy the functions you are using from?
 
View user's profile Send private message Visit poster's website
srhh







PostPosted: Sat Sep 23, 2006 8:51 pm Reply with quote

I really can't remember where I got this block from and I am pretty clueless about PHP.
I do know I want two seperate set of links to be visible to only members. The first set in the user control panel and the other for media.
If there is a better/easier way, I'm all ears. Smile
 
srhh







PostPosted: Sat Sep 23, 2006 11:42 pm Reply with quote

If it helps, I just checked my error logs and found this:

PHP Parse error: syntax error, unexpected '>'
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sun Sep 24, 2006 6:38 am Reply with quote

This line here:

Code:


$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">



Does not have a closing "; on the end.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
fkelly







PostPosted: Sun Sep 24, 2006 7:17 am Reply with quote

Brain dead on my part last night. Isset is a built in PHP function so that should work. Sorry. Just had to look up whether calls to functions were case sensitive and they weren't. So my lame excuse is that I'm used to seeing it as isset(). Maybe Montego's suggestion has you on track now, I hope.
 
srhh







PostPosted: Mon Sep 25, 2006 6:18 pm Reply with quote

montego wrote:
This line here:

Code:


$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">



Does not have a closing "; on the end.



I tried that, but didn't work. I had that line in there before and it worked fine
 
montego







PostPosted: Tue Sep 26, 2006 6:02 am Reply with quote

I'm sorry. I'm a dope. That is what happens when I am in a rush... I didn't see the continuation of the all the HTML in the string on the lines below... Sad

Not sure what to tell you about your code. I have not seen it done this way. I use the following to determine if its an admin logged in vs. a registered user:

is_user( $user )

is_admin( $admin )

Just pay attention to whether you need to add the $user and $admin to a global statement.
 
srhh







PostPosted: Tue Sep 26, 2006 12:11 pm Reply with quote

I figured it out!
I tried it again and it worked. I don't know what happened, but after comparing the two codes, there was a "; missing after the music link.
Yay! (Gonna print it out and hang it on my fridge with a big star) Wink

But, I've noticed, when I log out, the links that are only suppose to show for logged in members still show. No biggie, but is there a way to make it show only the anonymous users links when a member logs out?
 
montego







PostPosted: Tue Sep 26, 2006 6:37 pm Reply with quote

Just to be sure, are you logged out of both admin and the normal user?
 
srhh







PostPosted: Wed Sep 27, 2006 10:56 am Reply with quote

Yes I am logged out as both.
I have a feeling it has something to do with some kind of $cookie function.
Am I on the right track?
 
montego







PostPosted: Wed Sep 27, 2006 5:20 pm Reply with quote

Well, I have only used the two functions posted above and it seems to work perfectly. You may wish to switch to using those?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©