PHPstuff

HomePage | RecentChanges | Preferences | Costa Rica Wiki

PHP and Cron and using PHP from the CommandLine

Writing user defined functions in PHP short tutorial http://builder.com.com/5100-6371-1045063.html

great php faq http://forums.devshed.com/showthread.php?s=4db19606b54587733de0cd33a003ab85&threadid=25412&highlight=undefined+variable

very nice looking 2 page tutorail http://www.onlamp.com/pub/a/onlamp/2002/04/04/webdb.html

article on error reporting in php http://www.devnewz.com/2003/0114.html

the PHP FAQ's page http://www.faqts.com/knowledge_base/index.phtml/fid/51/

Big PHP site http://php.resourceindex.com/

PHP on PHP http://www.php.net/links.php

Get to Amazon via PHP and SOAP http://www.onlamp.com/pub/a/php/2003/07/03/php_amazon_soap.html

Simple get to Amazon with REST and PHP (better) http://www.onlamp.com/pub/a/php/2003/10/30/amazon_rest.html

sources for scripts

You can find lots of information about PHP as well as free code samples, code galleries, and free scripts for download at these and other sites:

http://www.phpbuilder.com/snippet/

http://phpwizard.net/

http://www.devshed.com/Server_Side/PHP

http://www.phpclasses.org/

http://px.sklar.com/

http://zend.com/codex.php

http://www.weberdev.com/

http://www.hotscripts.com/PHP/

http://www.phpresourceindex.com/

undefined variables

change error reporting

PHP:

error_reporting (E_ALL ^ E_NOTICE );

It's just a notice so not a major error. Or you can predefine your variables: $a = '';

Added stuff on using auto_prepepend


SitePoint? Community Forums > Program Your Site > General Development Issues > .htaccess auto append/prepend


Click here for full thread: .htaccess auto append/prepend


Devilware.netHi all,

I'm setting up an .htaccess file containing the following directives:

php_value auto_prepend_file /path/prepend.php
php_value auto_append_file /path/prepend.php


However I would like to set up certain directories which do not automatically append/prepend these files.

I'm sure there's a directive I can use to make exceptions - but how?

Thanks in advance images/smilies/smile.gif

-Sam


Codename49 Place another .htaccess in those sub directories with the prepend/append values set to some empty file.


pippo Place another .htaccess in those sub directories with the prepend/append values set to some empty file.

Better than that use:

/certain/subdir/.htaccess

php_value auto_prepend_file none
php_value auto_append_file none



Thanks,

) Andrea

Devilware.netThanks Andrea!

 
Wasn't aware this was possible :)
 

-Sam


pippo Me neither :p,
I was looking at the C-source code of mod_php for other things and I noticed that :).


I use microtime() for doing PHP benchmarking.

$start = microtime();
... code goes here ..
$end = microtime();
echo "Blah took " . ($end - $start);

another version from wordpress

// functions to count the page generation time (from phpBB2)
// ( or just any time between timer_start() and timer_stop() )

function timer_start() {
    global $timestart;
    $mtime = microtime();
    $mtime = explode(" ",$mtime);
    $mtime = $mtime[1] + $mtime[0];
    $timestart = $mtime;
    return true;
}

function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), will echo $timetotal
    global $timestart,$timeend;
    $mtime = microtime();
    $mtime = explode(" ",$mtime);
    $mtime = $mtime[1] + $mtime[0];
    $timeend = $mtime;
    $timetotal = $timeend-$timestart;
    if ($display)
        echo number_format($timetotal,$precision);
    return $timetotal;
}

magic quotes

Here is a small piece of code to be placed at the beginning of each one of your scripts which will simulate magic_quote_gpc=OFF, i.e. no \ added in front of special characters in form fields.

<?php
if ((get_magic_quotes_gpc() == 1){ 
    switch ($REQUEST_METHOD)
    { 
        case "POST": 
        while (list ($key, $val) = each ($HTTP_POST_VARS)){ 
            $$key = stripslashes($val); 
        } 
        break; 

case "GET": while (list ($key, $val) = each ($HTTP_GET_VARS)){ $$key = stripslashes($val); } break; } } ?>


HomePage | RecentChanges | Preferences | Costa Rica Wiki
This page is read-only | View other revisions
Last edited July 15, 2004 10:38 pm (diff)
Search: