CentOS通过yum升级php到5.2的方法

vim /etc/yum.repos.d/utterramblings.repo

输入

[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

最后

yum update php -y

发表在 服务器 | 标签为 , , , | 留下评论

centos下查看主板信息的方法

第一步、要安装dmidecode这个包才能查询主板信息。如下:

[root@localhost ~]# yum install dmidecode

Loaded plugins: fastestmirror

Determining fastest mirrors

* base: mirrors.163.com

* extras: mirrors.163.com

* updates: mirrors.163.com

base | 3.7 kB 00:00

extras | 3.5 kB 00:00

extras/primary_db | 23 kB 00:00

updates | 3.5 kB 00:00

updates/primary_db | 4.6 MB 00:02

Setting up Install Process

Resolving Dependencies

–> Running transaction check

—> Package dmidecode.x86_64 1:2.11-2.el6 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

dmidecode x86_64 1:2.11-2.el6 base 71 k

Transaction Summary

================================================================================

Install 1 Package(s)

Total download size: 71 k

Installed size: 188 k

Is this ok [y/N]:

Exiting on user Command

[root@localhost ~]# dmidecode |more

-bash: dmidecode: command not found

[root@localhost ~]# yum install dmidecode

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* extras: mirrors.163.com

* updates: mirrors.163.com

Setting up Install Process

Resolving Dependencies

–> Running transaction check

—> Package dmidecode.x86_64 1:2.11-2.el6 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

dmidecode x86_64 1:2.11-2.el6 base 71 k

Transaction Summary

================================================================================

Install 1 Package(s)

Total download size: 71 k

Installed size: 188 k

Is this ok [y/N]: y

Downloading Packages:

dmidecode-2.11-2.el6.x86_64.rpm | 71 kB 00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : 1:dmidecode-2.11-2.el6.x86_64 1/1

Verifying : 1:dmidecode-2.11-2.el6.x86_64 1/1

Installed:

dmidecode.x86_64 1:2.11-2.el6

Complete!

第二步,dmidecode|more查询

[root@www.ctohome.com]# dmidecode|more

# dmidecode 2.10
SMBIOS 2.4 present.
57 structures occupying 2318 bytes.
Table at 0x000E84B0.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Intel Corp.
Version: GTG4310H.86A.0019.2009.0625.1334
Release Date: 06/25/2009

…..

System Information 服务器品牌
Manufacturer:
Product Name: (没有信息表示非品牌或未识别)
Version:
Serial Number:
UUID: 889BD67E-8D96-11DE-AC40-0013D4D9C9E8
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information 主板型号/主板信息
Manufacturer: Intel Corporation
Product Name: DG43GT
Version: AAE62768-300
Serial Number: BTGT9340022N

Processor Information CPU信息/CPU型号/CPU主频
Socket Designation: PROCESSOR
Type: Central Processor
Family: Pentium D
Manufacturer: Intel(R) Corp.
ID: 7A 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 10
Version: Pentium(R) Dual-Core CPU E6500 @ 2.93GHz
Voltage: 1.2 V
External Clock: 266 MHz
Max Speed: 4000 MHz
Current Speed: 2931 MHz
Status: Populated, Enabled
Upgrade: Socket LGA775

Cache Information 硬件和CPU缓存情况
Socket Designation: L1-Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 32 kB
Maximum Size: 32 kB

BIOS Language Information BIOS语言
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1

Physical Memory Array 主板最大支持内存
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 16 GB
Error Information Handle: Not Provided
Number Of Devices: 4

Handle 0x002C, DMI type 19, 15 bytes
Memory Array Mapped Address 目前的内存
Starting Address: 0x00000000000
Ending Address: 0x000FFFFFFFF
Range Size: 4 GB
Physical Array Handle: 0x002B
Partition Width: 0

On Board Device Information 显卡型号
Type: Video
Status: Enabled
Description: Intelr GMA X4500 Video Device

发表在 服务器 | 标签为 | 留下评论

[原创]phpcms v9 点击排行榜PC标签无法分页解决

今天想实现hits标签分页,结果无法显示,经过查找发现只要简单修改源码即可。

\phpcms\modules\content\classes\content_tag.class.php

在该标签处理文件中由于函数count限制了只有lists才能统计,导致分页的时候获取不了数量而没有显示分页。

/**
* 分页统计
* @param $data
*/
public function count($data) {
if($data[‘action’] == ‘lists’ || $data[‘action’] == ‘hits’) {//点击排行榜也能有分页 修改成这样即可
// if($data[‘action’] == ‘lists’) {
$catid = intval($data[‘catid’]);
if(!$this->set_modelid($catid)) return false;
if(isset($data[‘where’])) {
$sql = $data[‘where’];
} else {
if($this->category[$catid][‘child’]) {
$catids_str = $this->category[$catid][‘arrchildid’];
$pos = strpos($catids_str,’,’)+1;
$catids_str = substr($catids_str, $pos);
$sql = “status=99 AND catid IN ($catids_str)”;
} else {
$sql = “status=99 AND catid=’$catid'”;
}
}
return $this->db->count($sql);
}
}

希望对你有帮助,有什么问题可留言

发表在 开源代码 | 标签为 , , , | 留下评论

WordPress使用suffusion主题修改优化title的方法

我们可以看看运行机制是:

首先是在模板路径:\wp-content\themes\suffusion\header.php 头文件运行了suffusion_document_header(); 函数

该函数是在:\wp-content\themes\suffusion\functions.php

开头注册运行的了,其顺序是:
suffusion_theme_setup > suffusion_setup_custom_actions_and_filters(); > add_action(‘suffusion_document_header’, ‘suffusion_set_title’);

接着看’suffusion_set_title’是什么函数,在\wp-content\themes\suffusion\functions\actions.php  该函数运行了一个wp_title 系统函数

wp_title函数在在系统文件\wp-includes\general-template.php中,该函数最终运行了一个 $title = apply_filters(‘wp_title’, $title, $sep, $seplocation); 过滤器

而这个过滤器在\wp-content\themes\suffusion\functions.php文件中suffusion_setup_standard_actions_and_filters中已经注册的了

add_filter(‘wp_title’, ‘suffusion_modify_title’, 10, 3);//所以运行wp_title的时候会触发’suffusion_modify_title’的运行

那么最终就是看 \wp-content\themes\suffusion\functions\filters.php 下的 suffusion_modify_title是什么东西了 自己看看

现在来吧 任意修改你的标题吧

$blog_title = get_bloginfo(‘name’);

虽然有点绕,我一开始也是看不明白,后来搜索了wordprss的过滤器慢慢清晰,认真看就明白。

希望能给你的学习带来帮助,有问题请留言!谢谢

 

发表在 开源代码 | 标签为 , | 留下评论

百度地图API显示多个标注点带提示的代码

下面的内容如数组都是数据库里调用后循环输出的

<script type=”text/javascript”>

var markerArr=[

{title:”xxx”,point:”114.078869,22.555521″,address:”xxx “,tel:”xxx)”},

{title:”xxx”,point:”113.90259,22.568833″,address:”xxx “,tel:”xxx)”},

{title:”xxx”,point:”114.151715,22.55261″,address:”xxx “,tel:”xxx)”},

];

function map_init() {

var map = new BMap.Map(“map_dealer”); // 创建Map实例

var point = new BMap.Point(114.025974, 22.546054); // 创建点坐标

map.centerAndZoom(point,12);// 初始化地图,设置中心点坐标和地图级别。

map.enableScrollWheelZoom(true); //启用滚轮放大缩小

//向地图中添加缩放控件

var ctrl_nav = new BMap.NavigationControl( {

anchor : BMAP_ANCHOR_TOP_LEFT,

type : BMAP_NAVIGATION_CONTROL_LARGE

});

map.addControl(ctrl_nav);

//向地图中添加缩略图控件

var ctrl_ove = new BMap.OverviewMapControl( {

anchor : BMAP_ANCHOR_BOTTOM_RIGHT,

isOpen : 1

});

map.addControl(ctrl_ove);

//向地图中添加比例尺控件

var ctrl_sca = new BMap.ScaleControl( {

anchor : BMAP_ANCHOR_BOTTOM_LEFT

});

map.addControl(ctrl_sca);

var point=new Array(); //存放标注点经纬信息的数组

var marker=new Array(); //存放标注点对象的数组

var info=new Array(); //存放提示信息窗口对象的数组

for(var i=0;i<markerArr.length;i++){

p0 = markerArr[i].point.split(“,”)[0]; //

p1 = markerArr[i].point.split(“,”)[1]; //按照原数组的point格式将地图点坐标的经纬度分别提出来

point[i] = new BMap.Point(p0,p1); //循环生成新的地图点

marker[i]=new BMap.Marker(point[i]); //按照地图点坐标生成标记

map.addOverlay(marker[i]);

marker[i].setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画

var label = new BMap.Label(‘公司名称:’+ markerArr[i].title ,{offset:new BMap.Size(20,-10)});

marker[i].setLabel(label);

info[i] = new BMap.InfoWindow(“<p style=’font-size:12px;lineheight:1.8em;’>名称:”+markerArr[i].title+”</br>地址:”+markerArr[i].address+”</br> 热线:”+markerArr[i].tel+”</br><img src=’//www.netpc.com.cn/wp-content/uploads/2013/07/10090833inc.gif’ /></p>”); // 创建信息窗口对象

}

marker[0].addEventListener(“mouseover”, function(){

this.openInfoWindow(info[0]);

});

marker[1].addEventListener(“mouseover”, function(){

this.openInfoWindow(info[1]);

});

marker[2].addEventListener(“mouseover”, function(){

this.openInfoWindow(info[2]);

});

}

function map_load() {//异步调用

var load = document.createElement(“script”);

load.src = “http://api.map.baidu.com/api?v=1.4&callback=map_init”;

document.body.appendChild(load);

}

window.onload = map_load;

</script>

<div id=”map_dealer”style=”width:100%;height:500px;background-color:navy;”></div>

发表在 开源代码 | 标签为 , , | 留下评论

php超大数字防注入intval函数溢出的解决方法

关于使用intval强制转换成数字的问题。数字大于2147483647会出现溢出出现负数。使用个方法来替代这个吧

$n=”\n”;
$a=2147483648.05555;
echo intval($a).$n; //result  -2147483648
echo (int) $a,$n;//result  -2147483648
echo floatval($a).$n;//result  2147483648.0556
echo floor(floatval($a)).$n;//result  2147483648

 

发表在 开源代码 | 标签为 | 留下评论

ls 显示目录含子目录及文件的完整路径

1、列出当前目录的文件、文件夹完整路径
   ls -1 |awk ‘{print i$0}’ i=`pwd`’/’

2、列出当前目录及子目录的文件、文件夹完整路径
   ls -R |awk ‘{print i$0}’ i=`pwd`’/’

2b) 列出当前目录及子目录下的文件夹完整路径
    ls -FR | grep /$ | sed “s:^:`pwd`/:” 

3、用find实现,好像运行要慢些
   find / -name “*.*” -exec ls {} \;

4、递归列出当前目录及子目录名称
    ls -FR | grep /$

5、递归列出当前目录及子目录名称,包括相关属性
    ls -lR | grep “^d”
    # drwxr-xr-x 3 idea idea  4096 Aug  2  2009 images

6、只列出当前目录下的子目录
    用ls只列出子目录
    ls -d */

发表在 服务器 | 标签为 | 留下评论

linux下根据文件大小查找文件

linux下的find命令用来查找文件,通过man find就知道它是无所不能的。所以按照文件大小来查找文件就不在话下。从man find搜索size,可以看到如下信息:

-size n[cwbkMG]
	  File uses n units of space.  The following suffixes can be used:

	  b    for 512-byte blocks (this is the default if no suffix is used)

	  c    for bytes

	  w    for two-byte words

	  k    for Kilobytes (units of 1024 bytes)

	  M    for Megabytes (units of 1048576 bytes)

	  G    for Gigabytes (units of 1073741824 bytes)

注意:默认单位是b,而它代表的是512字节,所以2表示1K,1M则是2048,如果不想自己转换,可以使用其他单位,如c、K、M等。

例子:查找当前目录下文件大小为2048(2k)字节的文件

find ./ -size 4
或
find ./ -size 2048c
或
find ./ -size 2K

上述查找文件是等于指定大小的,那能不能查询大于或小于某个指定值的文件呢,答案是肯定,例如:

查找大于2K的文件,+ 表示大于
find ./ -size +2048c

查找小于2K的文件,- 表示小于
find ./ -size +2048c -type f
发表在 服务器 | 标签为 | 留下评论

FCKeditor2.6 浏览图片时候添加缩略图显示

支持最后一个fck版本,新版本没测试过,首先打开源代码

fckeditoreditorfilemanagerbrowserdefaultfrmresourceslist.html

打开编辑GetFileRowHtml 函数:

oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )

{  // Build the link to view the folder.  var sLink = ‘<a href=”#” onclick=”OpenFile(” + fileUrl.replace( /’/g, ‘\”) + ”);return false;”>’ ;

// Get the file icon.  var sIcon = oIcons.GetIcon( fileName ) ;

return ‘<tr>’ +    ‘<td width=”16″>’ +

sLink +     ‘<img alt=”” src=”images/icons/’ + sIcon + ‘.gif” width=”16″ height=”16″ border=”0″></a>’ +

‘</td><td>&nbsp;’ +

sLink +         

 ‘<img src=”‘ + fileUrl + ‘” width=”100″ height=”100″ border=”0″/>’ +        //添加红色部分即可

‘</a>’ +    ‘</td><td align=”right” nowrap>&nbsp;’ +     fileSize +     ‘ KB’ +   ‘</td></tr>’ ; }

测试有效

发表在 开源代码 | 标签为 | 留下评论

在windows上按装mysql-5.6.12-win32.msi

今天尝试安装mysql5.6最新版本

1. 从镜像网站上下载mysql-5.6.12-win32.msi

国内mysql镜像 http://mirrors.sohu.com/mysql/

2. 运行安装mysql-5.6.12-win32.msi到期望安装的目录下: D:Program Filesmysql-5.6.12-win32
3. 配置:
    a. 将D:Program Filesmysql-5.6.12-win32my-default.ini文件,改名为 my.ini
    b. 在my.ini文件最后,加上:
[mysqld]
character_set_server=utf8
max_connections = 200
bind-address = 127.0.0.1
4. 安装mysql服务
    a. 打开windows命令行控制台
    b. 进入mysql所有目录:
cd D:Program Filesmysql-5.6.12-win32
    c. 运行安装命令:
mysqld –install
删除服务命令是: mysqld –remove
5. 启、停mysql服务
net start mysql
net stop mysql
6. 登录mysql服务
mysql -u root -p
提示输入密码时,直接回车,可登录
7. 修改root用户密码:
UPDATE mysql.user SET password=PASSWORD(‘123456′) WHERE user=’root’;
FLUSH PRIVILEGES;
很简单吧 这样既可
发表在 数据库 | 标签为 | 留下评论