Drupal - PHP code inside post!

Believe it or not it takes 3 months for me to figure out how to make this things out!
Basically Drupal CMS allow us to put PHP code inside every admin post. Posting code below will output exactly as file with .php extension using
eval() function.

<?php

phpinfo();
?>
The results will output phpinfo() information on the posted articles… of course you may use another functions like date(), strtoupper() or what ever. The great things was we also could execute SQL command trough any post. See the sample code below…

<?php

$array = db_fetch_array(db_query('SELECT * FROM {system}'));

print_r($array);
?>

will return


Array ( [filename] => modules/block.module [name] => block [type] => module [description] => Controls the boxes that are displayed around the main content. [status] => 1 [throttle] => 0 [bootstrap] => 0 [schema_version] => 0 [weight] => 0 )

With a little more extended idea you might easily post dynamically post that query probably the most hot topic on your Drupal system.

Tags: , ,
Read this also:
  • Drupal headache…
  • What Joel Comm Never Told You - AdSense Multi-Millionaire websites revealed!
  • How to completely remove “Ads by Google” in AdSense Ads
  • WordPress xmlrpc returned 404 error, fixed
  • The Ultimate WordPress User Contributed Tips & Plug-in’s
  • 3 Responses to “Drupal - PHP code inside post!”


    1. 1 ramzwatcher

      hum? actually i dont understand what you want to do. you want to create a password post or want to include php script in the post?

    2. 2 tqmz

      What I mean is how to include() or run PHP codes inside each Drupal post … not just limited to pasword prtotection.

      I believe Drupal was among the most extendable CMS available. The problem is, learning Drupal codes structure. Even Googling their online manual my questions keeps unsolved. I have not read inside their manual yet.

      Whats I’m working on now with Drupal is to create a costom main page.

    3. 3 Alex

      Thank You

    Leave a Reply




    Simple ways making money (online)


    Checkout Joel Comm the latest eBook who made $29K/month in AdSense.   


    Free eBook written by probloggers. Get Chitika Free eBook Now!

    Simple ways making money (online)

    Google AdSense: Simple ways earning income from your websites and blogs. Blog for your side income! .

    Runs a small shop in your blog / website by adding a few scripts! register for Chitika eMiniMalls now.

    Agloco: Advertisers, search providers and online retailers are paying billions to reach you while you surf. You heard it, a get paid surf bar has just came back. Sign up Agloco now.

    Must Installed Softwares!

    Mozilla Firefox : Browse website faster & safer

    Google Essential Pack: Trust to Google, they have prepared what you need.



    Link Exchange
      Directory

    Close
    E-mail It