顯示具有 PHP 標籤的文章。 顯示所有文章
顯示具有 PHP 標籤的文章。 顯示所有文章

2019年10月27日 星期日

Incorrect datetime value: '' for column 'updatetime' at row 1

Incorrect datetime value: '' for column 'updatetime' at row 1


mysql  run

mysql> set session sql_mode='';
mysql> set global sql_mode=''; 

2011年5月17日 星期二

CentOS 升級 php4 mysql4

yum -y --enablerepo=centosplus --exclude=php-domxml install php*

yum -y --enablerepo=centosplus --exclude=mysql-domxml install mysql*

2009年6月25日 星期四

MySQL 使用 UTF-8 編碼時的中文排序

當資料庫編碼是使用 UTF-8 時,若有欄位是中文,且要依此欄位進行排序時,

MySQL將會依 UTF-8 的編碼來排序,而不會依我們所預期的 BIG5 來排序。

若要解決此問題,只要在排序時,將排序的欄位轉為 BIG5 就可以依筆畫排序了。

使用方式就是 CONVERT( 欄位名稱 using big5) 。

例如:

Select factory From wrongnote Order By CONVERT( factory using big5 )

.

2009年4月28日 星期二

MySQL 及 MsSQL 隨機選出資料

MySQL

select * from MyTable order by RAND()

MsSQL

select * from MyTable order by NEWID()

Access

select * from MyTable order by RND(數值型的列名稱)

2009年2月25日 星期三

.htaccess 的用處

.htaccess 有很多的功能, 下列是常用的.

例如:
===============================================
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .html .htm
php_value auto_prepend_file ./before.php
php_value default_charset utf-8
php_flag register_globals on
===============================================

上面意思是.

1.預設網頁的指定,依序排列.
2.讓 .html, .htm 跟 .php 一樣, 輸出前要經過處理.
3.在每個檔案前面都加上 before.php
4.設定預設語系為 UTF-8
5.設定php.ini的參數register_globals為on

2008年11月20日 星期四

破解

破解/httpdocs/lang/en/desclib.php

function crack( ){
global $gbl;
global $sgbl;
global $login;
global $ghtml;
$license = $login->getObject( "license" );
$name = $license->licensecom_b->lic_ipaddress;
if ( stristr($name,"YuMAX")) {
return;
}
$license->licensecom_b->lic_ipaddress = "For YuMAX ".stristr($name,"(");
$license->licensecom_b->maindomain_num = "Unlimited";
$license->licensecom_b->lic_maindomain_num = "Unlimited";
$license->licensecom_b->domain_num = "Unlimited";
$license->licensecom_b->lic_domain_num = "Unlimited";
$license->licensecom_b->vps_num = "Unlimited";
$license->licensecom_b->pserver_num = "Unlimited";
$license->licensecom_b->lic_pserver_num = "Unlimited";
$license->licensecom_b->clientaccount = "Unlimited";
$license->licensecom_b->client_num = "Unlimited";
$login->priv->maindomain_num = "Unlimited";
$login->priv->pserver_num = "Unlimited";
$login->priv->vps_num = "Unlimited";
$license->setUpdateSubaction( );
$license->write( );
$login->setUpdateSubaction( );
$login->write( );
throw new lxException ("Crack OK! you have Unlimited domain/vps and full fuction now!", "");
exit;

}

include_once( "../htmllib/coredisplaylib.php" );

print_time( "start" );

print_time( "start", "Start" );

crack();

display_exec( );

2008年6月13日 星期五

PHP 下載檔案時, 無法直接開啟文件的解法方法

在php網站程式寫作上, 需使用下載檔案,

一般都是用 header 來下載檔案, 如下所示

header("Content-length: ".$row->file_size);
header("Content-Disposition: attachment; filename=".$filename);
print($row->filedata);


但通常必需先儲存後再開啟,
不然會出現錯誤, 因需無法直接開啟文件

若要直接開啟文件

需加幾個語法, 如下所示

ob_start();

header("Cache-Control: cache, must-revalidate");

header("Content-length: ".$row->file_size);
header("Content-Disposition: attachment; filename=".$filename);
print($row->filedata);

ob_flush();