Location: PHPKode > projects > @1 File Store > libs/functions.php
<?
//Send e-mail to all admin
//$mysql - MySQL class instance
//$subj - subject of e-mail
//$message - body of message
function send_to_admin($mysql, $subj, $message)
{
 $SQL="SELECT * FROM `".DB_PREFIX."users` WHERE `level`='0' OR `level`='-1'";
 if($mysql->query($SQL) && $mysql->num>0)
 {
  while(!$mysql->EOF)
  {
   mail(trim($mysql->field("email")), $subj, $message, "From:".ADMIN_EMAIL);
   $mysql->movenext();
  }
 }
}
//Check acces level for group to folder and folder exists
//$mysql - MySQL class instance
//$folderid - id of folder
//$userlevel - id of user group
//return array with folder options in success or string with error
function check_folder($mysql, $folderid, $userlevel)
{
 if($userlevel!=0 && $userlevel!=-1) //if not admins
 {
  $SQL="SELECT COUNT(*) AS `cnt` FROM `".DB_PREFIX."access_list` WHERE `group_id`='".$userlevel."'";
  $SQL.=" AND `folder_id`='".$folderid."'";
  if(!$mysql->query($SQL))
  {
   exit($mysql->error);
  }
  if(intval($mysql->field("cnt"))<=0)
  {
   return "denied";
  }
 }
 $SQL="SELECT * FROM `".DB_PREFIX."folders` WHERE `id`='".$folderid."'";
 if(!$mysql->query($SQL))
 {
  exit($mysql->error);
 }
 if($mysql->num<=0)
 {
  return "folder_invalid";
 }
 return $mysql->arr;
}
?>
Return current item: @1 File Store