Announcement

Collapse
No announcement yet.

Executing PHP code in vBulletin header

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TechTalk
    replied
    The @ sign before a function simply supresses errors. You would then need to do an "or die("some error here"); if you wanted it do display an error.

    ~Chris

    Leave a comment:


  • Smidge
    replied
    Thanks a lot Ed, i turned php code on, changed the header into php code and it works now :D

    Leave a comment:


  • AaronB
    replied
    How?

    But how does all that information get assigned to $header to be displayed??

    I can't figure how to get all the contents of an include, and includes in that include, to all get assigned to $header so that they aren't above the <html>

    Any thoughts??

    Leave a comment:


  • Mike Sullivan
    replied
    [quote]When everything in the header is php code, why isn't there a "print" or "echo" statement before the other html code then?[/quote]You don't wanr to echo anything out, because it will appear above the <html>. You want to assign everything to $header.

    [quote]I have inserted the code without the <? ?>'s and now it displayed all the code on the page instead of executing it.[/quote]Uhh... duh! It helps if you turn on PHP code executing in the header.

    Leave a comment:


  • Smidge
    replied
    When everything in the header is php code, why isn't there a "print" or "echo" statement before the other html code then?
    I have inserted the code without the <? ?>'s and now it displayed all the code on the page instead of executing it. By the way i don't know what the @'s mean, but the code works fine on all other pages except the forum.

    Leave a comment:


  • Mike Sullivan
    replied
    You don't need the <? and ?> - everything in your header is PHP code.

    Just a little coding suggestion, BTW. I'd use these 2 lines:
    [code]$handler=mysql_pconnect($db_server,$db_username,$db_passwort);
    $dbused = mysql_select_db($db_database,$handler);[/code]I'm not a PHP master - what was the "@" for anyway?

    Leave a comment:


  • Smidge
    replied
    Here is the Code i wanna insert

    <?
    include ("/home/hosted/krawall/dfhq/htdocs/phpdata/useronline/include/dbconf.php3");
    [email protected]_connect($db_server,$db_username,$db_passwort);
    @mysql_select_db($db_database,$handler);
    $zeit = time();
    $ip = getenv(REMOTE_ADDR);
    $file = $PHP_SELF;
    [email protected]_query("INSERT INTO $db_table VALUES ('$zeit','$ip','$file')",$handler);
    @mysql_close();
    ?>

    It's a script that shows the total number of users currently on the site.

    Leave a comment:


  • Mike Sullivan
    replied
    I haven't had any problem with it, but I've only done simple stuff. Could you please post what you're trying to include.

    Oh, and moving to vB Questions I guess...

    Leave a comment:


  • Smidge
    started a topic Executing PHP code in vBulletin header

    Executing PHP code in vBulletin header

    Hello,

    How can i put PHP Code into vBulletin headers? I tried it with different methods, but got no or weird results.

    Thanks in advance!

Related Topics

Collapse

Working...
X