PHP
From Triangle Wiki
Contents |
Include Path
- Windows include_path = ".;c:\php\includes.;c:\php\library"
- Unix include_path = ".:/php/includes"
Email Validation
- Create a pattern matching function to parse the given email string and look for certain elements that are present in all email addresses to give a good opinion on whether the string is valid or not. Something similar too:
function checkEmail($email){ * @([a-zA-Z0-9_-]) ([a-zA-Z0-9\._-] ) $/", $email)) { return false; } return true; }
- Next it is a good idea to check that the actual domain exists by using the PHP function (Please note that checkdnsrr does not work on a Windows server):
int checkdnsrr (string host [, string type]);
- Simply split the given email string up and use the following code, making sure we are checking the MX DNS record:
list($username, $domain) = split('@', $email);
checkdnsrr($domain, 'MX');
- Next we can try opening a socket to the domain on the standard SMTP port of 25, if the connection is ok then we can assume the domain can accept email, but we still don't know if the user name is valid.
if(!fsockopen($domain, 25, $errno, $errstr, 30)) {
return false;
}
- The last possibly full proof test is to send an email to the email address with a validation code for the user to click and therefore verify their action.
PHP CLI
Usage: php [options] [-f] <file> [--] [args...]
php [options] -r [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -- [args...]
php [options] -a
-a Run interactively -c <path>|<file> Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -f <file> Parse and execute <file>. -h This help -i PHP information -l Syntax check only (lint) -m Show compiled in modules -r <code> Run PHP <code> without using script tags <?..?> -B <begin_code> Run PHP <begin_code> before processing input lines -R <code> Run PHP <code> for every input line -F <file> Parse and execute <file> for every input line -E <end_code> Run PHP <end_code> after processing all input lines -H Hide any passed arguments from external tools. -s Display colour syntax highlighted source. -v Version number -w Display source with stripped comments and whitespace. -z <file> Load Zend extension <file>.
args... Arguments passed to script. Use -- args when first argument
starts with - or script is read from stdin
--rf <name> Show information about function <name>. --rc <name> Show information about class <name>. --re <name> Show information about extension <name>.

