RE: Avoid object twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04 June 2008 16:03, Yui Hiroaki advised:

> NO!
> That is what I do not want!
> setting.php need to run mail() function.
> also setting.php need $googlemapkey.
> 
> other.php just need $googlemapkey.
> other .php do not need run mail() function.
> 
> If I use "include", I will get twice email.

Same answer as Thijs gave, just with the filenames moved around:

 google_info.php
 <?php
    $googlemapkey = "g8ejeUFEUHEU";// example

    function sendMail() {
        mail("test@xxxxxxxxxxx","test"."test");
    }
 ?>


 setting.php
 <?php
    include "google_info.php";

    sendMail();  // sends mail

    // other stuff using your google API key
 ?>

 other.php
 <?php
   include "google_info.php";

    // use your google API key any way you want
    // ... but no call to sendMail()
 ?>

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux