<?php
function start_session($expire = 1)
{
    if ($expire == 0) {
        $expire = ini_get('session.gc_maxlifetime');
    } else {
        ini_set('session.gc_maxlifetime', $expire);
    }

    if (empty($_COOKIE['PHPSESSID'])) {
        session_set_cookie_params($expire);
        session_start();
    } else {
        session_start();
        setcookie('PHPSESSID', session_id(), time() + $expire);
    }
}

//尋找第一個在字串中出現的字詞
function str_indexof($string,$find,$start=0){
    if(!empty($string) && !empty($find))
   $index=strpos($string,$find,$start);
   if(gettype($index)!="integer")  $index=-1;
   return $index;
}

function checkWebStatus($db,$ac)
{
	if($ac != "admin")
	{ 
	  $db->query("SELECT SValue FROM SysConfig where SName = 'WEBFLAG'");
	  $row = $db->fetch_row();
	  $db->close_db();
	  if($row != null)
	  {
	 	  $webStatus = $row[0];
	  }
	  else
	  {
	 	  $webStatus = "0";
	  }
	}
	else
	{
		$webStatus = "1";
	}
	return $webStatus;
}
?>