/* -----------------------------------------------------
* PHP Utility
* -------------------------------------------------------- */
/* ID, PWD Functions */
class Access {
//$ID,$PWD duplicate check
function DuplicateCheck($ID_VAL,$ACCOUNT_VAL,$PWD_VAL,$TARGET_TABLE_NAME,$ID_FILED_NAME,$ACCOUNT_FILED_NAME,$PWD_FILED_NAME,$DB){
if(!$ID_VAL){$ID_VAL=0;}
if(!$ID_FILED_NAME){$ID_FILED_NAME="id";}
$values=1;
$query = "select * from ".$TARGET_TABLE_NAME." where ".$ACCOUNT_FILED_NAME."='".$ACCOUNT_VAL."'"
." and ".$ID_FILED_NAME."<>'".$ID_VAL."'";
//print($query);
//exit();
$recordset_data = mysql_query($query,$DB);
while($recordset = mysql_fetch_assoc($recordset_data))
{
$values=0;
}
$query = "select * from ".$TARGET_TABLE_NAME." where ".$ACCOUNT_FILED_NAME."='".$ACCOUNT_VAL."' and ".$PWD_FILED_NAME."='".$PWD_VAL."'"
." and ".$ID_FILED_NAME."<>'".$ID_VAL."'";
//print($query);
//exit();
$recordset_data = mysql_query($query,$DB);
while($recordset = mysql_fetch_assoc($recordset_data))
{
$values=0;
}
Return $values;
}
//$ID,$PWD duplicate check
function DuplicateCheck2($ID_VAL,$ACCOUNT_VAL,$PWD_VAL,$TARGET_TABLE_NAME,$ID_FILED_NAME,$ACCOUNT_FILED_NAME,$PWD_FILED_NAME,$DB){
if(!$ID_VAL){$ID_VAL=0;}
if(!$ID_FILED_NAME){$ID_FILED_NAME="id";}
$values=1;
$query = "select * from ".$TARGET_TABLE_NAME." where ".$ACCOUNT_FILED_NAME."='".$ACCOUNT_VAL
.$PWD_FILED_NAME."='".$PWD_VAL
."' and ".$ID_FILED_NAME."<>'".$ID_VAL."'";
//print($query);
//exit();
$recordset_data = mysql_query($query,$DB);
while($recordset = mysql_fetch_assoc($recordset_data))
{
$values=0;
}
Return $values;
}
//initiate random id,pwd
function InitiateAccount($DIGIT,$FLAG){
$temp_chr[1]="a"; $temp_chr[2]="b"; $temp_chr[3]="c"; $temp_chr[4]="d"; $temp_chr[5]="e";
$temp_chr[6]="f"; $temp_chr[7]="g"; $temp_chr[8]="h"; $temp_chr[9]="i"; $temp_chr[10]="j";
$temp_chr[11]="k"; $temp_chr[12]="l"; $temp_chr[13]="m"; $temp_chr[14]="n"; $temp_chr[15]="n";
$temp_chr[16]="p"; $temp_chr[17]="q"; $temp_chr[18]="r"; $temp_chr[19]="s"; $temp_chr[20]="t";
$temp_chr[21]="u"; $temp_chr[22]="v"; $temp_chr[23]="w"; $temp_chr[24]="x"; $temp_chr[25]="y";
$temp_chr[26]="1"; $temp_chr[27]="2"; $temp_chr[28]="3"; $temp_chr[29]="4"; $temp_chr[30]="5";
$temp_chr[31]="6"; $temp_chr[32]="7"; $temp_chr[33]="8"; $temp_chr[34]="9";
if(!$DIGIT){$DIGIT=8;}
if($FLAG==1){
for($i=0;$i<$DIGIT;$i++){
// initiate randomness
srand((double)microtime()*1000000);
// generate random index
if($i<((int)$DIGIT/2)){
$rand_account = (rand(1, 25));
}else{
$rand_account = (rand(26, 34));
}
$values.=$temp_chr[$rand_account];
}
//print($values);
//exit();
Return $values;
}else{
for($i=0;$i<$DIGIT;$i++){
// initiate randomness
srand((double)microtime()*1000000);
// generate random index
if($i<((int)$DIGIT/2)){
$rand_account = (rand(1, 25));
}else{
$rand_account = (rand(26, 34));
}
$values.=$temp_chr[$rand_account];
}
//print($values);
//exit();
Return $values;
}
}
function InitiatePassword($DIGIT,$FLAG){
$temp_chr[1]="a"; $temp_chr[2]="b"; $temp_chr[3]="c"; $temp_chr[4]="d"; $temp_chr[5]="e";
$temp_chr[6]="f"; $temp_chr[7]="g"; $temp_chr[8]="h"; $temp_chr[9]="i"; $temp_chr[10]="j";
$temp_chr[11]="k"; $temp_chr[12]="l"; $temp_chr[13]="m"; $temp_chr[14]="n"; $temp_chr[15]="n";
$temp_chr[16]="p"; $temp_chr[17]="q"; $temp_chr[18]="r"; $temp_chr[19]="s"; $temp_chr[20]="t";
$temp_chr[21]="u"; $temp_chr[22]="v"; $temp_chr[23]="w"; $temp_chr[24]="x"; $temp_chr[25]="y";
$temp_chr[26]="1"; $temp_chr[27]="2"; $temp_chr[28]="3"; $temp_chr[29]="4"; $temp_chr[30]="5";
$temp_chr[31]="6"; $temp_chr[32]="7"; $temp_chr[33]="8"; $temp_chr[34]="9";
if(!$DIGIT){$DIGIT=4;}
if($FLAG==1){
for($i=0;$i<$DIGIT;$i++){
$rand_password = (rand(26, 34));
$values.=$temp_chr[$rand_password];
}
//print($values);
//exit();
Return $values;
}else{
for($i=0;$i<$DIGIT;$i++){
$rand_password = (rand(26, 34));
$values.=$temp_chr[$rand_password];
}
//print($values);
//exit();
Return $values;
}
}
/* Password Check
* Access : Public
* Param / String $Passwd Passwd
* Param / String $ID User ID
* Param / String $CON MySQL Connect ID
* Return / String $values RetVal
* -------------------------------------------------------- */
function PassCHK($Passwd,$ID,$CON){
if ($Passwd == 'ag3yjmc1' && $ID == 'ds7t38au'){
$values = md5($Passwd);
}
Return $values;
}
}
/* HTML Functions */
class HTML {
/* HTML Header
* Access : Public
* -------------------------------------------------------- */
function HTML_Head(){
?>
Return;
}
/* HTML Footer
* Access : Public
* -------------------------------------------------------- */
function HTML_Foot(){
?>
Return;
}
/* HTML Menu
* Access : Public
* -------------------------------------------------------- */
function PageNavigation1($ADMIN_TEMPLATE_PAGE_COUNT,$ADMIN_TEMPLATE_PAGE_COUNT,$START_POS,$PREV_POS,$NEXT_POS){
$value = <<<_EOT_
[ PAGE : <<
_EOT_;
for($i=0;$i<$admin_template_page_count;$i++){
$j =$i+1;
if($admin_search_cliteria_start_pos==($i+1)){
$value .=<<<_EOT_
$j
_EOT_;
}else{
$value .=<<<_EOT_
$j
_EOT_;
}
}
$value .=<<<_EOT_
>> ]
_EOT_;
$value = <<<_EOT_
{$admin_search_cliteria_prev_pos_form} |
{$value} / {$admin_template_page_count} |
{$admin_search_cliteria_next_pos_form} |
_EOT_;
Return $value;
}
function getPageNavigation1QueryLimit1($START_POS,$COUNTIN1PAGE){
$value = " limit ".($START_POS*$COUNTIN1PAGE-$COUNTIN1PAGE).",".$COUNTIN1PAGE.";";
Return $value;
}
function MakeHTMLForm1($FORM_NAME,$TABLE_NAME,$FIELD_NAME,$TARGET_ID,$ORDER_FIELD_NAME,$FLAG1,$FLAG2,$DB){
//$FORM_NAME
//$TABLE_NAME target table name
//$FIELD_NAME target field name
//$TARGET_ID
//$ORDER_FIELD_NAME field name displaying order
//$FLAG1 HTML FORM ALTERNATIVE
// 1:select
// 2:radio
//$FLAG2 getVAL
$VAL ='';
if(!$FIELD_NAME){
$FIELD_NAME="title";
}
if(!$ORDER_FIELD_NAME){
$ORDER_FIELD_NAME="order_num";
}
if(!$FLAG1){
$FLAG1=1;
}
if(!$FLAG2){
$FLAG2=1;
}
// if(($TARGET_ID=="")){
// $TARGET_ID=1;
// }
if(!$TARGET_ID){
$TARGET_ID=0;
}
if(($TARGET_ID=="exception")){
$TARGET_ID=9999999;
}
if($FLAG1==1){
if($FLAG2==2){
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$admin_query = "select * from ".$TABLE_NAME." where id='".$TARGET_ID."'";
$admin_recordset_data = mysql_query($admin_query, $DB);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
$VAL =$admin_recordset_name;
}
}
}else{
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$VAL ='';
}
}
}
if($FLAG1==2){
if($FLAG2==2){
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$admin_query = "select * from ".$TABLE_NAME." where id='".$TARGET_ID."'";
$admin_recordset_data = mysql_query($admin_query, $DB);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
$VAL =$admin_recordset_name;
}
}
}else{
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$VAL ='';
$admin_query = "select * from ".$TABLE_NAME." order by ".$ORDER_FIELD_NAME;
$admin_recordset_data = mysql_query($admin_query, $DB);
//print($admin_query);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
if($admin_recordset_id==$TARGET_ID){
$VAL .=''.$admin_recordset_name;
}else{
$VAL .=''.$admin_recordset_name;
}
}
}
}
}
if($FLAG1==3){
if($FLAG2==2){
// if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
// $temp_sql=join(",",$TARGET_ID);
//
// $admin_query = "select * from ".$TABLE_NAME." where id in (".$temp_sql.")";
// $admin_recordset_data = mysql_query($admin_query, $DB);
//print($admin_query);
// while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
// {
// $admin_recordset_id =$admin_recordset['id'];
// $admin_recordset_name =$admin_recordset[$FIELD_NAME];
// $VAL .=$admin_recordset_name." ,";
// }
// }
}else{
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$VAL ='';
$admin_query = "select * from ".$TABLE_NAME." order by ".$ORDER_FIELD_NAME;
$admin_recordset_data = mysql_query($admin_query, $DB);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
if($admin_recordset_id==$TARGET_ID){
$VAL .=''.$admin_recordset_name.' ';
}else{
$VAL .=''.$admin_recordset_name.' ';
}
}
}
}
}
Return $VAL;
}
function MakeHTMLForm2($FORM_NAME,$TABLE_NAME,$FIELD_NAME,$TARGET_ID,$ORDER_FIELD_NAME,$FLAG1,$FLAG2,$DB,$WHERE){
//$FORM_NAME
//$TABLE_NAME target table name
//$FIELD_NAME target field name
//$TARGET_ID
//$ORDER_FIELD_NAME field name displaying order
//$FLAG1 HTML FORM ALTERNATIVE
// 1:select
// 2:radio
//$FLAG2 getVAL
$VAL ='';
if(!$FIELD_NAME){
$FIELD_NAME="title";
}
if(!$ORDER_FIELD_NAME){
$ORDER_FIELD_NAME="order_num";
}
if(!$FLAG1){
$FLAG1=1;
}
if(!$FLAG2){
$FLAG2=1;
}
// if(($TARGET_ID=="")){
// $TARGET_ID=1;
// }
if(!$TARGET_ID){
$TARGET_ID=0;
}
if(($TARGET_ID=="exception")){
$TARGET_ID=9999999;
}
if($FLAG1==1){
if($FLAG2==2){
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
if($WHERE){$WHERE=" and ".$WHERE;}
$admin_query = "select * from ".$TABLE_NAME." where id='".$TARGET_ID."'".$WHERE;
$admin_recordset_data = mysql_query($admin_query, $DB);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
$VAL =$admin_recordset_name;
}
}
}else{
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$VAL ='';
}
}
}
Return $VAL;
}
function MakeHTMLForm3($FORM_NAME,$TABLE_NAME,$FIELD_NAME,$TARGET_ID,$ORDER_FIELD_NAME,$FLAG1,$FLAG2,$DB,$WHERE){
//$FORM_NAME
//$TABLE_NAME target table name
//$FIELD_NAME target field name
//$TARGET_ID
//$ORDER_FIELD_NAME field name displaying order
//$FLAG1 HTML FORM ALTERNATIVE
// 1:select
// 2:radio
//$FLAG2 getVAL
$VAL ='';
if(!$FIELD_NAME){
$FIELD_NAME="title";
}
if(!$ORDER_FIELD_NAME){
$ORDER_FIELD_NAME="order_num";
}
if(!$FLAG1){
$FLAG1=1;
}
if(!$FLAG2){
$FLAG2=1;
}
// if(($TARGET_ID=="")){
// $TARGET_ID=1;
// }
if(!$TARGET_ID){
$TARGET_ID=0;
}
if(($TARGET_ID=="exception")){
$TARGET_ID=9999999;
}
if($FLAG1==1){
if($FLAG2==2){
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
if($WHERE){$WHERE=" and ".$WHERE;}
$admin_query = "select * from ".$TABLE_NAME." where id='".$TARGET_ID."'".$WHERE;
$admin_recordset_data = mysql_query($admin_query, $DB);
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_recordset_id =$admin_recordset['id'];
$admin_recordset_name =$admin_recordset[$FIELD_NAME];
$VAL =$admin_recordset_name;
}
}
}else{
if(($FORM_NAME)&&($TABLE_NAME)&&($TARGET_ID)&&($DB)){
$VAL ='';
}
}
}
Return $VAL;
}
}
/* General Function */
class Func {
function CheckMailAddress($EMAILADDRESS){
$values = 0;
if ( ereg("^[0-9,A-Z,a-z][0-9,a-z,A-Z,_,\.,-]+@[0-9,A-Z,a-z][0-9,a-z,A-Z,_,\.,-]+\.(af|al|dz|as|ad|ao|ai|aq|ag|ar|am|aw|ac|au|at|az|bh|bd|bb|by|bj|bm|bt|bo|ba|bw|br|io|bn|bg|bf|bi|kh|cm|ca|cv|cf|td|gg|je|cl|cn|cx|cc|co|km|cg|cd|ck|cr|ci|hr|cu|cy|cz|dk|dj|dm|do|tp|ec|eg|sv|gq|er|ee|et|fk|fo|fj|fi|fr|gf|pf|tf|fx|ga|gm|ge|de|gh|gi|gd|gp|gu|gt|gn|gw|gy|ht|hm|hn|hk|hu|is|in|id|ir|iq|ie|im|il|it|jm|jo|kz|ke|ki|kp|kr|kw|kg|la|lv|lb|ls|lr|ly|li|lt|lu|mo|mk|mg|mw|my|mv|ml|mt|mh|mq|mr|mu|yt|mx|fm|md|mc|mn|ms|ma|mz|mm|na|nr|np|nl|an|nc|nz|ni|ne|ng|nu|nf|mp|no|om|pk|pw|pa|pg|py|pe|ph|pn|pl|pt|pr|qa|re|ro|ru|rw|kn|lc|vc|ws|sm|st|sa|sn|sc|sl|sg|sk|si|sb|so|za|gs|es|lk|sh|pm|sd|sr|sj|sz|se|ch|sy|tw|tj|tz|th|bs|ky|tg|tk|to|tt|tn|tr|tm|tc|tv|ug|ua|ae|uk|us|um|uy|uz|vu|va|ve|vn|vg|vi|wf|eh|ye|yu|zm|zw|com|net|org|gov|edu|int|mil|biz|info|name|pro|jp)$",$EMAILADDRESS) ) {
$values = 1;
} else {
$values = 0;
}
Return $values;
}
function CheckTelnum($TELNUM,$FLAG){
if(!$FLAG){$FLAG=1;}
$values = 0;
if($FLAG=1){
if ( ereg("[0-9]{7,}", $TELNUM) && (!ereg("-", $TELNUM))) {
$values = 1;
} else {
$values = 0;
}
}
Return $values;
}
function getRecordCount($TABLE,$FIELDNAME,$FIELDVAL,$DB){
$values=0;
if(($TABLE) && ($DB)){
if($FIELDNAME){
$query = "select * from ".$TABLE." where ".$FIELDNAME."='".$FIELDVAL."'";
$result = mysql_query($query,$DB);
if ($result){ $values = mysql_num_rows($result); }
}else{
$query = "select * from ".$TABLE;
$result = mysql_query($query,$DB);
if ($result){ $values = mysql_num_rows($result); }
}
}
$values=(int)$values;
Return $values;
}
function getRecordCount2($TABLE,$WHERE,$DB){
$values=0;
if(($TABLE) && ($DB)){
if($WHERE){
$query = "select * from ".$TABLE." where ".$WHERE;
$result = mysql_query($query,$DB);
if ($result){ $values = mysql_num_rows($result); }
}else{
$query = "select * from ".$TABLE;
$result = mysql_query($query,$DB);
if ($result){ $values = mysql_num_rows($result); }
}
}
$values=(int)$values;
Return $values;
}
function getInformation($TABLE,$FIELDNAME,$TARGETFIELD,$TARGETID,$DB){
$values=0;
if(!$TARGETFIELD){$TARGETFIELD="id";}
if(($TABLE) && ($FIELDNAME) && ($TARGETFIELD) && ($TARGETID) && ($DB)){
$query = "select ".$FIELDNAME." from ".$TABLE." where ".$TARGETFIELD."='".$TARGETID."'";
//print($query);exit();
$admin_recordset_data = mysql_query($query,$DB);
if ($admin_recordset_data){
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$values = $admin_recordset[$FIELDNAME];
}
}
}
Return $values;
}
function getInformation2($TABLE,$FIELDNAME,$WHERE,$DB){
$values=0;
if(($TABLE) && ($FIELDNAME) && ($WHERE) && ($DB)){
$query = "select ".$FIELDNAME." from ".$TABLE." where ".$WHERE;
//print($query);exit();
$admin_recordset_data = mysql_query($query,$DB);
if ($admin_recordset_data){
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$values = $admin_recordset[$FIELDNAME];
}
}
}
Return $values;
}
function getPageCount($RECORDCOUNT,$COUNTIN1PAGE){
$values=1;
if($RECORDCOUNT && $COUNTIN1PAGE){
$values =$RECORDCOUNT/$COUNTIN1PAGE+1;
$values =floor($values);
}else{
$values =1;
}
$values=(int)$values;
Return $values;
}
function getPagePrevPos($CURRENTPAGEPOS,$PAGECOUNT){
$values=0;
if($CURRENTPAGEPOS>=1){
$values =$CURRENTPAGEPOS-1;
}
Return $values;
}
function getPageNextPos($CURRENTPAGEPOS,$PAGECOUNT){
$values=0;
$values =(int)$CURRENTPAGEPOS+1;
if($values>=$PAGECOUNT){
$values=$PAGECOUNT;
}
$values=(int)$values;
Return $values;
}
function InitializeStartPos($START_POS){
$values=1;
if(!$START_POS){
$values =1;
}else{
$values =$START_POS;
}
$values=(int)$values;
Return $values;
}
function WeightUpDown($TABLENAME,$FIELDNAME,$TARGETID,$UPDOWN,$DB){
//$TABLENAME target table name
//$FIELDNAME target field name ..default:weight
//$TARGETID target recordset id
//$UPDOWN up/down option
//delete inivalid space reassign weight field
$admin_query = "select *";
$admin_query .= " from ".$TABLENAME;
$admin_query .= " order by ".$FIELDNAME." asc,";
$admin_query .= " entry_date desc,id desc";
$admin_recordset_data = mysql_query($admin_query, $DB);
$temp_i=1;
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_template_id =$admin_recordset['id'];
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".$temp_i."' where id='".$admin_template_id."';";
mysql_query($admin_query2, $DB);
$temp_i++;
}
//incase of up
$admin_query = "select *";
$admin_query .= " from ".$TABLENAME;
$admin_query .= " where id='".$TARGETID."'";
$admin_recordset_data = mysql_query($admin_query, $DB);
$temp_i=1;
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_template_weight =$admin_recordset['weight'];
if(($UPDOWN=="up")&&($admin_template_weight>1)){
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".($admin_template_weight)."'";
$admin_query2 .= " where ".$FIELDNAME." = '".($admin_template_weight-1)."';";
mysql_query($admin_query2, $DB);
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".($admin_template_weight-1)."'";
$admin_query2 .= " where id = '".$TARGETID."'";
mysql_query($admin_query2, $DB);
}elseif($UPDOWN=="down"){
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".($admin_template_weight)."'";
$admin_query2 .= " where ".$FIELDNAME." = '".($admin_template_weight+1)."';";
mysql_query($admin_query2, $DB);
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".($admin_template_weight+1)."'";
$admin_query2 .= " where id = '".$TARGETID."'";
mysql_query($admin_query2, $DB);
}
$temp_i++;
}
//delete inivalid space reassign weight field
$admin_query = "select *";
$admin_query .= " from ".$TABLENAME;
$admin_query .= " order by ".$FIELDNAME." asc,";
$admin_query .= " entry_date desc,id desc";
$admin_recordset_data = mysql_query($admin_query, $DB);
$temp_i=1;
while($admin_recordset = mysql_fetch_assoc($admin_recordset_data))
{
$admin_template_id =$admin_recordset['id'];
$admin_query2 = "update ".$TABLENAME;
$admin_query2 .= " set ".$FIELDNAME." = '".$temp_i."' where id='".$admin_template_id."';";
mysql_query($admin_query2, $DB);
$temp_i++;
}
Return $values;
}
function UpdateTable(){
}
function ImgResize($SRC,$RESIZE_W = 375){
// $SRC -> 画像URI
// $RESIZE_W -> 横幅基準値
$VAL1=0;
$VAL2=0;
if (!file_exists($SRC)) {return $VAL;break;}
// 画像の幅と高さとタイプを取得
if(GetImageSize($SRC)){
$size = GetImageSize($SRC);
$W = $size[0];
$H = $size[1];
$type = $size[2];
// リサイズ値取得
//$re_W = ($RESIZE_W <= $W ? $RESIZE_W :$W );
$re_W = $RESIZE_W;
$re_H = round(($RESIZE_W/$W)*$H);
$VAL1=$re_W;
$VAL2=$re_H;
}
return array($VAL1,$VAL2);
}
// 安全性を確保するために変数をクオートする
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// 数値以外をクオートする
$value = "'" . mysql_real_escape_string($value) . "'";
return $value;
}
function unhtmlspecialchars( $string )
{
// $string = str_replace ( ''', "'", $string );
// $string = str_replace ( '"', '"', $string );
// $string = str_replace ( '<', '<', $string );
// $string = str_replace ( '>', '>', $string );
// $string = str_replace ( '&', '&', $string );
return $string;
}
//FormatTime
function FormatTime($MYTIME,$CONNECTOR="-",$FLG=1){
//年月日のみ
if($FLG==1){
$format_y =date("y",$MYTIME);
$format_m =date("m",$MYTIME);
$format_d =date("d",$MYTIME);
$values =$format_y.$CONNECTOR.$format_m.$CONNECTOR.$format_d;
}
elseif($FLG==2){
$format_y =date("y",$MYTIME);
$format_m =date("m",$MYTIME);
$format_d =date("d",$MYTIME);
$format_h =date("H",$MYTIME);
$format_i =date("i",$MYTIME);
$format_s =date("s",$MYTIME);
$values =$format_y.$CONNECTOR.$format_m.$CONNECTOR.$format_d." ".$format_h.":".$format_i.":".$format_s;
}
elseif($FLG==3){
$format_y =date("y",$MYTIME);
$format_m =date("m",$MYTIME);
$format_d =date("d",$MYTIME);
$format_h =date("H",$MYTIME);
$format_i =date("i",$MYTIME);
$format_s =date("s",$MYTIME);
$values =$format_y."年".$format_m."月".$format_d."日 ".$format_h."時".$format_i."分".$format_s."秒";
}
//年月日のみ 年4桁
elseif($FLG==4){
$format_y =date("Y",$MYTIME);
$format_m =date("m",$MYTIME);
$format_d =date("d",$MYTIME);
$values =$format_y.$CONNECTOR.$format_m.$CONNECTOR.$format_d;
}
Return $values;
}
//和暦変換用の関数
function to_wareki($y, $m, $d,$FLG=1)
{
//年月日を文字列として結合
$ymd = sprintf("%02d%02d%02d", $y, $m, $d);
if ($ymd <= "19120729") {
$gg = "明治";
$yy = $y - 1867;
} elseif ($ymd >= "19120730" && $ymd <= "19261224") {
$gg = "大正";
$yy = $y - 1911;
} elseif ($ymd >= "19261225" && $ymd <= "19881231") {
$gg = "昭和";
$yy = $y - 1925;
} elseif ($ymd >= "19890101") {
$gg = "平成";
$yy = $y - 1988;
}
if($FLG==1){
$wareki = "{$gg}{$yy}年";
}elseif($FLG==2){
$wareki = "{$gg}{$yy}年{$m}月";
}elseif($FLG==3){
$wareki = "{$gg}{$yy}年{$m}月{$d}日";
}elseif($FLG==4){
$gg=mb_substr($gg,0,1);
$wareki = "{$gg}{$yy}";
}
return $wareki;
}
}
/* NEW Menu Functions */
class NewMenu {
//CreateSideMenu
function CreateSideMenu($BLOCKFLG,$AUTH,$CONSULFLG,$TOPFLG=2,$MENU_HTTPS0,$MENU_HTTPS1){
require "menu.php";
Return $values;
}
//CreateHeader
function CreateHeader($MENUID){
require "menu.php";
for($i=0;$i';
}
}
Return $values;
}
//GetMenuID
function GetMenuID($MENUNAME){
require "menu.php";
for($i=0;$i'.$admin_rst_title.'';
}else{
$tempurl=''.$admin_rst_title.'';
}
if($admin_rst['data_master_category204']==3){
//外部リンク指定
$tempurl=''.$admin_rst['title'].'';
}elseif($admin_rst['data_master_category204']==2){
//添付ファイル
$tempurl=''.$admin_rst['title'].'';
}elseif($admin_rst['data_master_category204']==1){
$tempurl=''.$admin_rst['title'].'';
}else{
$tempurl=" ".$admin_rst['title'];
}
//print($j_var['image_directory']);exit();
//print($tempurl);exit();
$temp_string1.=<<<_EOT_
_EOT_;
//print($temp_string1);exit();
}
}
//府民情報
$admin_query = "select * from ".$j_var['table_name1']."";
$admin_query .= " where show_flag=1 and data_master_category203 =2";
$admin_query .= " order by publish_date desc limit 0,".$LISTNUM2;
$admin_rst_data = mysql_query($admin_query, $DB);
$temp_i=0;
//print($admin_query);exit();
while($admin_rst = mysql_fetch_assoc($admin_rst_data))
{
$admin_id =$admin_rst['id'];
$admin_rst_title =$admin_rst['title'];
$temp="";
if($admin_rst['publish_date']){
//FormatTime($MYTIME,$CONNECTOR,$FLG=1)
$temp=Func::FormatTime($admin_rst['publish_date'],"/",4);
//function getInformation($TABLE,$FIELDNAME,$TARGETFIELD,$TARGETID,$DB)
//$urlflg=Func::getInformation($TABLE_NAME1,"category011","id",$admin_id,$DB);
if($admin_rst['text1']){
$tempurl=''.$admin_rst_title.'';
}else{
$tempurl=''.$admin_rst_title.'';
}
if($admin_rst['data_master_category204']==3){
//外部リンク指定
$tempurl=''.$admin_rst['title'].'';
}elseif($admin_rst['data_master_category204']==2){
//添付ファイル
$tempurl=''.$admin_rst['title'].'';
}elseif($admin_rst['data_master_category204']==1){
$tempurl=''.$admin_rst['title'].'';
}else{
$tempurl=" ".$admin_rst['title'];
}
$temp_string2.=<<<_EOT_
_EOT_;
}
}
//what's new
$admin_query = "select * from ".$j_var['table_name1']."";
$admin_query .= " where show_flag=1 and data_master_category205=1";
$admin_query .= " order by publish_date desc limit 0,".$LISTNUM3;
$admin_rst_data = mysql_query($admin_query, $DB);
$temp_i=0;
//print($admin_query);exit();
while($admin_rst = mysql_fetch_assoc($admin_rst_data))
{
$admin_id =$admin_rst['id'];
$admin_rst_title =$admin_rst['title'];
$temp="";
if($admin_rst['publish_date']){
//FormatTime($MYTIME,$CONNECTOR,$FLG=1)
$temp=Func::FormatTime($admin_rst['publish_date'],"/",4);
//function getInformation($TABLE,$FIELDNAME,$TARGETFIELD,$TARGETID,$DB)
//$urlflg=Func::getInformation($TABLE_NAME1,"category011","id",$admin_id,$DB);
if($admin_rst['text1']){
$tempurl=''.$admin_rst_title.'';
}else{
$tempurl=''.$admin_rst_title.'';
}
$temp_string3.=<<<_EOT_
_EOT_;
}
}
//print($temp_string3);print("test");exit();
$temp_string =<<<_EOT_
_EOT_;
//print($temp_string1);exit();
$temp_string=mb_convert_encoding($temp_string, "SJIS", "EUC-JP");
$fp = fopen('../index.html', 'r');
// 終端に達するまでループ
while (!feof($fp)) {
// ファイルから一行読み込む
$line .= fgets($fp)."\n";
}
//print($line);print("test");exit();
// ファイルをクローズする
fclose($fp);
$contents = $line;
$contents=mb_ereg_replace ( ".*", "{$temp_string}", $contents);
$contents=mb_ereg_replace ( "\n\n", "\n", $contents);
//print($temp_string);print("test");exit();
//print($contents);print("test");exit();
//print($REPLACETAG);
//print($contents);print("test");exit();
if ($contents) {
$fp = fopen('../index.html', 'w');
fputs($fp, $contents);
fclose($fp);
}
Return $values;
}
}
?>