Description
If you use a form on your site then you'll know that user input can often have white space before or after the text as the person filling in the form field sometimes accidentally adds spaces. This handy function will remove the whitespace from the beginning or end of the string.
The code
====================================================================
class MySQLDB{ /* Class constructor */ function MySQLDB()
{
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
}
function query($query)
{
return mysql_query($query, $this->connection);
}
};
$database = new MySQLDB;
$result = $database->query($query);
$num_rows = mysql_num_rows($result);
$post_title = mysql_result($result,0,"title");
================================================================
get defined variables
echo "
";print_r(get_defined_vars());echo "";
========================================
1) Add this to the top of header.php
2) Add this to the functions.php page
(omit tags if they already exist)
global $bp;
if (bp_is_register_page() bp_is_activation_page())
return;
if(!bp_is_blog_page() && !is_user_logged_in())
{
bp_core_redirect( $bp->root_domain .'/'. BP_REGISTER_SLUG );
}
}
add_action( 'walled_garden', 'sh_walled_garden' );
?>
No comments:
Post a Comment