[CPG] 短網址

編輯index.php 加入以下這些
cpg134_user <- 這邊請自行修改

$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,’=’) and !empty($qq)) {
$qq = eregi_replace ( ‘%20’, ‘ ‘, $qq);
$qq=mysql_escape_string($qq);
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
$result1 = mysql_query($sql);
if (mysql_num_rows($result1)>0) {
 list($uid) = mysql_fetch_array($result1);
 $cat = sprintf("1%04d",$uid);
}
mysql_free_result($result1);
}

 

 

//
// Main code
//

編輯 .htacess

<Files .htaccess>
deny from all
</Files>

RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z_0-9-]+)/*$ /?$1 [L]
RewriteRule ^user-([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/$ /index.php
RewriteRule ^my$ /profile.php?op=edit_profile
RewriteRule ^new$ /thumb.php?album=lastup
RewriteRule ^hot$ /thumb.php?album=topn

<Files user>
 ForceType application/x-httpd-php
</Files>

#ErrorDocument 401 /index.php
#ErrorDocument 403 /index.php
#ErrorDocument 404 /index.php

分類未分類

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *