Fork me on GitHub

PHP include problems in AutoTheme  Bottom

Go to page [-1] 1 - 2:

  • skicrave

    I'm definitely bringing this one back up from the depths. :)

    Unfortunately, there's no new progress to report on this issue. I'll admit I haven't looked at it in a while (I've had other site issues to deal with), but it's about time I get it figured out.

    If anyone has some tips on where to go from here, I'd love to hear them.

    Thanks,

    Jason


    Post the code of the login file and I'll be able to tell you. It looks like it's logging into a forum of some sort and if it's relying on some session/cookie info then when you try and use it in PN, PN's session/cookies will conflict.

    Also, lobos's code should work great included into an AutoTheme template as far as whether you're loggedin to PN or not.

    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Thanks for the replies everyone. I know about PN's built in ability to display member links, but what I'm trying to include is the member bar for my forums (as Shawn stated).

    Here's the code from the file that's being called:

    Code

    <?

    // ------------------------------------------
    // INSTRUCTIONS
    // 1. Edit the variable below.
    // 2. Upload to your site, and thats it :).
    //
    // OPTIONAL ( might be needed )
    // editing the cookies.
    // if your cookies have a prefix set to them you will need to change the $_COOKIE
    // to have a prefix. so if your prefix is ibf_ then to cookie thing would be
    // $_COOKIE['ibf_member_id']; and so on.
    //
    //-------------------------------------------


    // Variables
    $members = "ibf_members";         // Name of the table where your members are
    $groups =    "ibf_groups";               // Name of the group table.
    $url =           "http://www.malibuboatowners.com/forums/index.php"; // The full URL to your forums
    $short =       "forums/admin.php"; // The link to the admin control pane
    $db_host =  "localhost";                  // Should work 99% of the time.
    $db_user =   "malibubo_admin";                      // mySQL database "USER"
    $db_pass =  "kidder";                      // mySQL database "PASS"
    $database =  "malibubo_invision";          // mySQL "DATABASE" name

    // langugage variables
    // no need to change these.  
    $yourcp =     "My Controls";
    $gobyebye = "Log Out";
    $loggedin =  "Logged In As:";
    $login =       "Login";
    $register =   "Register";
    $newposts =   "View New Posts";

    // ---------------
    // Cookies... Yum.
    // ---------------
    ### if you have a prefix on your cookies add it in $_COOKIE['prefix_member_id'];. like that.
    $ibf_member_id  = $_COOKIE['member_id'];  // member name from the cookie.
    $ibf_pass_hash  = $_COOKIE['pass_hash'];  // password encripted from the cookie. using md5();
    $ibf_session_id = $_COOKIE['session_id']; // session id for links and what not.

    // connect to the database
    $link = mysql_connect("$db_host","$db_user","$db_pass") or die("cannot connect");
    mysql_select_db("$database");

    function show_mlist() {
    global $ibf_member_id, $ibf_pass_hash, $ibf_session_id, $members, $groups, $url, $short, $yourcp, $gobyebye, $loggedin, $login, $register, $pm;

    // pm pop-up. new feature of 2.1
    $show_popup = $pm['show_popup'];

    if( $show_popup > 0 ) {

    $query = "UPDATE ".$members." SET show_popup='0' WHERE id='{$pm[name]}' ";
    $result = mysql_query($query) or die("A fatal MySQL error occured. <br />\nQuery: " . $query . "<br />\nError: " . mysql_error());

    $kaboom = <<< EOF
    <script language='JavaScript'>
     <!--
       window.open('".$url."?act=Msg&amp;CODE=99&s={$ibf_session_id}','NewPM','width=500,height=250,resizable=yes,scrollbars=yes');
     //-->
     </script>";  
    EOF;
    }

    $rendered .= $kaboom;

    // Selecting members from the database
    $query = "
    SELECT m.id as id, m.password as password, m.name as name, m.mgroup as mgroup, m.new_msg as new_msg,  m.show_popup  as show_popup, g.g_id as g_id, g.g_is_supmod as g_is_supmod, g.g_access_cp as g_access_cp FROM ".$members." m LEFT join ".$groups." g ON ( g.g_id = m.mgroup) WHERE id='$ibf_member_id'";
    $result = mysql_query($query) or die("
    A fatal mysql error occured. <br />\nQuery: " . $query . "<br />\nError: " . mysql_error());

    $pm = mysql_fetch_array($result);

    // Starting making member bar
    if( isset( $ibf_member_id )  &&  ( $ibf_pass_hash == "
    $pm[password]" ) ){

    // log out link
    $logout = "
    <a href='".$url."?s=$ibf_session_id&amp;act=Login&amp;CODE=03'>".$gobyebye."</a>";

    // moderator control panel link.
    if( $pm[g_is_supmod] == 1 ) {

     $modcp = "
    | <a href='".$url."?act=modcp'>Mod CP</a>";

    }

    // admin control panel link.
    if( $pm[g_access_cp] == 1 ) {

     $admincp = "
    | <a href='".$short."'>Admin CP</a>";

    }

    // the formated look of the end of the logout, admin cp and mod cp. Change the format here if wanted.
    $rendered .=  "
    {$loggedin} <strong><a href='{$url}?showuser={$pm['id']}'>".$pm[name] ."</a></strong> ( {$logout} <strong>{$admincp}{$modcp} </strong>)";

    } else {

    // if not logged in will show this.
    $rendered .=  "
    Welcome <strong>Visitor</strong> <a href='".$url."?act=Login&amp;CODE=00'>Login</a> | <a href='".$url."?&amp;act=Reg&amp;CODE=00'>Register</a>";
    }

    return $rendered;
    }

    ?>

    <!--  // add this section into your page wherever you want the login to be. -->
    <script language='JavaScript'>
       <!--
        function buddy_pop()
        {
             window.open('<?php echo $url ?>?act=buddy&','BrowserBuddy','width=200,height=450,resizable=yes,scrollbars=yes');
        }
       //-->
    </script>

    <div style='padding: 5px; float:left;'>

    <?php
    $show_left = show_mlist();
    echo $show_left;
    ?>

    </div>

    <div style='padding: 5px; float:right;'>

    <?
    // left side of the member bar.
    if  ( isset( $ibf_member_id ) && $ibf_pass_hash == "
    $pm[password]" ) {
    $date = date("
    F d");

    $render = <<<EOF
    <!-- control panel link -->
    <a href="
    $url?s=$ibf_session_id&amp;act=UserCP&amp;CODE=00">$yourcp</a> &middot;

    <!-- new messages thing. -->
    <a href="
    {$url}?s=$ibf_session_id&amp;act=Msg&amp;CODE=01">{$pm['new_msg']} new messages</a> &middot;

    <!-- gets latest post info from your boards. -->
    <a href="
    {$url}?act=Search&amp;CODE=getnew">{$newposts}</a> &middot;

    <!-- My Assistant Link -->
    <a href='javascript:buddy_pop();'>My Assistant</a>
    EOF;

    echo $render;

     }
    ?>
    </div>
    <!-- end of the script. have fun! -->


    Any ideas Shawn?

    Thanks,

    Jason
  • Maybe someone else has a better idea, but just from a brief look: the $_COOKIE superglobal is already populated by the PN cookie when you load your PN site.

    Just for an idea, add this to your theme template:

    Code

    <iframe src="http://www.malibuboatowners.com/memberbar.php"></iframe>


    HTH
    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Maybe someone else has a better idea, but just from a brief look: the $_COOKIE superglobal is already populated by the PN cookie when you load your PN site.

    Just for an idea, add this to your theme template:

    Code

    <iframe src="http://www.malibuboatowners.com/memberbar.php"></iframe>


    HTH
    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Maybe someone else has a better idea, but just from a brief look: the $_COOKIE superglobal is already populated by the PN cookie when you load your PN site.

    Just for an idea, add this to your theme template:

    Code

    [iframe src="http://www.malibuboatowners.com/memberbar.php"][/iframe]


    Of course replace the [ and ] with < and > it wouldn't let me post that for some reason.

    HTH
    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Shawn, thanks for the reply, I hadn't thought of doing that. It's a great work around until I get things figured out.

    Two questions, do I have to use the superglobal to grab the cookie info, or can I define another array?

    Could I get around the interference by using cookie prefixs, or is the array just populated once so it doesn't matter?

    Thanks for helping me out with this!

Go to page [-1] 1 - 2:

  • 0 users

This list is based on users active over the last 60 minutes.