Page 1 of 2

MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 12:39 am
by Jaggeh
Okay well I have been working in php for awhile, but only the basics. So I started working into higher level stuff and all. But today I came accorss an error where it doesn't connect, and messes up everything (with errors). I'll show what I had, what I'm trying to get, and what happens.

Okay well first of all on the forums (is standard), I have the MemberBar.
Image

The code for the above^^ is:

Code: Select all

<if="$this->ipsclass->member['id']">
<div id="userlinks">
    <p class="home"><b>{$this->ipsclass->lang['logged_in_as']} <a href="{$this->ipsclass->base_url}showuser={$this->ipsclass->member['id']}">{$this->ipsclass->member['members_display_name']}</a></b> ( <a href="{$this->ipsclass->base_url}act=Login&CODE=03&k={$this->ipsclass->md5_check}">{$this->ipsclass->lang['log_out']}</a> )</p>
    <p>
<else />
<div id="userlinksguest">
    <p class="pcen"><b>{$this->ipsclass->lang['guest_stuff']}</b> ( <a href="{$this->ipsclass->base_url}act=Login&CODE=00">{$this->ipsclass->lang['log_in']}</a> | <a href="{$this->ipsclass->base_url}act=Reg&CODE=00">{$this->ipsclass->lang['register']}</a> )
</if>
<if="$this->ipsclass->member['mgroup'] == $this->ipsclass->vars['auth_group']">
    <b><a href="{$this->ipsclass->base_url}act=reg&CODE=reval">{$this->ipsclass->lang['resend_val']}</a></b> &middot;
</if>
<if="$this->ipsclass->member['g_access_cp'] == 1 AND $this->ipsclass->vars['security_remove_acp_link'] == 0">
    <b><a href="{$this->ipsclass->vars['_admin_link']}" target="_blank">{$this->ipsclass->lang['admin_cp']}</a></b> &middot;
</if>
<if="$this->ipsclass->member['has_blog'] == 1">
    <b><a href="{$this->ipsclass->base_url}automodule=blog&req=showblog&mid={$this->ipsclass->member['id']}">{$this->ipsclass->lang['myblog']}</a></b> &middot;
</if>
<if="$this->ipsclass->member['has_gallery'] == 1">
    <b><a href="{$this->ipsclass->base_url}autocom=gallery&req=user&user={$this->ipsclass->member['id']}">{$this->ipsclass->lang['submenu_albums']}</a></b> &middot;
</if>
<if="$this->ipsclass->member['id']">
    <b><a href="{$this->ipsclass->base_url}act=UserCP&CODE=00" title="{$this->ipsclass->lang['cp_tool_tip']}">{$this->ipsclass->lang['your_cp']}</a></b> &middot;&nbsp;<a href="{$this->ipsclass->base_url}act=Search&CODE=getnew">{$this->ipsclass->lang['view_new_posts']}</a>
    <if="$this->ipsclass->member['g_view_board']">
        &middot;&nbsp;<a href="javascript&#058;buddy_pop();" title="{$this->ipsclass->lang['bb_tool_tip']}">{$this->ipsclass->lang['l_qb']}</a>
    </if>
    &middot;&nbsp;<a href="javascript&#058;friends_pop();">{$this->ipsclass->lang['gbl_my_friends']}</a>    
</if>
<if="$this->ipsclass->member['g_use_pm'] AND $this->ipsclass->member['members_disable_pm'] == 0">
    &middot;&nbsp;<a href="{$this->ipsclass->base_url}act=Msg&CODE=01">{$msg['TEXT']}</a>
</if>
    </p>
</div>
Now when I set that up on the main site (through the fourms) using:

Code: Select all

<?php include('/../fourms/bar.php'); ?>
My outcome looks like this:
Image

One Question is; is there another way? (Note: The Source must be dynamic because if the user has admin rights, they will be able to see the link to the Admin Panel.)

Second Question is: Can someone fix the current source?

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 4:04 am
by ragnis12
are you using smarty template engine?

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 4:34 am
by Jaggeh
What's that??

Sounds like something for beginners :? I code all my own stuff....

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:00 pm
by Jaggeh
Still can't get it.

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:07 pm
by WebbieDave

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:13 pm
by Jaggeh
WebbieDave wrote:The code you posted is not PHP.
http://www.php.net/manual/en/language.basic-syntax.php
That's why it's all run by PHP?....

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:14 pm
by Benjamin
It's PHP. Rather strange but PHP nevertheless.

Anyway, what's your error?

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:35 pm
by WebbieDave
astions wrote:It's PHP. Rather strange but PHP nevertheless.
Looks more like Smarty syntax to me.

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:38 pm
by Benjamin
WebbieDave wrote:
astions wrote:It's PHP. Rather strange but PHP nevertheless.
Looks more like Smarty syntax to me.
Yeah this does not look correct at all. I didn't see that before.

Code: Select all

 
<if="$this->ipsclass->member['g_access_cp'] == 1 AND $this->ipsclass->vars['security_remove_acp_link'] == 0">
    <b><a href="{$this->ipsclass->vars['_admin_link']}" target="_blank">{$this->ipsclass->lang['admin_cp']}</a></b> &middot;
</if>
 

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:55 pm
by Jaggeh
astions wrote:
WebbieDave wrote:
astions wrote:It's PHP. Rather strange but PHP nevertheless.
Looks more like Smarty syntax to me.
Yeah this does not look correct at all. I didn't see that before.

Code: Select all

 
<if="$this->ipsclass->member['g_access_cp'] == 1 AND $this->ipsclass->vars['security_remove_acp_link'] == 0">
    <b><a href="{$this->ipsclass->vars['_admin_link']}" target="_blank">{$this->ipsclass->lang['admin_cp']}</a></b> &middot;
</if>
 
You know of a code to replace all this? :S
Also if you don't know what the above is, if the user has admin privledges, it shows the admin panel.

Re: MySQL + PHP - Forums/Website Integration

Posted: Thu Jul 10, 2008 3:58 pm
by Benjamin

Code: Select all

 
<if="$this->ipsclass->member['g_access_cp'] == 1 AND $this->ipsclass->vars['security_remove_acp_link'] == 0">
    <b><a href="{$this->ipsclass->vars['_admin_link']}" target="_blank">{$this->ipsclass->lang['admin_cp']}</a></b> &middot;
</if>
 
In pure PHP would be:

Code: Select all

 
<?php if ($this->ipsclass->member['g_access_cp'] == 1 AND $this->ipsclass->vars['security_remove_acp_link'] == 0) { ?>
    <b><a href="<?php echo $this->ipsclass->vars['_admin_link']; ?>" target="_blank"><?php echo $this->ipsclass->lang['admin_cp']; ?></a></b> &middot;
<?php } ?>
 

Re: MySQL + PHP - Forums/Website Integration

Posted: Fri Jul 11, 2008 9:00 am
by Jaggeh
Refer to Bottom Post.

Re: MySQL + PHP - Forums/Website Integration

Posted: Fri Jul 11, 2008 9:43 am
by onion2k
It's all based around this ipsclass of yours. We can't help you with that because, while it's PHP code, it's basically a separate app. You'll get much better help using the support forum for IPS (assuming there is one). We can help with specific PHP error messages, but logic errors in a large scale application is a bit beyond the scope of a PHP forum.

Re: MySQL + PHP - Forums/Website Integration

Posted: Fri Jul 11, 2008 9:47 am
by Jaggeh
Okay now I'll try this code:

Code: Select all

<?php
require_once('ipbwi/ipbsdk_class.inc.php');
$SDK =& new IPBSDK();
if ($_GET['action'] == "logout") {
$SDK->logout();
header('location: '.$_SERVER['PHP_SELF']);
}
?>
 
 
I get an error of:

Code: Select all


Where the memberbar should be.
 
Here's the Code for the file(s) it uses:

Code: Select all

 
<?php
 
$root_path = '*not_shown_for_privacy_reasons*/htdocs/forums';
 
$board_url = 'http://www.gingrichgames.co.cc/forums';
 
$sdklang = 'en';
 
$allow_caching = '1';
 
?>
 

And the other one is:
http://www.gingrichgames.co.cc/uploads/ ... ss.inc.txt

Re: MySQL + PHP - Forums/Website Integration

Posted: Fri Jul 11, 2008 9:55 am
by onion2k
http://ipbsdk.sourceforge.net/ ... the website for the library itself doesn't work. I don't think I'd hold too much hope for the code in the library doing it's job properly.

:dubious:

However, if you want some support on using it: http://forums.invisionize.com/index.php?showforum=64 ... that's the official support forum. You'll get much better responses there I imagine. They'll know how the code is meant to be working.