The MU forums have moved to WordPress.org

PHP in my header.php causing signup errors (16 posts)

  1. ex-brief
    Member
    Posted 15 years ago #

    ok, here is the deal. I have a PHP script in my header.php file. the actual script works fine, but it causes the wp-signup.php to be missing the "Full Name" field, so nobody can signup...you get an error if you try.

    I have narrowed it down to the following php code, but I can not seem to figure out how I can include this php script and make this all work...anyone have any clue? thanks/

    THE CODE CAUSING THE ISSUE:

    the part of the code that is BOLD is the problem. the rest of the code is to show you where I have it in the file.

    <body>
    <div id="page">

    <div id="header" onclick="location.href='http://ex-brief.com/';" style="cursor: pointer;">
    <div id="headerimg">
    <h1>

    <?php
    $stats = get_sitestats();
    echo "".$stats[ 'users' ]." Members";
    ?>

    <?php

    $username="*********";
    $password="*********";
    $database="*********";

    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");

    $result = mysql_query("SELECT * FROM contacts");

    $num_rows = mysql_num_rows($result);

    echo $num_rows;

    mysql_close();

    ?>

    ExBriefs
    </h1>
    <div class="description"><?php bloginfo('description'); ?></div>
    </div>

  2. VentureMaker
    Member
    Posted 15 years ago #

    Is your MySQL server really on localhost?

  3. ex-brief
    Member
    Posted 15 years ago #

    it is, the script worked 100% fine until I upgraded from WPMU 2.6 to WPMU 2.7. Thats when this all started. Something in 2.7 is different and does not like the script. Any ideas?

  4. tanvir
    Member
    Posted 15 years ago #

    r u using your application on local server or at any hosting server?

  5. ex-brief
    Member
    Posted 15 years ago #

    check this out, ran error reporting via php....... here is the result AND TO ANSWER YOUR QUESTION I USE site5.com hosting

    Notice: Undefined offset: 0 in /home/exbriefc/public_html/wp-includes/wpmu-functions.php on line 899

    Notice: Trying to get property of non-object in /home/exbriefc/public_html/wp-content/mu-plugins/bp-xprofile/bp-xprofile-classes.php on line 203

    Notice: Undefined index: field_1 in /home/exbriefc/public_html/wp-content/mu-plugins/bp-xprofile/bp-xprofile-signup.php on line 106

    Notice: Trying to get property of non-object in /home/exbriefc/public_html/wp-content/mu-plugins/bp-xprofile/bp-xprofile-classes.php on line 203

    Notice: Trying to get property of non-object in /home/exbriefc/public_html/wp-content/mu-plugins/bp-xprofile/bp-xprofile-classes.php on line 982

  6. ex-brief
    Member
    Posted 15 years ago #

    now I pull the php script that is causing the error out of header.php..... and guess what no errors and you can create an account no issues.

  7. tanvir
    Member
    Posted 15 years ago #

    replace the `localhost' with the host name of your mysql server.

  8. ex-brief
    Member
    Posted 15 years ago #

    thats the hostname I use on all my php scripts and it works fine, and I just asked the support people....they said thats should be fine.

    why would it work the way I have it fine on MU 2.6, but not on MU 2.7????

    the script itself works fine, the script works perfectly. It causes the wp-signup page to be incomplete when its in the header.

  9. tanvir
    Member
    Posted 15 years ago #

    check your VHOST it should assigned false like define('VHOST', 'false');

    check the compatibility issue of the plug-ins both at general & mu plug-in.

    try after disable the plug in.

    it seems you massed around all codes which made the application unstable. why not put all the custom database information in one file & just include the file in every page? in this way it'll be easier for you to make any change.

  10. ex-brief
    Member
    Posted 15 years ago #

    honestly I have done the include of the login info, and it made really no difference. I even ran the php completely in a different file and just included that and that did not work. the host is correct, I triple checked this and even tested other possibilities. the error doesnt happen with buddypress disabled, but its crucial to my site so I need BOTH to work, so need a workaround or something. and this was pretty stable until I upgraded their newly released software which leads me to believe they made a related change that is undocumented. And I need this to appear in the HEADER page, so I cant include it in ALL pages...I have 2 mySQL databases as well. one is for Wordpress, the other is seperate and the one the script calls....its where the custom "briefs" are kept.

  11. shawnkhall
    Member
    Posted 15 years ago #

    In your code is localhost really unquoted? Try quoting it:
    mysql_connect("localhost",$username,$password);

  12. ex-brief
    Member
    Posted 15 years ago #

    ok, i tried that and there is no change, script still functions the same (correctly), but the field for "Full Name" in the signup page is not there still

  13. ex-brief
    Member
    Posted 15 years ago #

    anyone else have any ideas? The help at the buddypress.org board is useless. They get all mad because you asked for help....even though that's what the forum is for...makes sense to me...lol.

  14. ex-brief
    Member
    Posted 15 years ago #

    anyone that can help???

  15. burtadsit
    Member
    Posted 15 years ago #

    We don't get mad at the bp forums. Actually we have been more than patient with your problem over there. You are 'RealFam' there. You started these three topics about this same problem.

    http://buddypress.org/forums/topic.php?id=1197
    http://buddypress.org/forums/topic.php?id=1140
    http://buddypress.org/forums/topic.php?id=1018

    All the above threads moved you through narrowing down the source of the problem. All lead to your code. Not bp. Not wpmu. You had the attention and help from the community, two moderators and the lead developer.

    You don't seem to be paying attention.

  16. andrea_r
    Moderator
    Posted 14 years ago #

    The modlook tag is now on this thread, so they'll see it.

About this Topic

  • Started 15 years ago by ex-brief
  • Latest reply from andrea_r