Memcached-キャッシュ戦略

habrosocietyを迎えたいです。 Habréに登録するときの心地よい印象-これはおとぎ話の雰囲気で、ソビエト映画の古き良き物語でのみ起こります。

それで、優しさの涙は過ぎ去りました。 以下は、Habrへの招待につながったトピックです。



Memcachedはデータのキャッシュに使用されます。 これは、データベースへの不必要な呼び出しを避けるために行われます。 Memcachedはクエリ結果を保存します。 これにより、サイトが高速化され、ページのレンダリングにかかる​​時間が短縮されます。

キャッシュには利点に加えて利点があります。 キャッシュの問題の1つは、その関連性です。 「読み取り専用」操作モードでは、問題はありません。 変更または頻繁に変更されるデータを処理している場合、キャッシュの効率は大幅に低下します。 データが頻繁に変更されるほど、キャッシュの効率は低下します。 通常、キャッシュは最初の変更後にフラッシュされます。 さらに、キャッシュされたすべてのデータはすぐにリセットされます。 リセット後、クエリはデータベースに送られ、キャッシュは新しい方法で補充されます。 別の変更がある場合、キャッシュは再度リセットされます。 memcachedのような良いことはサーバーのパフォーマンスに何の利点ももたらさず、メモリとプロセッサ時間の追加コストも伴うことがしばしばわかります。

この問題を解決する方法の1つは、キャッシュを独立した部分に論理的に分割することです。 キャッシュフラッシュが発生した場合は、変更された部分に対してのみ。



Memcachedバンドルでそのようなアプローチの1つ、データベースを考えてみましょう。



リクエストを論理的に分離すると、どのように何を共有し、どのくらいの頻度で更新するかという問題が生じます。 ここでは、リクエストの目的が異なり、どのリクエストをどのイベントで更新するかが明確ではないため、各リクエストにヒントを与える必要があります。 実装には多大な労力が必要です。私にとって、怠け者のプログラマとしては、これは面白くありません。



すべてのデータベースアクセステーブルを分離しましょう。



いくつかのテーブルにアクセスできるクエリがあるとします。 クエリを実行し、含まれるテーブルを分析し、テーブル内のデータが変更されたかどうかを確認します。 データが変更された場合、リクエストのキャッシュも更新されます。 それは少し複雑に聞こえます、質問が発生します-それをすべて行う方法ですが、最終的に実装は非常に簡単です。



概要に進みます。



*各テーブルには、テーブル内のデータが変更されるたびに変わるカウンターがあります。

*行を削除および挿入するとき、レコードが変更されるとき、これらのカウンターを増やします。

*クエリを実行する前に、影響を受けるテーブルのリストが取得されます。 これらの表から、カウンターの値を見つけます。 これらの値を1行にまとめて、リクエストにコメントとして追加します。



それがこのアプローチのすべての困難です。 新しいキャッシュポリシーに移行するには、コードを少し変更するだけです。 このアプローチを示す例を以下に示します。 この例は完全に独立しており、mysqlおよびmemcache拡張機能をサポートするPHPがある場合に実行できます。

このアプローチにより、データキャッシングの効率が向上します。 キャッシュをリセットすると、変更されたテーブルを参照するデータのみが削除されます。 より具体的には、「キャッシュをフラッシュする」という言葉は意味を失い、変更されたデータにアクセスできなくなり、キャッシュは同じリクエストの新しいキーで満たされ続けます。 キャッシュ全体が頻繁にフラッシュされる「ugい」テーブルがある場合、このようなテーブルは全体像を損なうことはありません。



この方法は実行可能であり、いずれかのサイト( http://www.skachatreferat.ru )でテストされました。 経験から、他のキャッシュ方法を無視すべきではないことが示されています。 5分に1回のリフレッシュレートで関連性が重要ではないデータの場合、特定の期間(この場合は5分)にキャッシュの有効期間を設定して最も単純なキャッシュを使用することをお勧めします。



記事へのアクセスを提供するhabrahabrを使用します。 ここで、各記事はテキストフィールドといくつかの属性のセットです。 テキストはめったに変更されませんが、記事の属性は頻繁に変更されます。 このため、記事のテキストのみをキャッシュに入れるのが理にかなっており、属性はテーブルから独立して選択されます。 その結果、データアクセスの速度は1桁向上します。



選択する列が少ないほど、パフォーマンスが向上します。 MySQLは、TEXTタイプ(記事のテキストを保存する)のカラムよりも桁違いに速い単純タイプのデータを持つカラムで動作します。 これらの機能を使用すると、パフォーマンスが大幅に向上します。



以下は、キャッシュをテーブルに分割する方法を示すスクリプトで、そのソースは約束されています。 このスクリプトは完全に独立しており、追加のモジュールは必要ありません。 スクリプトの最初にmysqlとmemcacheのデータを指定することを忘れないでください:

  1. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  2. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  3. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  4. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  5. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  6. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  7. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  8. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  9. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  10. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  11. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  12. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  13. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  14. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  15. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  16. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  17. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  18. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  19. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  20. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  21. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  22. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  23. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  24. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  25. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  26. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  27. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  28. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  29. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  30. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  31. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  32. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  33. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  34. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  35. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  36. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  37. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  38. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  39. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  40. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  41. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  42. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  43. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  44. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  45. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  46. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  47. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  48. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  49. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  50. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  51. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  52. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  53. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  54. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  55. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  56. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  57. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  58. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  59. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  60. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  61. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  62. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  63. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  64. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  65. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  66. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  67. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  68. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  69. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  70. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  71. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  72. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  73. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  74. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  75. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  76. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  77. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  78. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  79. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  80. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  81. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  82. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  83. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  84. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  85. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  86. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  87. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  88. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  89. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  90. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  91. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  92. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  93. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  94. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  95. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  96. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>



  97. <? header ( 'Content-type: text/html; charset=UTF-8' ) ; $mysql_host = 'localhost' ; $mysql_username = 'root' ; $mysql_password = '12345' ; $mysql_database = 'test' ; // , $mysql_table1 = 'table1' ; $mysql_table2 = 'table2' ; $memcache_host = 'localhost' ; $memcache_port = 11211 ; $mysql = mysql_connect ( $mysql_host , $mysql_username , $mysql_password ) ; if ( ! $mysql ) die ( " MySQL: $mysql_username @ $mysql_host / $mysql_password " ) ; if ( ! mysql_select_db ( $mysql_database ) ) die ( " : $mysql_database " ) ; $memcache = new Memcache ; if ( ! $memcache -> pconnect ( $memcache_host , $memcache_port ) ) die ( "Memcached : $memcache_host : $memcache_port " ) ; function cacheGet ( $key ) { global $memcache ; return $memcache -> get ( $key ) ; } function cacheSet ( $key , $data , $delay ) { global $memcache ; return $memcache -> set ( $key , $data , 0 , $delay ) ; } function sqlExtractTables ( & $query ) { preg_match_all ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , $query , $tables ) ; if ( ! $tables [ 1 ] ) die ( " , '<<table_name>>': $query " ) ; $query = preg_replace ( "/\\<\\<([A-Za-z0-9\\_]+)\\>\\>/" , "\ \1 " , $query ) ; return $tables [ 1 ] ; } function sqlQuery ( $query ) { $resource = mysql_query ( $query ) ; if ( ! $resource ) die ( " : $query <br> " . mysql_error ( ) ) ; echo "<b> :</b> $query <br>" ; return $resource ; } function sqlSet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) cacheSet ( $table , uniqid ( time ( ) , true ) , 24 * 3600 ) ; return sqlQuery ( $query ) ; } function sqlGet ( $query ) { $tables = sqlExtractTables ( $query ) ; foreach ( $tables as $table ) $appendix .= cacheGet ( $table ) ; $appendix = "/*" . md5 ( $appendix ) . "*/" ; $query = $query . $appendix ; $cache_key = md5 ( $query ) ; $result = cacheGet ( $cache_key ) ; if ( $result !== false ) { echo "<b> :</b> $query <br>" ; return $result ; } else echo "<b> :</b> $query <br>" ; $resource = sqlQuery ( $query ) ; $result = array ( ) ; while ( $row = mysql_fetch_assoc ( $resource ) ) { $result [ ] = $row ; } cacheSet ( $cache_key , $result , 3600 ) ; return $result ; } ?> <h2>. </h2> <h3> 2 </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; // "select * from <<$mysql_table1>> where id=1", ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3> </h3> <? sqlSet ( "delete from << $mysql_table2 >> where 1=0" ) ; ?> <h3> </h3> <? sqlGet ( "select * from << $mysql_table1 >> limit 1" ) ; ?> <br> <? sqlGet ( "select * from << $mysql_table2 >> limit 1" ) ; ?> <h3>: , . </h3>









ソースはこちら: www.skachatreferat.ru/demo.txt



All Articles