Jump to content

PHP script in header causing login errors - Wordpress MU 2.7


exbrief

Recommended Posts

I have some php scripts in the header.php file on my WordpresMU 2.7 powered site. These worked fine on Wordpress MU 2.6, but now it is not working on the new version.

 

Basically the script counts the number of entries in one of my databases which translates into the total number of entries created by users. The issue is that the script causes the "Full Name" field on the signup page (wp-signup.php) to disappear and the signup fails. If I remove the script from the header...works perfectly...but I need this information, therefore I need the script, or a modified version.

 

PLEASE HELP ME SOLVE THIS, been trying everything I know and can't figure this out.

 

Here is the full script, the offending script is in the center, it has lines above and below to make it easier to see..

 

>




<?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?>







<?php wp_head(); ?>









<?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

<?php bloginfo('description'); ?>



Link to comment
Share on other sites

Set error reporting to E_ALL to see what the errors are???

Echo the query as a debug tool???

 

Script looks fine, right off the php.net manual.

http://ca2.php.net/mysql-num-rows

 

*edit*

Assumes the connection info is correct... ?

 

 

connection info is right, i used the ***** to block the sensitive info. The code does work fine. Here is how I know its the code causing the error.....

 

Remove code, signup works fine, put the code back in..... Error returns. there is an html form on the signup page, with fields, there is a field called "Full Name"...its there when the script is not in the header, but put the script back inthe header...and tada! the field is missing and you can not create an account. Its something that changed in WPMU 2.7, because the website had no issues before the upgrade. Nobody there seems to know anything about this. Maybe another way to get theis information with a different script? Im a php novice and need a lot of help. thanks.

 

my website is www.ex-brief.com

Edited by exbrief
Link to comment
Share on other sites

the error is not with the PHP....

 

I am running wordpress, the error is on the wordpress side. there is no php error logged, I just did what you said......because the script is fine and php is not the issue here. The issue is that the new WPMU does not like the script for some reason. The error when you sign up is because the signup page is looking for the "Full Name" field but can not find it because the php script in the header.php file is making it disappear.....WTF. This is really a pain in the a$$. Any other ideas?

 

thanks.

 

Here is the error when you try to sign up...see how its looking for the info but not getting it because the "Full Name" field is missing.....

 

Anyone???

 

Warning: Invalid argument supplied for foreach() in /home/exbriefc/public_html/wp-content/mu-plugins/bp-xprofile/bp-xprofile-signup.php on line 104

 

 

ALSO I RAN WHAT YOU SAID AND HERE IS THE RESULT:

 

check this out, ran error reporting via php....... here is the result

 

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

Edited by exbrief
Link to comment
Share on other sites

well, its buddypress that sits on top of Wordpress and takes the info from the wordpress signup page for its own purposes, hence the bp_ prefix. I have been in contact with them....they are clueless. Strange thing is that with buddypress out of the mix the same error is happening with Wordpress...exact same missing field, etc.

 

 

is there some way to run the php script in a seperate file, and output the result somewhere else then use a standard wordpress or buddypress function/filter to call the information from that file so I can not use this code in the header? some type of work around?

Edited by exbrief
Link to comment
Share on other sites

  • 2 weeks later...

Ok so from what i can understand fromt he brief reading it simply misses the name field off when yu put the heder code in but when u remove the header code it comes back yes ? if this is the cae i would be lead to think maybe a missing " or ' to close a echo/query/html output

 

ie .

 

 

would cuae all sorts of errors like that :D

 

hth

Link to comment
Share on other sites

Ok so from what i can understand fromt he brief reading it simply misses the name field off when yu put the heder code in but when u remove the header code it comes back yes ? if this is the cae i would be lead to think maybe a missing " or ' to close a echo/query/html output

 

ie .

 

 

would cuae all sorts of errors like that :D

 

hth

Link to comment
Share on other sites

Ok so from what i can understand fromt he brief reading it simply misses the name field off when yu put the heder code in but when u remove the header code it comes back yes ? if this is the cae i would be lead to think maybe a missing " or ' to close a echo/query/html output

 

ie .

 

 

would cuae all sorts of errors like that :D

 

hth

 

 

could be. I dont think there is any syntax error anywhere, though. I have moved this item so this is nto an issue anymore, I just gave up....became too time consuming.

 

thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...