if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// …
}ระบบที่ทดสอบ
PHP: 5
ที่มา:
http://stackoverflow.com/questions/1372147/php-check-whether-a-request-is-get-or-post
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// …
}sudo apt-get install php5-odbc libmdbodbc mdbtools unixodbc-bin[mdbtoolsodbc]
Description = MDB Tools odbc drivers
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage = 1
CPTimeout =
CPReuse =
UsageCount = 1[TestDatabase]
Description = Miscrosoft Access Database of TestDatabase
Driver = mdbtoolsodbc
Database = /home/supasate/desktop/testdatabase.mdb
Servername = localhost
UserName =
Password =
port = 5432if (!($conn = odbc_connect("TestDatabase", "", ""))) {
echo "Connection Falied.";
} else {
echo "Connection Success.";
$query = "SELECT ID, FirstName, LastName From EMPLOYEE";
$result = odbc_exec($conn, $query);
while ($row = odbc_fetch_array($result)) {
print $row['ID'].' '.$row['FirstName'].' '.$row['LastName'].'
';
}php test.phpphp.exe - Unable to Locate Component
This application has failed to start because php_mbstring.dll was not found. Re-installing the application may fix this problem.PHP Warning: PHP Startup: Unable to load dynamic library 'C:\AppServ\php5\ext\php_exif.dll' - The specified module could not be found.
in Unknow on line 0require_once dirname(__FILE__).'/accesscheck.php';
#require( dirname(__FILE__) . '/phpmailer/class.phpmailer.php');
require( dirname(__FILE__) . '/phpmailer_v2.2.1_/class.phpmailer.php');
require( dirname(__FILE__) . '/phpmailer_v2.2.1_/class.smtp.php');...
if (isset($GLOBALS['phpmailer_smtpuser])...
$this->SMTPAuth=true;
$this->SMTPSecure="tls";
$this->Port=$GLOBALS['phpmailer_smtpport'];
$this->Username=$GLOBALS['phpmailer_smtpuser'];
$this->Password=$GLOBALS['phpmailer_smtppassword'];
... if (!$this->Host || $ip == $this->Host) {
$this->Mailer = "mail";
# logEvent('Sending via mail');
} else {
$this->Mailer = "smtp";
# logEvent('Sending via smtp');
} if (!$this->Host) {
$this->Mailer = "mail";
# logEvent('Sending via mail');
} else {
$this->Mailer = "smtp";
$this->IsSMTP();
# logEvent('Sending via smtp');
}...
define("PHPMAILERHOST",'mail.yoursmtpdomain.com');
...
$phpmailer_smtpuser='smtp username';
$phpmailer_smtppassword='smtp password';
$phpmailer_smtpport=25;
...
เป็นอันใช้ได้
ระบบที่ทดสอบ
PHPList: 2.10.5
Web Server: Apache2.2
Database: MySQL5