📄 common.inc.php
字号:
for ( ; $i < $num; $i++ )
{
$arrs = $arr[$i] + 0;
$fsql->query( "select cat from {$tbl} where catid='{$arrs}'" );
if ( $fsql->next_record( ) )
{
$cat = $fsql->f( "cat" );
}
$str .= $cat." > ";
}
}
return $str;
}
function ordsc( $ord, $need, $sc )
{
if ( $ord == $need )
{
if ( $sc == "desc" || $sc == "" )
{
echo "<img src='images/arrowdown.gif'>";
}
else
{
echo "<img src='images/arrowup.gif'>";
}
}
}
function showtypeimage( $src, $type, $width, $height, $border )
{
if ( $width != "" && $width != "0" )
{
$wstr = " width=".$width." ";
}
if ( $height != "" && $height != "0" )
{
$hstr = " height=".$height." ";
}
if ( $type == "swf" )
{
$ImageStr = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" ".$wstr." ".$hstr." border=".$border."><param name=movie value=\"".$src."\"><param name=quality value=high><embed src=\"".$src."\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" ".$wstr." ".$hstr." border=".$border."></embed></object>";
}
else
{
$ImageStr = "<img src=".$src." ".$wstr." ".$hstr." border=".$border.">";
}
return $ImageStr;
}
function uploadimage( $jpg, $jpg_type, $jpg_size, $path )
{
global $strUploadNotice1;
global $strUploadNotice2;
global $strUploadNotice3;
if ( $jpg_size == 0 )
{
err( $strUploadNotice1, "", "" );
}
if ( 200000 < $jpg_size )
{
err( $strUploadNotice2, "", "" );
}
if ( $jpg_type != "image/pjpeg" && $jpg_type != "image/gif" && $jpg_type != "image/x-png" && $jpg_type != "application/x-shockwave-flash" )
{
err( $strUploadNotice3, "", "" );
}
switch ( $jpg_type )
{
case "image/pjpeg" :
$extention = ".jpg";
$UploadImage[2] = "gif";
break;
case "image/gif" :
$extention = ".gif";
$UploadImage[2] = "gif";
break;
case "image/x-png" :
$extention = ".png";
$UploadImage[2] = "gif";
break;
case "application/x-shockwave-flash" :
$extention = ".swf";
$UploadImage[2] = "swf";
break;
}
$fname = time( );
$fname = $fname.$extention;
$file_path = "../".$path."/".$fname;
$UploadImage[3] = $path."/".$fname;
copy( $jpg, $file_path );
chmod( $file_path, 438 );
$size = getimagesize( $file_path );
if ( 0 < $size[0] && 0 < $size[1] )
{
$UploadImage[0] = $size[0];
$UploadImage[1] = $size[1];
}
else
{
$UploadImage[0] = 50;
$UploadImage[1] = 50;
}
return $UploadImage;
}
function uploadfile( $jpg, $jpg_type, $fname, $jpg_size, $path )
{
global $strDownNotice9;
global $strDownNotice11;
global $strDownNotice12;
if ( $jpg_size == 0 )
{
err( $strDownNotice9, "", "" );
}
if ( substr( $fname, 0 - 4 ) == ".php" || substr( $fname, 0 - 4 ) == ".exe" )
{
err( $strDownNotice11, "", "" );
}
$hzarr = explode( ".", $fname );
$num = sizeof( $hzarr ) - 1;
$UploadImage[2] = $hzarr[$num];
$file_path = "../".$path."/".$fname;
$UploadImage[3] = $path."/".$fname;
copy( $jpg, $file_path );
chmod( $file_path, 438 );
$UploadImage[0] = 0;
$UploadImage[1] = 0;
return $UploadImage;
}
function url2path( $string )
{
global $SiteUrl;
$string = str_replace( $SiteUrl."pic/gif/", "RP/pic/gif/", $string );
$string = str_replace( $SiteUrl."pic/swf/", "RP/pic/swf/", $string );
return $string;
}
function path2url( $string )
{
global $SiteUrl;
$string = str_replace( "RP/pic/gif/", $SiteUrl."pic/gif/", $string );
$string = str_replace( "RP/pic/swf/", $SiteUrl."pic/swf/", $string );
return $string;
}
function tblinsert( $tbl, $vars )
{
global $msql;
$scl = "";
while ( list( $key, $val ) = key )
{
$scl .= "`".$key."`='".$val."',";
}
$scl = substr( $scl, 0, 0 - 1 );
$msql->query( "insert into {$tbl} set {$scl}" );
}
function listfold( $imagefold, $fp )
{
if ( file_exists( $imagefold ) )
{
$handle = opendir( $imagefold );
while ( $image_file = readdir( $handle ) )
{
$nowfile = $imagefold."/".$image_file;
if ( $image_file != "." && $image_file != ".." )
{
if ( !is_dir( $nowfile ) )
{
echo $nowfile."<br>";
}
else
{
listfold( $nowfile, $fp );
}
}
}
closedir( $handle );
}
}
function readtemp( $tempfile, $path )
{
$fname = $path.$tempfile;
$fd = fopen( $fname, "r" );
$con = fread( $fd, filesize( $fname ) );
fclose( $fd );
echo $con;
}
function creatpage( $pagefile, $str )
{
$fd = fopen( $pagefile, "w" );
fwrite( $fd, $str, strlen( $str ) );
fclose( $fd );
}
function tblcheckcf( $tbl, $colname, $var )
{
global $msql;
$msql->query( "select * from {$tbl} where `".$colname."`='".$var."' " );
if ( $msql->next_record( ) )
{
return "1";
}
else
{
return "0";
}
}
function selcoltype( )
{
global $fsql;
global $tbl_menu;
$menuid = $_REQUEST['menuid'];
echo "<select name='col' onChange='window.location=this.form.col.options[this.form.col.selectedIndex].value'>";
$fsql->query( "select * from {$tbl_menu} where pub='menu'" );
while ( $fsql->next_record( ) )
{
$lmenu = $fsql->f( "menu" );
$lmenuid = $fsql->f( "menuid" );
if ( $lmenuid == $menuid )
{
echo "<option value='".$PHP_SELF."?menuid=".$lmenuid."' selected>".$lmenu."</option>";
}
else
{
echo "<option value='".$PHP_SELF."?menuid=".$lmenuid."' >".$lmenu."</option>";
}
}
echo "</select>";
}
function daylist( $nameY, $nameM, $nameD, $nowY, $nowM, $nowD )
{
global $strYear;
global $strMonth;
global $strDay;
if ( !isset( $nowY ) || $nowY == "" )
{
$nowY = date( "Y", time( ) );
}
if ( !isset( $nowM ) || $nowM == "" )
{
$nowM = date( "n", time( ) );
}
if ( !isset( $nowD ) || $nowD == "" )
{
$nowD = date( "j", time( ) );
}
$AllfromY = date( "Y", time( ) ) - 5;
$AlltoY = date( "Y", time( ) );
$String = "<select name={$nameY}>";
$i = $AllfromY;
for ( ; $i <= $AlltoY; $i++ )
{
if ( $i == $nowY )
{
$String .= "<option value=".$i." selected>".$i.$strYear."</option>";
}
else
{
$String .= "<option value=".$i.">".$i.$strYear."</option>";
}
}
$String .= "</select>";
$String .= "<select name={$nameM}>";
$i = 1;
for ( ; $i <= 12; $i++ )
{
if ( strlen( $i ) < 2 )
{
$ii = "0".$i;
}
else
{
$ii = $i;
}
if ( $ii == $nowM )
{
$String .= "<option value=".$ii." selected>".$i.$strMonth."</option>";
}
else
{
$String .= "<option value=".$ii.">".$i.$strMonth."</option>";
}
}
$String .= "</select>";
$String .= "<select name={$nameD}>";
$i = 1;
for ( ; $i <= 31; $i++ )
{
if ( strlen( $i ) < 2 )
{
$ii = "0".$i;
}
else
{
$ii = $i;
}
if ( $ii == $nowD )
{
$String .= "<option value=".$ii." selected>".$i.$strDay."</option>";
}
else
{
$String .= "<option value=".$ii.">".$i.$strDay."</option>";
}
}
$String .= "</select>";
return $String;
}
function showyn( $str )
{
if ( $str == "1" || $str == "yes" )
{
echo "<img src='images/toolbar_ok.gif'>";
}
else
{
echo "<img src='images/toolbar_no.gif'>";
}
}
function cpfolder( $FromPath, $ToPath )
{
if ( !is_writable( $ToPath ) )
{
echo "Error: Fold (".$ToPath.") is not writable";
exit( );
}
if ( file_exists( $FromPath ) )
{
$handle = opendir( $FromPath );
while ( $ifile = readdir( $handle ) )
{
$nowfile = $FromPath."/".$ifile;
$tofile = $ToPath."/".$ifile;
if ( $ifile != "." && $ifile != ".." )
{
if ( !is_dir( $nowfile ) )
{
copy( $nowfile, $tofile );
chmod( $tofile, 493 );
}
else
{
if ( !file_exists( $tofile ) )
{
mkdir( $tofile, 511 );
}
cpfolder( $nowfile, $tofile );
}
}
}
closedir( $handle );
}
}
function delfold( $imagefold )
{
if ( file_exists( $imagefold ) )
{
$handle = opendir( $imagefold );
while ( $image_file = readdir( $handle ) )
{
$nowfile = "{$imagefold}/{$image_file}";
if ( $image_file != "." && $image_file != ".." )
{
if ( !is_dir( $nowfile ) )
{
unlink( $nowfile );
}
else
{
delfold( $nowfile );
}
}
}
closedir( $handle );
rmdir( $imagefold );
}
}
function showmenu( $menuid )
{
global $msql;
global $tbl_menu;
$msql->query( "select menu from {$tbl_menu} where menuid='{$menuid}'" );
if ( $msql->next_record( ) )
{
$menu = $msql->f( "menu" );
}
echo $menu;
}
function readskins( $nowskin )
{
global $strDefault;
$skstr = "";
$fd = fopen( "../templates/skin.dat", "r" );
$str = fread( $fd, 2000 );
fclose( $fd );
$arr = explode( "\n", $str );
$nums = sizeof( $arr ) - 1;
$i = 0;
for ( ; $i <= $nums; $i++ )
{
$lskin = str_replace( "\r", "", $arr[$i] );
$lskin = str_replace( "\n", "", $lskin );
$lskin = trim( $lskin );
if ( $lskin != "" )
{
$sk = explode( "|", $lskin );
if ( sizeof( $sk ) == 3 )
{
if ( $sk[2] == "default" )
{
$skinsay = $strDefault;
}
else
{
$skinsay = $sk[0];
}
if ( $nowskin == $sk[2] )
{
$skstr .= "<option value='".$sk[2]."' selected>".$skinsay."</option>";
}
else
{
$skstr .= "<option value='".$sk[2]."'>".$skinsay."</option>";
}
}
}
}
return $skstr;
}
error_reporting( E_ERROR | E_WARNING | E_PARSE );
set_magic_quotes_runtime( 0 );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -