PHP 使用条件WHERE部分进行SELECT

$selsearch =	'
SELECT 
	Uni,Prof,Bearbeiter,Jahr,Semester,ID,Thema,status
FROM 
	Habilitation 
	WHERE 1 ';
	
if ( strlen($_GET["uni"])>0 ) { $selsearch	.= ' AND Uni LIKE "'.$_GET["uni"].'%" '; }
if ( strlen($_GET["jahr"])>0 ) { $selsearch	.= ' AND jahr LIKE "'.$_GET["jahr"].'%" '; }
if ( strlen($_GET["thema"])>0 ) { $selsearch	.= ' AND Thema LIKE "%'.$_GET["thema"].'%" '; }

$selsearch .=	' ORDER BY '.$o.' LIMIT '.$posSelect.','.$perpage;

PHP C 14¾åœ¨æ™,A»ã,'出åŠ>的ΔΣ™ã,<

&lt;?php
	echo date(&quot;g:i:s a&quot;);
?&gt;

PHP cakephp有奇怪的会话问题

First visit. No session, no cookies so far.

$_COOKIE: 
Array()

$_SESSION: 
Array
(
    [Config] =&gt; Array
        (
            [rand] =&gt; 2031703447
            [time] =&gt; 1166640164
            [userAgent] =&gt; 05c06381cba0c03d1fda664faf636fab
        )

)

SID: WEGNERDE=4068f91034bca9992f4e86fb555b3997

sessioncomponent Object
(
    [_log] =&gt; 
    [CakeSession] =&gt; cakesession Object
        (
            [_log] =&gt; 
            [valid] =&gt; 1
            [error] =&gt; Array
                (
                    [2] =&gt; Config doesn't exist
                    [1] =&gt; Session is valid
                )

            [_userAgent] =&gt; 05c06381cba0c03d1fda664faf636fab
            [path] =&gt; /index.php/
            [lastError] =&gt; 1
            [security] =&gt; high
            [time] =&gt; 1166638964
            [sessionTime] =&gt; 1166640164
            [host] =&gt; www.[snip].de
            [cookieLifeTime] =&gt; 0
        )

    [base] =&gt; /index.php
    [webroot] =&gt; /wegner/webroot/
    [here] =&gt; /index.php/nodes/view/18
    [params] =&gt; Array
        (
            [controller] =&gt; nodes
            [action] =&gt; view
            [pass] =&gt; Array
                (
                    [0] =&gt; 18
                )

            [form] =&gt; Array
                (
                )

            [url] =&gt; Array
                (
                    [url] =&gt; /nodes/view/18
                )

            [bare] =&gt; 0
            [webservices] =&gt; 
            [plugin] =&gt; 
        )

    [action] =&gt; view
    [data] =&gt; 
    [plugin] =&gt; 
)

DB:
select '4068f91034bca9992f4e86fb555b3997', zero results
insert row with id '4068f91034bca9992f4e86fb555b3997'

===================
Second page visit
===================

$_COOKIE:
Array
(
    [WEGNERDE] =&gt; 4068f91034bca9992f4e86fb555b3997
)

$_SESSION:
Array
(
    [Config] =&gt; Array
        (
            [rand] =&gt; 724195738
            [time] =&gt; 1166640598
            [userAgent] =&gt; 05c06381cba0c03d1fda664faf636fab
        )

)

SID: (empty)

sessioncomponent Object
(
    [_log] =&gt; 
    [CakeSession] =&gt; cakesession Object
        (
            [_log] =&gt; 
            [valid] =&gt; 1
            [error] =&gt; Array
                (
                    [2] =&gt; Config doesn't exist
                    [1] =&gt; Session is valid
                )

            [_userAgent] =&gt; 05c06381cba0c03d1fda664faf636fab
            [path] =&gt; /index.php/
            [lastError] =&gt; 1
            [security] =&gt; high
            [time] =&gt; 1166639398
            [sessionTime] =&gt; 1166640598
            [host] =&gt; www.[snip].de
            [cookieLifeTime] =&gt; 0
        )

    [base] =&gt; /index.php
    [webroot] =&gt; /wegner/webroot/
    [here] =&gt; /index.php/users/login
    [params] =&gt; Array
        (
            [controller] =&gt; users
            [action] =&gt; login
            [form] =&gt; Array
                (
                )

            [url] =&gt; Array
                (
                    [url] =&gt; /users/login
                )

            [bare] =&gt; 0
            [webservices] =&gt; 
            [plugin] =&gt; 
        )

    [action] =&gt; login
    [data] =&gt; 
    [plugin] =&gt; 
)


DB:
select id 'c2042ca664205240f5e327762e615d72', 0 results
insert new row with id = c2042ca664205240f5e327762e615d72

PHP 约会时间

date (&quot;Y-m-d H:i&quot;)

PHP 回声HTML块

echo &lt;&lt;&lt;EOT

&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.&lt;/p&gt;

EOT;

PHP 当前页面

$_SERVER['PHP_SELF']

PHP 内容类型text / plain

header(&quot;Content-type: text/plain&quot;);

PHP 重定向

header(&quot;Location: index.php&quot;);

PHP 用链接替换URL

$text = ereg_replace(&quot;[[:alpha:]]+://[^&lt;&gt;[:space:]]+[[:alnum:]/]&quot;, &quot;&lt;a href=\&quot;\\0\&quot;&gt;\\0&lt;/a&gt;&quot;, $text);

PHP PHP - Limpiarinyecciónsql

//mysqli_xxx
function inSql($value){
	global $conn;
	if( get_magic_quotes_gpc() ) $value = stripslashes( $value );
	$value = mysqli_real_escape_string( $conn, $value );
	return $value;
}
#echo inSql(&quot;testeando '&quot;); 

//mysql_xxx
function inSql($value){
	global $conn;
	if( get_magic_quotes_gpc() ) $value = stripslashes( $value );
	$value = mysql_real_escape_string( $value );
	return $value;
}
#echo inSql(&quot;testeando '&quot;);

#Diferentes versiones de php:
function inSql ($string) {
   global $conn,
   if(version_compare(phpversion(),&quot;4.3.0&quot;)==&quot;-1&quot;) {
     mysql_escape_string($string);
   } elseif ($conn) {
     mysql_real_escape_string($string,$conn);
   } else { return false; }
}