Fork me on GitHub

Watch

GitHub Core

Show your support for Zikula! Sign up at Github account and watch the Core project!




GitHub Modules

Forum Activity

Forum feed

» Visit forum | » View latest posts

PHP in blocks... I need help please  Bottom

  • Alright everyone, I need help. I have postnuke (new version) and I cant do any PHP in a block. I tried using the PHP block type, and the HTML block type and it does not work. here is the code:

    Code

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

    <table width="100%" border="0" cellspacing="0" cellpadding="5">
                  <tr>
                    <td width="50%">
                      <?php

    // Selecting members from the database
        $sql_pm = mysql_query("SELECT * FROM `ibf_members` WHERE id='$ibf_member_id'") or die('cannot get members');
            $pm = mysql_fetch_array($sql_pm);

    // getting group info for admin and moderator links.
        $sql_group = mysql_query("SELECT * FROM `ibf_groups` WHERE g_id='$pm[mgroup]'") or die('cannot get groups');
            $group = mysql_fetch_array($sql_group);

    // 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($group[g_is_supmod] == 1)
                    {
                    $modcp = " | <a href=\"$url?&amp;act=modcp\">Mod CP</a>";
                    };
        // admin control panel link.
        if($group[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.
            echo"$loggedin: <b>$pm[name]</b> ( $logout<b>$admincp$modcp </b>)";
        } else {
            // if not logged in will show this.
            echo "Welcome <b>Visitor</b> <a href=\"$url?act=Login&amp;CODE=00\">Login</a> | <a href=\"$url?&amp;act=Reg&amp;CODE=00\">Register</a>";
        };


    // pm pop-up. new feature of 2.1
    $show_popup = $pm['show_popup'];
       
    if($show_popup > 0)

        {

        $query = "UPDATE ibf_members SET show_popup='0' WHERE id='{$ibf_member_id}' ";
        $result = mysql_query($query);

        echo "<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>"
    ;

         };
            
    ?>
                    </td>
                    <td width="50%" align="right">
                      <?php
    // left side of the member bar.
    if (isset($ibf_member_id) AND $ibf_pass_hash == "$pm[password]")
    {
       echo "
        <!-- control panel link -->
        <a href=\"$url?s=$ibf_session_id&act=UserCP&CODE=00\">$yourcp</a> /
        <!-- new messages thing. -->
        <a href=\"$url?s=$ibf_session_id&act=Msg&CODE=01\">{$pm['new_msg']} new messages</a> /
        <!-- My Assistant Link -->
        <a href='javascript:buddy_pop();'>My Assistant</a> /
        <!-- gets latest post info from your boards. -->
        <a href=\"$url?&act=Search&CODE=getnew\">"
    .date("F d")."</a>";
       }
       else
       {
         // shows the date.
         echo "Today Is ".date("F d");
       }

    ?>
                    </td>
                  </tr>
                </table>
    <!-- end of the script. have fun! -->


    Go to DSMCentral.com/news to see what it does.

    If I put the code in a test.php and call it, it works fine. Ohh I also had put the code...

    Code

    <?
    // Variables
    $ibf_members = "ibf_members";   // Name of the table where your members are
    $url = "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 = "user";      // mySQL database "USER"
    $db_pass = "pass";      // mySQL database "PASS"
    $database = "ibf_database";     // mySQL "DATABASE" name

    // langugage variables
    // no need to change these.        
    $yourcp = "Your CP";
    $gobyebye = "Go ByeBye";
    $loggedin = "Logged In As:";
    $login = "Login";
    $register = "Register";

    // ---------------
    // 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 Village. w00t. lol.
    $link = mysql_connect("$db_host","$db_user","$db_pass") or die("cannot connect");
    mysql_select_db("$database");

    // Get those nasty villagers!
    $sql_pm = mysql_query("SELECT * FROM `ibf_members` WHERE id='$ibf_member_id'") or print mysql_error();
    $pm = mysql_fetch_array($sql_pm)
    ?>


    that is supposed to be at the top of the page in the theme.php. I also tried the header.php file in the postnuke directory. can some one please help me out?
  • if you can put the code in test.php why not try and use the file include? not that i have ever used that block lol

    anyway, when using the PHP block you dont need to put PHP tags in, but i dont know how it would handle another scripting language in the block, also in the HTML block, you dont need the and tags

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • I will try the file include and hope that works. Does anybody now how to do the file include. Man I really wish this could work!!!

    I tried including the file test111.php and it gives me the error of:

    Code

    file: http://www.dsmcentral.com/test111.php does not exist.


    So I think it may just be something with PHP files so I try including a Pic (header.gif that is in the theme for Post nuke) and it tells me:

    Code

    file: http://www.dsmcentral.com/news/themes/Pixame_Group/images/header.gif does not exist.


    Now what???

    Ohh and both do exist!!!
  • Okay never mind if I put

    Code

    ../test111.php
    it will bring up the file word for word like a word doc. it does not process it like a PHP file. It shows my passwords to my DB so I can not leave it up. waht should I do now?
  • I am still trying to find the problem. I try making the most simple PHP script

    Code

    <html>
    <body>

      <?php

      print ("I am the CHICKEN MAN");

      ?>

    </body>
    </html>

    in test.php and once again this works fine when you type DSMCentral.com/test.php. but if you try and pull it up in "simple file include" it gives me:

    Code

    print ("I am the CHICKEN MAN");

      ?>
    . GRRR I need some help then. I will try a few other things and will come back to look at this. I have a few ideas. but if anybody knows what I am doing wrong, please help a brother in need out!!!!!!
  • Okay I did a "simple file include" and it did not work. If I use the PHP block and type in "include("http://dsmcentral.com/test111.php");" It will at least proccess the PHP, but is always tells me the I am a visitor. GRRR. can someone help???

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