Log in

View Full Version : Calling all PHP pros...


Razasharp
04-26-2005, 04:00 PM
hello :-)

I was just wondering if there is anyway to use a conditional such as the 'if' one in actual vB php files?

I want to install a hack which makes some changes to the php files but I only want it to effect guests (non-loggeg in users)... any ideas what to use? Any help much appreciated!

I know it can be done with phpbb and I think with this line:

if ( !$userdata['session_logged_in'] )

But would that work with vB? (sorry if its a dumb question!)

noppid
04-26-2005, 04:18 PM
// if it's a guest
if(!$bbuserinfo['userid'])
{
//stuff here
}

Razasharp
04-26-2005, 04:23 PM
thanks your a star!!!!!!! :-)

actually sorry... come to think of it - i would need the 'code its replacing' to not be shown to the guest... so I'd need an 'else' option?
any ideas? sorry to be a pain!

Colin F
04-26-2005, 04:28 PM
well either you'd want

if(!$bbuserinfo[userid])
{
// guest code
}
else
{
// member code
}

or

if($bbuserinfo[userid])
{
//member info
}

Razasharp
04-26-2005, 04:33 PM
So would this work? :

if(!$bbuserinfo['userid'])
{
//stuff here just for guest

} else {

//stuff here just for everyone else

}



oops sorry posted at same time!

Thank you both for your help!! :-)