2008年CSS裸体日 俺博客自动脱光光 适用于各种PHP Blog

今年的CSS Naked Day与往年推后了四天(4月9日)..

有些朋友已经迫不及待要让自己的网站裸奔了..

俺太懒.写几行代码.让俺的博客到时自己脱光光吧..

俺用的wordpress 同样适用于其它php博客

只需要css引用语句处加上如下代码:

  1. <?php 
  2. $NakedDay = date('md',time());//获得当前时间.用date函数格式化unix时间戳.
  3. if($NakedDay != '0409')//判断当前日期.如果为0409就不执行
  4. {
  5. ?>
  6. <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />//俺博客的样式表..
  7. <?php 
  8. }
  9. ?>

setcookie函数的作用域问题

在不同目录下的文件.不能访问各自设置的cookie

查了一下手册.setcookie函数有一个path参数.可以设置本地cookie的作用域

解释如下:

The path on the server in which the cookie will be available on. If set to ‘/’, the cookie will be available within the entire domain . If set to ‘/foo/’, the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.

另一个参数domain
则是设置网络上cookie的作用域.

解释如下:

The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you’d set it to ‘.example.com’. The . is not required but makes it compatible with more browsers. Setting it to www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the » spec for details.

示例:

  1. $setcookday = 30;//设置cookie有效期
  2. setcookie('uname', '银子', time() + ($setcookday * 24 * 60 * 60),'/','qqdang.net'); //分别为cookie名称.cookie值.cookie有效时间.cookie本地作用域.cookie网络作用域

Discuz的install文件核心函数

可以将自己写的程序做一个install.php.
Discuz的install文件中的核心函数,相当精简..

  1. <?php
  2. require("connect.inc.php");
  3. $sqlfile = 'test.sql';//sql文件
  4.  
  5. $fp = fopen($sqlfile, 'rb');
  6. $filesize=filesize($sqlfile);
  7. $sql = fread($fp, $filesize);
  8. fclose($fp);
  9. runquery($sql);
  10.  
  11. function runquery($sql) {
  12.     global $lang, $dbcharset, $tablepre, $db;
  13.  
  14.     $sql = str_replace("\r", "\n", str_replace(' cdb_', ' '.$tablepre, $sql));
  15.     $ret = array();
  16.     $num = 0;
  17.     foreach(explode(";\n", trim($sql)) as $query) {
  18.         $queries = explode("\n", trim($query));
  19.         foreach($queries as $query) {
  20.             $ret[$num] .= $query[0] == '#' || $query[0].$query[1] == '--' ? '' : $query;
  21.         }
  22.         $num++;
  23.     }
  24.     unset($sql);
  25.  
  26.     foreach($ret as $query) {
  27.         $query = trim($query);
  28.         if($query) {
  29.             if(substr($query, 0, 12) == 'CREATE TABLE') {
  30.                 $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
  31.                 echo $lang['create_table'].' '.$name.' ... <font color="#0000EE">'.$lang['succeed'].'</font><br>';
  32.                 mysql_query(createtable($query, $dbcharset));
  33.             } else {
  34.                 mysql_query($query);
  35.             }
  36.         }
  37.     }
  38. }
  39. ?>

(备忘)MySQL字段类型

MySQL支持大量的列类型,它可以被分为3类:数字类型、日期和时间类型以及字符串(字符)类型。本节首先给出可用类型的一个概述,并且总结每个列类型的存储需求,然后提供每个类中的类型性质的更详细的描述。概述有意简化,更详细的说明应该考虑到有关特定列类型的附加信息,例如你能为其指定值的允许格式。

由MySQL支持的列类型列在下面。下列代码字母用于描述中:

 

M
指出最大的显示尺寸。最大的合法的显示尺寸是 255 。
D
适用于浮点类型并且指出跟随在十进制小数点后的数码的数量。最大可能的值是30,但是应该不大于M-2。
方括号(“[”和“]”)指出可选的类型修饰符的部分。

注意,如果你指定一个了为ZEROFILL,MySQL将为该列自动地增加UNSIGNED属性。

全文阅读 »

Internet Explorer 8 Beta 1 发布

Internet Explorer 8 can be installed on Microsoft Windows Vista® Service Pack 1 (SP1), Windows Vista, Windows XP® Service Pack 2 (SP2), Windows Server® 2008 and Windows Server 2003 Service Pack 2 (SP2).

能安装在vista,2008server,winXP SP2与2003 SP2上

不敢安装..怕折腾系统..^_^

M$总算知耻而后勇..

P.S.标准化的同学们..又要头大了吧.

Internet Explorer 8 Beta 1 下载页面 http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/Install.htm

浏览最多的10篇日志

评论最多的10篇日志

随机显示的10篇日志