Exemplo n.º 1
0
function set_status($data)
{
    $file = device_put_content . 'status.txt';
    file_put_contents($file, $data);
    if ($data == '<0>') {
        insert_log('Device Disarmed');
    } else {
        insert_log('Device Armed');
    }
}
Exemplo n.º 2
0
set_time_limit(0);
// 定义应用目录
define('APP', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
// 载入框架引导文件
require APP . 'system/_shell.php';
require APP . 'funcs/spider.fn.php';
require APP . 'models/TaskModel.php';
require APP . 'et/phpQuery/phpQuery.php';
//获取链接列表  http://www.tomdurrie.com/search.php?page=380
$links = get_batch_link('http://www.tomdurrie.com/search.php?page=(*)', 1, 6, 1);
if (!empty($links)) {
    foreach ($links as $target_url) {
        /**
         * 获取维美达链接列表
         */
        echo "正在获取链接{$target_url}下的产品链接\n";
        phpQuery::newDocumentFile($target_url);
        $goods_list = pq('.hoverlist');
        $lists_tmp = array();
        foreach ($goods_list as $li) {
            $lists_tmp[] = array('url' => pq($li)->find('a')->attr('href'), 'thumb_img_org' => pq($li)->find('img')->attr('src'));
        }
        // 探测链接失败
        if (empty($lists_tmp)) {
            system("echo -e '探测链接列表失败: \\033[31m" . $target_url . "\\033[0m'");
            $result_errr = insert_log($target_url, '探测链接列表失败');
        } else {
            insert_ec_urls($lists_tmp, 0, true, 'spider_ecshop_url');
        }
    }
}
Exemplo n.º 3
0
<?php

require_once 'logic.php';
$query_string = $_SERVER["QUERY_STRING"];
$error_message = "";
$dao = new Dao($db_conf['host'], $db_conf['port'], $db_conf['user'], $db_conf['passwd'], $db_conf['db_name']);
$op_type = -1;
$para = array();
$ret = insert_log($dao, $query_string, INFOBIP, $op_type, $para, $error_message);
if ($ret != 0) {
    live_log(ERROR, $ret, $error_message);
    interface_log(ERROR, $ret, "response:" . $query_string . "err_msg: " . $error_message);
    http_response_code(400);
    echo 202;
    return;
}
$mo_data = array();
$mo_data['mobile_num'] = $para['phone'];
$mo_data['content'] = $para['message'];
$mo_data['link_id'] = $para['transactionid'];
$mo_data['parter_symbol'] = INFOBIP;
$mo_data['mo_addr'] = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
$mo_data['submit_flag'] = 0;
$mo_data['sp_code'] = intval($para['shortcode']);
$mo_data['mo_time'] = date('Y-m-d H:i:s');
$mo_data['transmit_flag'] = Dao::TRANSMIT_FLAG_INITAL;
$linkid = $mo_data['link_id'];
$id = 0;
$ret = write_original_data($dao, $mo_data, true, $id, $error_message);
if ($ret != 0) {
    live_log(ERROR, $ret, $error_message);
<?php

include_once '/../includes/user_function.php';
include_once '/../includes/hw_function.php';
$string = $_POST['password'];
$userid = substr($string, 0, 3);
$password = substr($string, 3);
$result = get_single_user($userid);
if (!empty($result)) {
    if ($result->password == $password) {
        $data = '<1>';
        set_result($data);
        insert_log($result->name);
    } else {
        $data = '<0>';
        set_result($data);
    }
} else {
    $data = '<0>';
    set_result($data);
}
Exemplo n.º 5
0
 /**
  * Function used to add comment 
  */
 function add_comment($comment, $obj_id, $reply_to = NULL, $force_name_email = false)
 {
     global $myquery, $db;
     $collection = $this->get_collection($obj_id);
     if (!$collection) {
         e(lang("collect_not_exist"));
     } else {
         $obj_owner = $this->get_collection_field($collection, "userid");
         $cl_link = $this->collection_links($collection, 'vc');
         $comment = $myquery->add_comment($comment, $obj_id, $reply_to, 'cl', $obj_owner, $cl_link, $force_name_email);
         //echo $comment;
         if ($comment) {
             $log_array = array('success' => 'yes', 'details' => "comment on a collection", 'action_obj_id' => $obj_id, 'action_done_id' => $comment);
             insert_log('collection_comment', $log_array);
             $this->update_total_comments($obj_id);
         }
         return $comment;
     }
 }
Exemplo n.º 6
0
 /**
  * Function used to add video comment
  */
 function add_comment($comment, $obj_id, $reply_to = NULL, $force_name_email = false)
 {
     global $myquery, $db;
     $video = $this->get_video_details($obj_id);
     if (!$video) {
         e(lang("class_vdo_del_err"));
     } else {
         //Getting Owner Id
         $owner_id = $this->get_video_owner($obj_id, true);
         $add_comment = $myquery->add_comment($comment, $obj_id, $reply_to, 'v', $owner_id, videoLink($video), $force_name_email);
         if ($add_comment) {
             //Loggin Comment
             $log_array = array('success' => 'yes', 'details' => "comment on a video", 'action_obj_id' => $obj_id, 'action_done_id' => $add_comment);
             insert_log('video_comment', $log_array);
             //Updating Number of comments of video
             $this->update_comments_count($obj_id);
         }
         return $add_comment;
     }
 }
<?php

session_start();
include 'config.php';
include 'db_functions.php';
$userid = $_SESSION['user_id'];
extract($_GET);
if ($id != "") {
    $fes_name = get_cell('fes', $id, 'fes_name');
    mysql_query("DELETE FROM `fes` WHERE  `id` = '{$id}'");
    //Event 6 = Deleted
    $affected_id = $id;
    $description = "Fes " . $fes_name . " Deleted";
    insert_log($userid, 6, 'fes', $affected_id, $description);
}
?>
<script>
window.top.window.manage_fes();
</script>
Exemplo n.º 8
0
 /**
  * Function used to add video comment
  */
 function add_comment($comment, $obj_id, $reply_to = NULL)
 {
     global $myquery, $db;
     if (!$this->topic_exists($obj_id)) {
         e(lang("grp_tpc_err4"));
     } else {
         $owner = $this->get_group_owner_from_topic($obj_id);
         $add_comment = $myquery->add_comment($comment, $obj_id, $reply_to, 't', $owner);
         if ($add_comment) {
             //Loggin Comment
             $log_array = array('success' => 'yes', 'details' => "comment on a topic", 'action_obj_id' => $obj_id, 'action_done_id' => $add_comment);
             insert_log('topic_comment', $log_array);
             //Updating Number of comments of topics
             $this->update_comments_count($obj_id);
         }
         return $add_comment;
     }
 }
Exemplo n.º 9
0
 /**
  * Function used to add comment
  * This is more advance function , 
  * in this function functions can be applied on comments
  */
 function add_comment($comment, $obj_id, $reply_to = NULL, $type = 'v', $obj_owner = NULL, $obj_link = NULL, $force_name_email = false)
 {
     global $userquery, $eh, $db, $Cbucket;
     //Checking maximum comments characters allowed
     if (defined("MAX_COMMENT_CHR")) {
         if (strlen($comment) > MAX_COMMENT_CHR) {
             e(sprintf("'%d' characters allowed for comment", MAX_COMMENT_CHR));
         }
     }
     if (!verify_captcha()) {
         e(lang('usr_ccode_err'));
     }
     if (empty($comment)) {
         e(lang("pelase_enter_something_for_comment"));
     }
     $params = array('comment' => $comment, 'obj_id' => $obj_id, 'reply_to' => $reply_to, 'type' => $type);
     $this->validate_comment_functions($params);
     /* 		
      if($type=='video' || $type=='v')
      {
      if(!$this->video_exists($obj_id))
      e(lang("class_vdo_del_err"));
     
      //Checking owner of video
      if(!USER_COMMENT_OWN)
      {
      if(userid()==$this->get_vid_owner($obj_id));
      e(lang("usr_cmt_err2"));
      }
      }
     */
     if (!userid() && $Cbucket->configs['anonym_comments'] != 'yes') {
         e(lang("you_not_logged_in"));
     }
     if (!userid() && $Cbucket->configs['anonym_comments'] == 'yes' || $force_name_email) {
         //Checking for input name and email
         if (empty($_POST['name'])) {
             e(lang("please_enter_your_name"));
         }
         if (empty($_POST['email'])) {
             e(lang("please_enter_your_email"));
         }
         $name = mysql_clean($_POST['name']);
         $email = mysql_clean($_POST['email']);
     }
     if (empty($eh->error_list)) {
         $attributes = get_message_attributes($comment);
         if (is_array($attributes)) {
             $attributes = json_encode($attributes);
         }
         $fields = array('type' => $type, 'comment' => $comment, 'comment_attributes' => $attributes, 'type_id' => $obj_id, 'userid' => userid(), 'date_added' => now(), 'parent_id' => $reply_to, 'anonym_name' => $name, 'anonym_email' => $email, 'comment_ip' => mysql_clean(client_ip()), 'type_owner_id' => $obj_owner);
         $cid = db_insert(tbl('comments'), $fields);
         $db->update(tbl("users"), array("total_comments"), array("|f|total_comments+1"), " userid='" . userid() . "'");
         e(lang("grp_comment_msg"), "m");
         //$cid = $db->insert_id();
         $own_details = $userquery->get_user_field_only($obj_owner, 'email');
         $username = username();
         $username = $username ? $username : post('name');
         $useremail = $email;
         //Adding Comment Log
         $log_array = array('success' => 'yes', 'action_obj_id' => $cid, 'action_done_id' => $obj_id, 'details' => "made a comment", 'username' => $username, 'useremail' => $useremail);
         insert_log($type . '_comment', $log_array);
         //sending email
         if (SEND_COMMENT_NOTIFICATION == 'yes' && $own_details) {
             global $cbemail;
             $tpl = $cbemail->get_template('user_comment_email');
             $more_var = array('{username}' => $username, '{obj_link}' => $obj_link . '#comment_' . $cid, '{comment}' => $comment, '{obj}' => get_obj_type($type));
             if (!is_array($var)) {
                 $var = array();
             }
             $var = array_merge($more_var, $var);
             $subj = $cbemail->replace($tpl['email_template_subject'], $var);
             $msg = nl2br($cbemail->replace($tpl['email_template'], $var));
             //Now Finally Sending Email
             cbmail(array('to' => $own_details, 'from' => WEBSITE_EMAIL, 'subject' => $subj, 'content' => $msg));
         }
         add_users_mentioned($comment, NULL, $cid);
         return $cid;
     }
     return false;
 }
Exemplo n.º 10
0
function login($username, $password, $key, $post)
{
    global $empire, $public_r, $dbtbpre, $do_loginauth, $do_ckhloginfile;
    $username = RepPostVar($username);
    $password = RepPostVar($password);
    if (!$username || !$password) {
        printerror("EmptyKey", "index.php");
    }
    //验证码
    $keyvname = 'checkkey';
    if (!$public_r['adminloginkey']) {
        ecmsCheckShowKey($keyvname, $key, 0, 0);
    }
    if (strlen($username) > 30 || strlen($password) > 30) {
        printerror("EmptyKey", "index.php");
    }
    $loginip = egetip();
    $logintime = time();
    CheckLoginNum($loginip, $logintime);
    //认证码
    if ($do_loginauth && $do_loginauth != $post['loginauth']) {
        InsertErrorLoginNum($username, $password, 1, $loginip, $logintime);
        printerror("ErrorLoginAuth", "index.php");
    }
    $user_r = $empire->fetch1("select userid,password,salt,lasttime,lastip from {$dbtbpre}enewsuser where username='******' and checked=0 limit 1");
    if (!$user_r['userid']) {
        InsertErrorLoginNum($username, $password, 0, $loginip, $logintime);
        printerror("LoginFail", "index.php");
    }
    $ch_password = md5(md5($password) . $user_r['salt']);
    if ($user_r['password'] != $ch_password) {
        InsertErrorLoginNum($username, $password, 0, $loginip, $logintime);
        printerror("LoginFail", "index.php");
    }
    //安全问答
    $user_addr = $empire->fetch1("select userid,equestion,eanswer from {$dbtbpre}enewsuseradd where userid='{$user_r['userid']}'");
    if (!$user_addr['userid']) {
        InsertErrorLoginNum($username, $password, 0, $loginip, $logintime);
        printerror("LoginFail", "index.php");
    }
    if ($user_addr['equestion']) {
        $equestion = (int) $post['equestion'];
        $eanswer = $post['eanswer'];
        if ($user_addr['equestion'] != $equestion) {
            InsertErrorLoginNum($username, $password, 0, $loginip, $logintime);
            printerror("LoginFail", "index.php");
        }
        $ckeanswer = ReturnHLoginQuestionStr($user_r['userid'], $username, $user_addr['equestion'], $eanswer);
        if ($ckeanswer != $user_addr['eanswer']) {
            InsertErrorLoginNum($username, $password, 0, $loginip, $logintime);
            printerror("LoginFail", "index.php");
        }
    }
    //取得随机密码
    $rnd = make_password(20);
    $sql = $empire->query("update {$dbtbpre}enewsuser set rnd='{$rnd}',loginnum=loginnum+1,lastip='{$loginip}',lasttime='{$logintime}',pretime='{$user_r['lasttime']}',preip='" . RepPostVar($user_r[lastip]) . "' where username='******' limit 1");
    $r = $empire->fetch1("select groupid,userid,styleid from {$dbtbpre}enewsuser where username='******' limit 1");
    //样式
    if (empty($r[styleid])) {
        $stylepath = $public_r['defadminstyle'] ? $public_r['defadminstyle'] : 1;
    } else {
        $styler = $empire->fetch1("select path,styleid from {$dbtbpre}enewsadminstyle where styleid='{$r['styleid']}'");
        if (empty($styler[styleid])) {
            $stylepath = $public_r['defadminstyle'] ? $public_r['defadminstyle'] : 1;
        } else {
            $stylepath = $styler['path'];
        }
    }
    //设置备份
    $cdbdata = 0;
    $bnum = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsgroup where groupid='{$r['groupid']}' and dodbdata=1");
    if ($bnum) {
        $cdbdata = 1;
        $set5 = esetcookie("ecmsdodbdata", "empirecms", 0, 1);
    } else {
        $set5 = esetcookie("ecmsdodbdata", "", 0, 1);
    }
    ecmsEmptyShowKey($keyvname, 0);
    //清空验证码
    $set4 = esetcookie("loginuserid", $r[userid], 0, 1);
    $set1 = esetcookie("loginusername", $username, 0, 1);
    $set2 = esetcookie("loginrnd", $rnd, 0, 1);
    $set3 = esetcookie("loginlevel", $r[groupid], 0, 1);
    $set5 = esetcookie("eloginlic", "empirecmslic", 0, 1);
    $set6 = esetcookie("loginadminstyleid", $stylepath, 0, 1);
    //COOKIE加密验证
    if (empty($do_ckhloginfile)) {
        DoEDelFileRnd($r[userid]);
    }
    DoECookieRnd($r[userid], $username, $rnd, $cdbdata, $r[groupid], intval($stylepath), $logintime);
    //最后登陆时间
    $set4 = esetcookie("logintime", $logintime, 0, 1);
    $set5 = esetcookie("truelogintime", $logintime, 0, 1);
    //写入日志
    insert_log($username, '', 1, $loginip, 0);
    //FireWall
    FWSetPassword();
    if ($set1 && $set2 && $set3) {
        //操作日志
        insert_dolog("");
        if ($post['adminwindow']) {
            ?>
			<script>
			AdminWin=window.open("admin.php","EmpireCMS","scrollbars");
			AdminWin.moveTo(0,0);
			AdminWin.resizeTo(screen.width,screen.height-30);
			self.location.href="blank.php";
			</script>
		<?php 
            exit;
        } else {
            printerror("LoginSuccess", "admin.php");
        }
    } else {
        printerror("NotCookie", "index.php");
    }
}
            $trow = get_total_row('manual_base', 'account_number', $account_number);
            if ($trow > 0) {
                $update_sql = "UPDATE `manual_base` SET `ivr_flag`='{$ivr_flag}' where `account_number`='{$account_number}'";
                mysql_query($update_sql);
            } else {
                $append_values .= "('{$code}','{$account_number}','{$external_id}','{$account_category}','{$full_name}','{$address}','{$mailzip}','{$billplan}','{$billcycle}','{$fe}','{$cur_file_name}','{$dv}','{$ivr_flag}','{$batch_code}'),";
            }
        }
    }
}
//Remvoing Last comma in appended String
$sql = substr($insert_sql . $append_values, 0, -1);
mysql_query($sql);
$trow = mysql_num_rows(mysql_query("select * from manual_base where 1"));
$description = "Total row in Excel:" . $trow_in_excel . "Total Row in temprory Base : " . $trow;
insert_log($userid, 10, 'manual_base', 0, $description);
function array_push_assoc($array, $key, $value)
{
    $array[$key] = $value;
    return $array;
}
?>
 
<script>
<?php 
if ($error_flag == 1) {
    ?>
alert("<?php 
    echo $error_message;
    ?>
");
Exemplo n.º 12
0
 /**
  * Function used to validate signup form
  */
 function signup_user($array = NULL, $send_signup_email = true)
 {
     global $LANG, $db, $userquery;
     if ($array == NULL) {
         $array = $_POST;
     }
     if (is_array($_FILES)) {
         $array = array_merge($array, $_FILES);
     }
     $this->validate_form_fields($array);
     //checking terms and policy agreement
     if ($array['agree'] != 'yes' && !has_access('admin_access', true)) {
         e(lang('usr_ament_err'));
     }
     if (!verify_captcha()) {
         e(lang('usr_ccode_err'));
     }
     if (!error()) {
         $signup_fields = $this->load_signup_fields($array);
         //Adding Custom Signup Fields
         if (count($this->custom_signup_fields) > 0) {
             $signup_fields = array_merge($signup_fields, $this->custom_signup_fields);
         }
         foreach ($signup_fields as $field) {
             $name = formObj::rmBrackets($field['name']);
             $val = $array[$name];
             if ($field['use_func_val']) {
                 $val = $field['validate_function']($val);
             }
             //Overrides use_func_val
             if ($field['value_function'] && function_exists($field['value_function'])) {
                 $val = $field['value_function']($val);
             }
             if (!empty($field['db_field'])) {
                 $query_field[] = $field['db_field'];
             }
             if (is_array($val)) {
                 $new_val = '';
                 foreach ($val as $v) {
                     $new_val .= "#" . $v . "# ";
                 }
                 $val = $new_val;
             }
             if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) {
                 $val = mysql_clean($val);
             } else {
                 $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
             }
             if (!empty($field['db_field'])) {
                 $query_val[] = $val;
             }
         }
         // Setting Verification type
         if (EMAIL_VERIFICATION == '1') {
             $status = 'unverified';
             $welcome_email = 'no';
         } else {
             $status = 'verified';
             $welcome_email = 'yes';
         }
         if (config('user_moderation') == 'yes') {
             $active = 'no';
         } else {
             $active = 'yes';
         }
         if (has_access('admin_access', true)) {
             if ($array['status'] == 'verified') {
                 $status = 'verified';
                 $welcome_email = 'yes';
             } else {
                 $status = 'unverified';
                 $welcome_email = 'no';
             }
             if ($array['active'] == 'yes') {
                 $active = 'yes';
             } else {
                 $active = 'yes';
             }
             $query_field[] = "level";
             $query_val[] = $array['level'];
         }
         $query_field[] = "status";
         $query_val[] = $status;
         $query_field[] = "active";
         $query_val[] = $active;
         $query_field[] = "\twelcome_email_sent";
         $query_val[] = $welcome_email;
         //Creating AV Code
         $avcode = RandomString(10);
         $query_field[] = "avcode";
         $query_val[] = $avcode;
         //Signup IP
         $signup_ip = $_SERVER['REMOTE_ADDR'];
         $query_field[] = "signup_ip";
         $query_val[] = $signup_ip;
         //Date Joined
         $now = NOW();
         $query_field[] = "doj";
         $query_val[] = $now;
         /**
          * A VERY IMPORTANT PART OF
          * OUR SIGNUP SYSTEM IS
          * SESSION KEY AND CODE
          * WHEN A USER IS LOGGED IN
          * IT IS ONLY VALIDATED BY
          * ITS SIGNUP KEY AND CODE 
          *
          */
         $sess_key = $this->create_session_key($_COOKIE['PHPSESSID'], $array['password']);
         $sess_code = $this->create_session_code();
         $query_field[] = "user_session_key";
         $query_val[] = $sess_key;
         $query_field[] = "user_session_code";
         $query_val[] = $sess_code;
         $query = "INSERT INTO " . tbl("users") . " (";
         $total_fields = count($query_field);
         //Adding Fields to query
         $i = 0;
         foreach ($query_field as $qfield) {
             $i++;
             $query .= $qfield;
             if ($i < $total_fields) {
                 $query .= ',';
             }
         }
         $query .= ") VALUES (";
         $i = 0;
         //Adding Fields Values to query
         foreach ($query_val as $qval) {
             $i++;
             $query .= "'{$qval}'";
             if ($i < $total_fields) {
                 $query .= ',';
             }
         }
         //Finalzing Query
         $query .= ")";
         $db->Execute($query);
         $insert_id = $db->insert_id();
         $db->insert(tbl($userquery->dbtbl['user_profile']), array("userid"), array($insert_id));
         if (!has_access('admin_access', true) && EMAIL_VERIFICATION && $send_signup_email) {
             global $cbemail;
             $tpl = $cbemail->get_template('email_verify_template');
             $more_var = array('{username}' => post('username'), '{password}' => post('password'), '{email}' => post('email'), '{avcode}' => $avcode);
             if (!is_array($var)) {
                 $var = array();
             }
             $var = array_merge($more_var, $var);
             $subj = $cbemail->replace($tpl['email_template_subject'], $var);
             $msg = nl2br($cbemail->replace($tpl['email_template'], $var));
             //Now Finally Sending Email
             //cbmail(array('to'=>post('email'),'from'=>WEBSITE_EMAIL,'subject'=>$subj,'content'=>$msg));
         } elseif (!has_access('admin_access', true) && $send_signup_email) {
             //$this->send_welcome_email($insert_id);
         }
         $log_array = array('username' => $array['username'], 'userid' => $insert_id, 'userlevel' => $array['level'], 'useremail' => $array['email'], 'success' => 'yes', 'details' => sprintf("%s signed up", $array['username']));
         //Login Signup
         insert_log('signup', $log_array);
         //Adding User has Signup Feed
         addFeed(array('action' => 'signup', 'object_id' => $insert_id, 'object' => 'signup', 'uid' => $insert_id));
         return $insert_id;
     }
     return false;
 }
Exemplo n.º 13
0
 function submit_upload($array = NULL)
 {
     global $eh, $Cbucket, $db, $userquery;
     if (!$array) {
         $array = $_POST;
     }
     $this->validate_video_upload_form($array, TRUE);
     if (empty($eh->error_list)) {
         $required_fields = $this->loadRequiredFields($array);
         $location_fields = $this->loadLocationFields($array);
         $option_fields = $this->loadOptionFields($array);
         $upload_fields = array_merge($required_fields, $location_fields, $option_fields);
         //Adding Custom Upload Fields
         if (count($this->custom_upload_fields) > 0) {
             $upload_fields = array_merge($upload_fields, $this->custom_upload_fields);
         }
         //Adding Custom Form Fields
         if (count($this->custom_form_fields) > 0) {
             $upload_fields = array_merge($upload_fields, $this->custom_form_fields);
         }
         $userid = userid();
         if (!userid() && has_access('allow_video_upload', true, false)) {
             $userid = $userquery->get_anonymous_user();
             //$userid = $user['userid'];
         } elseif (userid() && !has_access('allow_video_upload', true, true)) {
             return false;
         }
         if (is_array($_FILES)) {
             $array = array_merge($array, $_FILES);
         }
         foreach ($upload_fields as $field) {
             $name = formObj::rmBrackets($field['name']);
             $val = $array[$name];
             if ($field['use_func_val']) {
                 $val = $field['validate_function']($val);
             }
             if (!empty($field['db_field'])) {
                 $query_field[] = $field['db_field'];
             }
             if (is_array($val)) {
                 $new_val = '';
                 foreach ($val as $v) {
                     $new_val .= "#" . $v . "# ";
                 }
                 $val = $new_val;
             }
             if (!$field['clean_func'] || !apply_func($field['clean_func'], $val) && !is_array($field['clean_func'])) {
                 $val = mysql_clean($val);
             } else {
                 $val = apply_func($field['clean_func'], sql_free($val));
             }
             if (empty($val) && !empty($field['default_value'])) {
                 $val = $field['default_value'];
             }
             if (!empty($field['db_field'])) {
                 $query_val[] = $val;
             }
         }
         //Adding Video Code
         $query_field[] = "file_name";
         $file_name = mysql_clean($array['file_name']);
         $query_val[] = $file_name;
         //ADding Video Key
         $query_field[] = "videokey";
         $query_val[] = $this->video_keygen();
         //Userid
         $query_field[] = "userid";
         if (!$array['userid']) {
             $query_val[] = $userid;
         } else {
             $query_val[] = $array['userid'];
         }
         //Upload Ip
         $query_field[] = "uploader_ip";
         $query_val[] = $_SERVER['REMOTE_ADDR'];
         $activation = ACTIVATION;
         //Setting Activation Option
         if ($activation == 0) {
             $active = 'yes';
         } else {
             $active = 'no';
         }
         $query_field[] = "active";
         $query_val[] = $active;
         $query_field[] = "date_added";
         $query_val[] = now();
         $query_field[] = 'file_directory';
         $query_val[] = $array['file_directory'];
         /*$query = "INSERT INTO " . tbl("video") . " (";
                     $total_fields = count($query_field);
         
                     //Adding Fields to query
                     $i = 0;
                     foreach ($query_field as $qfield) {
                         $i++;
                         $query .= $qfield;
                         if ($i < $total_fields)
                             $query .= ',';
                     }
         
                     $query .= ") VALUES (";
         
         
                     $i = 0;
                     //Adding Fields Values to query
                     foreach ($query_val as $qval) {
                         $i++;
                         $query .= "'$qval'";
                         if ($i < $total_fields)
                             $query .= ',';
                     }
         
                     //Finalzing Query
                     $query .= ")";
                     */
         $the_fields = array();
         $total_fields = count($query_field);
         for ($i = 0; $i < $total_fields; $i++) {
             $the_fields[$query_field[$i]] = $query_val[$i];
         }
         //exit($query);
         if (!userid() && !has_access('allow_video_upload', false, false)) {
             e(lang("you_not_logged_in"));
             //exit();
         } else {
             $insert_id = file_name_exists($file_name);
             if (!$insert_id) {
                 //$db->Execute($query);
                 $insert_id = db_insert(tbl('video'), $the_fields);
                 //loggin Upload
                 $log_array = array('success' => 'yes', 'action_obj_id' => $insert_id, 'userid' => $userid, 'details' => "uploaded a video");
                 insert_log('upload_video', $log_array);
                 $db->update(tbl("users"), array("total_videos"), array("|f|total_videos+1"), " userid='" . $userid . "'");
             }
         }
     }
     //Adding Video Feed
     //addFeed(array('action' => 'upload_video', 'object_id' => $insert_id, 'object' => 'video'));
     return $insert_id;
 }
Exemplo n.º 14
0
feedback("Attendance Portal - Feedback");
if (isset($_POST['post'])) {
    include 'config/db.php';
    include 'config/settings.php';
    $dbname = $branchyear . '_Logs';
    $table = $branchyear . '_Feedback';
    $ftype = $_POST['ftype'];
    $Sentby = $_SESSION['UserId'];
    $sub = trim(htmlentities(addslashes($_POST['sub'])));
    //$feedback = trim(htmlentities(addslashes($_POST['fb'])));
    //$feedback = trim(htmlentities(addslashes(str_replace("\n","<br>",$_POST['fb']))));
    $feedback = trim(str_replace("\n", "<br>", $_POST['fb']));
    if (strlen($sub) < 6) {
        echo "<script>show_error('Subject Length Must Be Lessthan or equals to 6');</script>";
        exit;
    }
    if (strlen($feedback) < 10) {
        echo "<script>show_error('Feedback Length Must Be Lessthan or equals to 10');</script>";
        exit;
    }
    $datetime = date('d/m/Y H:i:s');
    $ip = $_SERVER['REMOTE_ADDR'];
    //if(!mysql_select_db($dbname)) die(mysql_error());
    $query = "INSERT INTO " . $table . "(`Ftype`,`Subject`,`Feedback`,`Sentby`,`DateTime`,`IP`) VALUES('{$ftype}','{$sub}','{$feedback}','{$Sentby}','{$datetime}','{$ip}');";
    if (mysql_query($query)) {
        echo "<script>show_success('Your Feedback posted successfully..Thank you');</script>";
        insert_log($_SESSION['UserId'] . " sent feedback");
    } else {
        die(mysql_error());
    }
}
Exemplo n.º 15
0
 /**
  * Function used to create new playlist
  * @param ARRAY
  */
 function create_playlist($params)
 {
     global $db;
     //Similar to extract but adding mysql_clean
     $newarray = array_map('mysql_clean', $params);
     extract($newarray);
     if (!$category) {
         $category = 'normal';
     }
     if ($log_messages != 'no') {
         $log_messages = 'yes';
     }
     if (!userid()) {
         e(lang("please_login_create_playlist"), "e");
     } elseif (empty($name)) {
         e(lang("please_enter_playlist_name"), "e", "playlist_name");
     } elseif ($this->playlist_exists($name, userid(), $this->type, $category)) {
         e(sprintf(lang("play_list_with_this_name_arlready_exists"), $name), "e", "playlist_name");
     } else {
         $fields = array('playlist_name', 'userid', 'description', 'tags', 'playlist_type', 'privacy', 'allow_comments', 'allow_rating', 'date_added', 'category');
         $values = array($name, userid(), $description, $tags, $this->type, $privacy, $allow_comments, $allow_rating, now(), $category);
         $db->insert(tbl($this->playlist_tbl), $fields, $values);
         if ($log_messages == 'yes') {
             e(lang("new_playlist_created"), "m");
         }
         $pid = $db->insert_id();
         //Logging Playlist
         $log_array = array('success' => 'yes', 'details' => "created playlist", 'action_obj_id' => $pid);
         insert_log('add_playlist', $log_array);
         return $pid;
     }
     return false;
 }
Exemplo n.º 16
0
 public function deleteOne($params)
 {
     $table = $this->getTableName();
     $rs = ['status' => 0, 'id' => 0, 'info' => ''];
     $status = $this->where(array('id' => $params['id']))->save(['deleted_at' => NOW_TIME, 'updated_at' => NOW_TIME]);
     if (!$status) {
         $rs['info'] = "删除{$table}失败";
     } else {
         $rs = ['status' => 1, 'id' => $params['id'], 'info' => "删除{$table}成功"];
     }
     insert_log(['manage_id' => manage_id(), 'table' => $table, 'table_id' => $params['id'], 'biaoti' => $rs['info']]);
     return $rs;
 }
Exemplo n.º 17
0
 /**
  * Function used to add content to favorits
  */
 function add_to_fav($id)
 {
     global $db;
     $id = mysql_clean($id);
     //First checking weather object exists or not
     if ($this->exists($id)) {
         if (userid()) {
             if (!$this->fav_check($id)) {
                 $db->insert(tbl($this->fav_tbl), array('type', 'id', 'userid', 'date_added'), array($this->type, $id, userid(), NOW()));
                 addFeed(array('action' => 'add_favorite', 'object_id' => $id, 'object' => 'video'));
                 //Loggin Favorite
                 $log_array = array('success' => 'yes', 'details' => "added " . $this->name . " to favorites", 'action_obj_id' => $id, 'action_done_id' => $db->insert_id());
                 insert_log($this->name . '_favorite', $log_array);
                 //e(sprintf(lang('add_fav_message'),$this->name),'m');
                 e('<div class="alert alert-success">This video has been added to your favorites</div>', "m");
             } else {
                 e(sprintf(lang('already_fav_message'), $this->name));
             }
         } else {
             e(lang("you_not_logged_in"));
         }
     } else {
         e(sprintf(lang("obj_not_exists"), $this->name));
     }
 }
        $icrm_total += $batch_icrm;
        $ivr_accepted_total += $batch_accpeted;
        $ivr_rejected_total += $batch_rejected;
        $ivr_hold_total += $batch_hold;
        $ivr_pending_total += $batch_pending;
    }
    $excel->writeRow();
    $excel->writeCol("Grand Total");
    $excel->writeCol("");
    $excel->writeCol($ivr_all_total);
    $excel->writeCol($icrm_total);
    $excel->writeCol($ivr_accepted_total);
    $excel->writeCol($ivr_rejected_total);
    $excel->writeCol($ivr_hold_total);
    $excel->writeCol($ivr_pending_total);
    $excel->writeCol("");
    $excel->close();
    echo "data is write into {$file_name} Successfully.";
}
//Event 14 = Excel Download
$affected_id = "none";
$description = " Excel Downloaded in the File Name of " . $file_name;
insert_log($userid, 11, 'none', $affected_id, $description);
?>
 
<script>
window.location="<?php 
echo $file_name;
?>
"
</script>
<?php

session_start();
include 'config.php';
include 'db_functions.php';
$userid = $_SESSION['user_id'];
extract($_POST);
$dob = date_mysql($dob);
//$date_of_joining = date_mysql($date_of_joining);
$update_sql = "UPDATE `userinfo` SET `user_type`={$user_type},`name`='{$name}',`dob`='{$dob}',`mobile`='{$mobile}',`email`='{$email}',`password`='{$password}',`address_1`='{$address_1}',`address_2`='{$address_2}',`town_city_county`='{$town_city_county}',`postcode`='postcode' WHERE `id` = '{$user_id}'";
mysql_query($update_sql);
//Event 5 = updated
$affected_id = $user_id;
$description = $name . " Updated";
insert_log($userid, 5, 'userinfo', $affected_id, $description);
?>
<script>

window.top.window.manage_user();
</script>
Exemplo n.º 20
0
function homepage($title)
{
    if (!check("BA") || !check('BA')) {
        header('location:login.php');
    } else {
        include "config/globals.php";
        include 'config/db.php';
        include 'config/settings.php';
        $qs = $_SERVER["QUERY_STRING"];
        $reg1 = "/^" . $globalbranch . "[1-" . $classno . "]\$/";
        $reg2 = "/^P[1-4]\$/";
        $reg3 = "/^[0-9]{2}-[0-9]{2}-[0-9]{4}\$/";
        $reg4 = "/^all\$/";
        $p = explode('/', $qs);
        $len = count($p);
        echo "<!DOCTYPE html>\n<html id='con2'>\n";
        display_headers($title);
        echo "\n<body>";
        menu();
        echo <<<a
\t\t\t<div class='container' id='con1'>
\t\t\t\t<div id="error"></div>
\t\t\t\t<div class='row'>
\t\t\t\t<div class='span9'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
        if ($len == 3 or $len == 4 && $p[3] == "") {
            if (preg_match($reg1, $p[0]) && (preg_match($reg2, $p[1]) or preg_match($reg4, $p[1])) && preg_match($reg3, $p[2])) {
                $ar = explode('-', $p[2]);
                if (checkdate($ar[1], $ar[0], $ar[2])) {
                    $lockfile = str_replace("/", "_", $qs);
                    if (file_exists("assets/tmp/" . $lockfile)) {
                        echo "<script>show_error('Request in Progress');</script>";
                    } else {
                        exec("> assets/tmp/" . $lockfile);
                        $dbname = $branchyear . '_Dates';
                        $table = $p[0] . '_Dates';
                        //if(!mysql_select_db($dbname)) {die(mysql_error());}
                        $date_sub = $p[2];
                        $n = mysql_num_rows(mysql_query("select * from {$table} where Date = '{$date_sub}';"));
                        if ($n == 0) {
                            echo "<script>show_error('{$date_sub} not found ');</script>";
                        } else {
                            $pcount = 1;
                            $remaining = array();
                            $j = 0;
                            $uploaded = array();
                            $j1 = 0;
                            $confirmed = array();
                            $j2 = 0;
                            if ($p[1] == "all") {
                                for ($i = 1; $i <= 4; $i++) {
                                    $tmp = "P" . $i . "_Con";
                                    $tmp1 = "P" . $i;
                                    $q = mysql_query("select `{$tmp}`,`{$tmp1}` from {$table} where Date = '{$date_sub}'; ") or die(mysql_error());
                                    $res = mysql_fetch_array($q);
                                    if ($res[$tmp1] == 'ok' && $res[$tmp] == null) {
                                        $remaining[$j] = "P" . $i;
                                        $j++;
                                    }
                                }
                            } else {
                                $remaining[$j] = $p[1];
                            }
                            for ($r = 1; $r <= count($remaining); $r++) {
                                $tmp = "P" . $r . "_Con";
                                $tmp1 = "P" . $r;
                                $q = mysql_query("select `{$tmp}`,`{$tmp1}` from {$table} where Date = '{$date_sub}'; ") or die(mysql_error());
                                $res = mysql_fetch_array($q);
                                if ($res[$tmp] == 'ok') {
                                    $uploaded[$j1] = $tmp1;
                                    $j1++;
                                }
                                if ($res[$tmp1] == 'ok') {
                                    $confirmed[$j2] = $tmp1;
                                    $j2++;
                                }
                            }
                            //print_r($remaining);
                            if (count($uploaded) != 4) {
                                $cou = 0;
                                $str2 = "";
                                for ($r = 0; $r < count($remaining); $r++) {
                                    $period1 = $remaining[$r];
                                    $tmp = $period1 . "_Con";
                                    $tmp1 = $period1;
                                    $q = mysql_query("select {$tmp}, {$tmp1} from  {$table} where Date = '{$date_sub}';") or die(mysql_error());
                                    $res = mysql_fetch_array($q);
                                    if ($res[$tmp] == 'ok') {
                                        echo "<script>show_error('{$period1} already confirmed ');</script>";
                                    } else {
                                        if ($res[$tmp1] != 'ok') {
                                            $str2 .= $period1 . " ";
                                            echo "<script>show_error('{$str2} &nbsp;attendance not uploaded');</script>";
                                        } else {
                                            $dbname = $branchyear . '_Cache';
                                            $table = $p[0] . '_Cache';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}")) or die(mysql_error());
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $f = mysql_query("show columns from `{$table}` like '{$date_sub}';") or die(mysql_error());
                                            $val = mysql_num_rows($f) ? True : False;
                                            if (!$val) {
                                                mysql_query("alter table `{$table}` add (`{$date_sub}` varchar(30) default '');") or die(mysql_error());
                                            }
                                            insert_log($_SESSION['UserId'] . " added {$date_sub} to {$table}");
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("select isnull (`{$date_sub}`) as Date from {$table};") or die(mysql_error());
                                            $res = mysql_fetch_array($q);
                                            $strs = array();
                                            $strs1 = array();
                                            if (!$res['Date']) {
                                                $dbname = $branchyear . '_Cache';
                                                $table = $p[0] . '_Cache';
                                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                                for ($k = 1; $k <= $class_total; $k++) {
                                                    $a12 = mysql_query("Select `" . $date_sub . "_" . $remaining[$r] . "`  from `{$table}` where RNo='{$k}';") or die(mysql_error());
                                                    $b12 = mysql_fetch_array($a12);
                                                    $strs[$k] = $remaining[$r] . "_" . $b12[0] . ",";
                                                }
                                                $dbname = $branchyear . '_Attendance';
                                                $table = $p[0] . '_Attendance';
                                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                                for ($k = 1; $k <= $class_total; $k++) {
                                                    $a12 = mysql_query("Select `" . $date_sub . "`from `{$table}` where RNo='{$k}';") or die(mysql_error());
                                                    $b12 = mysql_fetch_array($a12);
                                                    if ($b12[$date_sub] == null) {
                                                        $strs1[$k] = $strs[$k];
                                                    } else {
                                                        $strs1[$k] = $b12[$date_sub] . $strs[$k];
                                                    }
                                                }
                                            }
                                            $dbname = $branchyear . '_Attendance';
                                            $table = $p[0] . '_Attendance';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            for ($k = 1; $k <= $class_total; $k++) {
                                                if (in_array($k, $exp[$p[0]])) {
                                                    continue;
                                                }
                                                $a12 = mysql_query("update {$table} set `" . $date_sub . "` = '" . $strs1[$k] . "' where RNo = '" . $k . "';") or die(mysql_error());
                                            }
                                            $dbname = $branchyear . '_TimeTable';
                                            $table = $p[0] . '_TimeTable';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $dates1 = getdate(strtotime($date_sub));
                                            //$date=$dates[$r];
                                            $day = substr($dates1["weekday"], 0, 3);
                                            $per = $p[1] == 'all' ? $remaining[$r] : $p[1];
                                            $ti = mysql_query("SELECT DayPeriod,{$day} from {$table} where DayPeriod = '" . $per . "';") or die(mysql_error());
                                            $subjects = array();
                                            while ($da = mysql_fetch_array($ti)) {
                                                $subjects[$da[0]] = $da[1];
                                            }
                                            $dbname = $branchyear . '_Subjects';
                                            $table = $p[0] . '_Subjects';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            for ($k = 1; $k <= $class_total; $k++) {
                                                if (in_array($k, $exp[$p[0]])) {
                                                    continue;
                                                }
                                                $st = strtoupper(substr($strs[$k], -2, -1));
                                                $sub = $subjects[$per];
                                                $q = mysql_query("select `" . $sub . "_" . $st . "` from {$table} where RNo = '{$k}';") or die(mysql_error());
                                                $res = mysql_fetch_array($q);
                                                $subcount = $res[0] + 1;
                                                $a12 = mysql_query("update {$table} set `" . $sub . "_" . $st . "` = '" . $subcount . "' where RNo = '" . $k . "';") or die(mysql_error());
                                            }
                                            $dbname = $branchyear . '_Cache';
                                            $table = $p[0] . '_Cache';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("alter table `{$table}` drop `" . $date_sub . "_" . $per . "`;");
                                            $dbname = $branchyear . '_Dates';
                                            $table = $p[0] . '_Dates';
                                            //if(!mysql_select_db($dbname)) die(mysql_error());
                                            $q = mysql_query("update {$table} set `{$tmp}` = 'ok' where Date = '{$date_sub}';") or die(mysql_error());
                                            $cou++;
                                        }
                                    }
                                }
                                if ($cou == count($remaining) && $cou != 0) {
                                    $abz = count($remaining);
                                    $st = "";
                                    for ($s = 0; $s < $abz; $s++) {
                                        if ($s == $abz - 1) {
                                            $st .= $remaining[$s];
                                        } else {
                                            $st .= $remaining[$s] . ", ";
                                        }
                                    }
                                    insert_log($_SESSION['UserId'] . " uploaded {$st} Attendance");
                                    echo "<script>show_success('{$st} attendance updated ');</script>";
                                } else {
                                    if (in_array($p[1], $confirmed)) {
                                        echo "<script>show_error('" . $p[1] . " already updated');</script>";
                                    }
                                    if (in_array($p[1], $uploaded)) {
                                        echo "<script>show_error('" . $p[1] . " attendance already confirmed');</script>";
                                    }
                                    if ($p[1] == 'all') {
                                        echo "<script>show_error('" . $p[1] . " uploaded fields are already confirmed');</script>";
                                    }
                                }
                            } else {
                                $abz = count($confirmed);
                                $st = "";
                                for ($s = 0; $s < $abz; $s++) {
                                    if ($s == $abz - 1) {
                                        $st .= $confirmed[$s];
                                    } else {
                                        $st .= $confirmed[$s] . ", ";
                                    }
                                }
                                echo "<script>show_error('{$st} &nbsp;attendance not yet uploaded');</script>";
                            }
                        }
                        unlink("assets/tmp/" . $lockfile);
                    }
                } else {
                    echo "<script>show_error('Invalid Date Sent');</script>";
                }
            } else {
                echo "<script>show_error('Invalid Input Sent');</script>";
            }
        }
        if (preg_match($reg1, $p[0])) {
            echo '<h4>Confirm Uploads </h4> <h5> &emsp;&emsp;&emsp; - &emsp; Below records need to be confirmed. </h5>';
            $qs = $p[0];
            $dbname = $branchyear . '_Dates';
            $table = $qs . '_Dates';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $new = mysql_query("SELECT `Date` FROM `{$table}` WHERE P1_Con IS NULL OR P2_Con IS NULL OR P3_Con IS NULL OR P4_Con IS NULL") or die(mysql_error());
            if (mysql_num_rows($new) == 0) {
                echo "<span class='text-error'><b>No records found</b></span>";
            } else {
                $dates = array();
                $i = 0;
                while ($res = mysql_fetch_row($new)) {
                    $dates[$i] = $res[0];
                    $i++;
                }
                for ($l = 0; $l < count($dates); $l++) {
                    $dates1 = getdate(strtotime($dates[$l]));
                    $date = $dates[$l];
                    $day = substr($dates1["weekday"], 0, 3);
                    $dbname = $branchyear . '_TimeTable';
                    $table = $qs . '_TimeTable';
                    //if(!mysql_select_db($dbname))  die(mysql_error());
                    $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                    $subjects = array();
                    while ($da = mysql_fetch_array($ti)) {
                        $subjects[$da[0]] = $da[1];
                    }
                    $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0);
                    $dbname = $branchyear . '_Dates';
                    $table = $qs . '_Dates';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $remaining = array();
                    $j = 0;
                    $remaining1 = array();
                    $j1 = 0;
                    $confirmed = array();
                    $j2 = 0;
                    $confirmed1 = array();
                    $j3 = 0;
                    for ($i = 1; $i <= 4; $i++) {
                        $tmp = "P" . $i;
                        $tmp1 = "P" . $i . "_Con";
                        $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$date}' ") or die(mysql_error());
                        $res = mysql_fetch_array($q);
                        if ($res["P" . $i]) {
                            $remaining[$j] = "P" . $i;
                            $j++;
                        } else {
                            $remaining1[$j1] = "P" . $i;
                            $j1++;
                        }
                        if ($res["P" . $i . "_C"]) {
                            $confirmed[$j2] = "P" . $i;
                            $j2++;
                        } else {
                            $confirmed1[$j3] = "P" . $i;
                            $j3++;
                        }
                    }
                    $dbname = $branchyear . '_Cache';
                    $table = $qs . '_Cache';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    //print_r($confirmed);
                    $a = $date . "_";
                    $q = mysql_query("SELECT * FROM {$table}") or die(mysql_error());
                    while ($q1 = mysql_fetch_array($q)) {
                        for ($i = 0; $i < count($confirmed); $i++) {
                            $tmp2 = $a . $confirmed[$i];
                            //print_r($q1);
                            if ($q1[$tmp2] == "A") {
                                $p[$confirmed[$i] . "_A"]++;
                            }
                            if ($q1[$tmp2] == "P") {
                                $p[$confirmed[$i] . "_P"]++;
                            }
                        }
                    }
                    //print_r($p);echo "<br>";
                    if (count($confirmed1) != 0) {
                        $dbname = $branchyear . '_Attendance';
                        $table = $qs . '_Attendance';
                        //if(!mysql_select_db($dbname))die(mysql_error());
                        $q = mysql_query("SELECT `{$date}` FROM {$table};") or die(mysql_error());
                        while ($res = mysql_fetch_array($q)) {
                            $z = explode(",", $res[$date], -1);
                            for ($m = 0; $m < count($z); $m++) {
                                $p[$z[$m]] += 1;
                            }
                        }
                    }
                    //print_r($p);
                    $a = $date . "_P";
                    $li1 = "?{$qs}/all/{$date}";
                    echo <<<main
\t\t\t\t<div id="Date{$a}">
\t\t\t\t\t<ul class="nav nav-pills span8">
\t\t\t\t\t\t<li><h5><i class="icon-calendar"></i> {$date} &nbsp;@&nbsp;{$qs}</h5> </li>
main;
                    echo <<<main
\t\t\t\t<li class="pull-right"><h6><span class="text-success"><i class="icon-ok-circle"></i> <a href="{$li1}" class="text-success">Confirm All</a></span> &emsp;</h6></li>
main;
                    echo <<<main
\t\t\t\t</ul>
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t<table class="table  table-hover table-bordered"  style="padding:0px;">
\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t<tr>  <th style="text-align:center;"> Subject </th>  <th style="text-align:center;" class="span1"> Period  </th> 
\t\t\t\t\t\t\t<th class="span1" style="text-align:center;"> Absents </th> <th class="span1" style="text-align:center;"> Presents </th> 
\t\t\t\t\t\t\t <th class="span4" style="text-align:center;"> Options</th> </tr>
\t\t\t\t\t\t</thead>
\t\t\t\t\t\t<tbody>
main;
                    for ($j = 1; $j <= 4; $j++) {
                        if (!in_array("P" . $j, $remaining)) {
                            echo '<tr><td style="text-align:center;">' . $subjects["P" . $j] . '</td><td style="text-align:center;">' . "P" . $j . '</td> 
							<td style="text-align:center;" class="text-error">' . $p["P" . $j . "_A"] . '</td> <td style="text-align:center;" class="text-success"> ' . $p["P" . $j . "_P"] . ' </td> 
							<td style="text-align:center;">';
                            if (in_array("P" . $j, $confirmed1)) {
                                echo ' <span class="text-success" >Confirmed</span>';
                            } else {
                                $li = "?{$qs}/P{$j}/{$date}";
                                $li1 = "./today1.php?{$date}/{$qs}";
                                echo ' <span class="text-success" ><i class="icon-ok-circle"></i> <a href="' . $li . '" class="text-success">Confirm </a></span> &emsp;	';
                                echo ' <span class="text-error" ><i class="icon-edit"></i> <a href="' . $li1 . '" class="text-error">Edit </a></span>';
                            }
                            echo ' &emsp; <span class="text-info"><i class="icon-globe"></i> <a href="#' . $a . $j . '" class="text-info"  data-toggle="modal">Browse</a> </span></td> </tr>';
                        }
                    }
                    echo <<<main
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<br>
\t\t\t\t
main;
                    for ($j = 1; $j <= 4; $j++) {
                        if (!in_array("P" . $j, $remaining)) {
                            echo <<<confirm
\t\t\t\t\t\t
<div id="{$a}{$j}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true">
\t\t\t\t\t\t\t<div class="modal-header">
\t\t\t\t\t\t\t<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
\t\t\t\t\t\t\t<h4 id="useridlabel">{$qs} @ P{$j} Attendance Details</h4>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="modal-body">
\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t<div class="span6">
\t\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t\t\t<tr> <td class="span2" style="text-align:center"> Date </td> <th class="text-warning span2" style="text-align:center"> {$date}</th> 
\t\t\t\t\t\t\t\t\t\t<td class="span2" style="text-align:center"> Subject </td> <th class="text-success span2" style="text-align:center"> {$subjects["P" . $j]}&nbsp;</th> </tr>
\t\t\t\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t\t\t</table>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t<div class="span6">
\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t\t\t<tr> <th class="span2"  style="text-align:center"> Period # </th> <th class="span3"> Presents  </th> <th class="span3"> Absents  </th> </tr>
\t\t\t\t\t\t\t\t</thead>
\t\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t\t<tr><td style="text-align:center;" >P{$j}</td>
confirm;
                            $dbname = $branchyear . '_Dates';
                            $table = $qs . '_Dates';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $q = mysql_query("select ISNULL(`P" . $j . "_Con`) as `P{$j}` from {$table} where Date = '{$date}'; ") or die(mysql_error());
                            $row = mysql_fetch_array($q);
                            if (!$row["P" . $j]) {
                                $period = "P" . $j;
                                $dbname = $branchyear . '_Attendance';
                                $table = $qs . '_Attendance';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q = mysql_query("select RNo,`{$date}` from {$table};") or die(mysql_error());
                                $Rnos = array("Absents" => array(), "Presents" => array());
                                $aindex = 0;
                                $pindex = 0;
                                while ($res = mysql_fetch_array($q)) {
                                    $z = explode(",", $res[$date]);
                                    for ($m = 0; $m < count($z); $m++) {
                                        $y = explode("_", $z[$m]);
                                        if ($y[0] == $period) {
                                            if ($y[1] == "A") {
                                                $Rnos['Absents'][$aindex] = $res[0];
                                                $aindex++;
                                            } else {
                                                $Rnos['Presents'][$pindex] = $res[0];
                                                $pindex++;
                                            }
                                        }
                                    }
                                }
                            } else {
                                $dbname = $branchyear . '_Cache';
                                $table = $qs . '_Cache';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q3 = mysql_query("SELECT RNo, `" . $a . $j . "` FROM {$table}") or die(mysql_error());
                                $Rnos = array("Absents" => array(), "Presents" => array());
                                $aindex = 0;
                                $pindex = 0;
                                while ($individual = mysql_fetch_array($q3)) {
                                    if ($individual[$a . $j] == "A") {
                                        $Rnos["Absents"][$aindex] = $individual["RNo"];
                                        $aindex++;
                                    }
                                    if ($individual[$a . $j] == "P") {
                                        $Rnos["Presents"][$pindex] = $individual["RNo"];
                                        $pindex++;
                                    }
                                }
                            }
                            $pc = count($Rnos["Presents"]);
                            $ac = count($Rnos["Absents"]);
                            $tot = $pc + $ac;
                            echo "<td>";
                            for ($i = 0; $i < $pc; $i++) {
                                if ($i % 8 == 0 && $i != 0) {
                                    echo "<br>";
                                }
                                if ($i == $pc - 1) {
                                    echo $Rnos["Presents"][$i];
                                } else {
                                    echo $Rnos["Presents"][$i] . ",";
                                }
                            }
                            echo "</td><td>";
                            for ($i = 0; $i < $ac; $i++) {
                                if ($i % 8 == 0 && $i != 0) {
                                    echo "<br>";
                                }
                                if ($i == $ac - 1) {
                                    echo $Rnos["Absents"][$i];
                                } else {
                                    echo $Rnos["Absents"][$i] . ",";
                                }
                            }
                            echo <<<confirm1
\t\t\t\t\t\t\t</td></tr>
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" >Total (<b>{$tot}</b>)</td>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class='text-success'> {$pc}</td>
\t\t\t\t\t\t\t\t\t<td style="text-align:center;" class='text-error'>{$ac}</td>
\t\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t</tbody>
\t\t\t\t\t\t\t</table>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="modal-footer">
\t\t\t\t\t\t<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
confirm1;
                        }
                    }
                }
            }
            echo "</div></div>";
            echo "<div class='span3'>";
            go_home();
            echo "<ul class='nav nav-tabs nav-stacked'>";
            for ($i = 1; $i <= $classno; $i++) {
                $branch = $globalbranch;
                $cls = $branch . $i;
                $table = $cls . '_Dates';
                $remaining = array();
                $j = 0;
                $q = mysql_query("select * from {$table} ; ") or die(mysql_error());
                while ($res = mysql_fetch_array($q)) {
                    if ($res["P1_Con"] != 'ok' or $res["P2_Con"] != 'ok' or $res["P3_Con"] != 'ok' or $res["P4_Con"] != 'ok') {
                        $remaining[$j++] = $res['Date'];
                    }
                }
                $str1 = count($remaining) != 0 ? "<i class='icon-remove pull-right text-error' style='padding-top:5px;'></i>" : "<i class='icon-ok pull-right text-success' style='padding-top:5px;'></i>";
                //echo $str1;
                echo <<<a
\t\t\t\t<li><a href="?{$branch}{$i}">{$branch}{$i}<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i> {$str1} </a> </li>

a;
            }
            echo "</ul>";
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
Exemplo n.º 21
0
    $task_status = $v['status'];
    $chatset = $v['charset'];
    $rules = array();
    if ($task_status == 'yes') {
        system("echo -e '开始抓取\\033[34m[" . $v['node_name'] . "]\\033[0m...'");
        $rules = json_decode($v['link_rules'], true);
        // 获取内容的链接
        $link_list = array();
        $link_list = get_link_list($rules['list_rule']);
        $link_list_count = count($link_list);
        system("echo -e '获取到\\033[32m[" . $link_list_count . "]\\033[0m个列表列表链接,准备获取文章链接...'");
        foreach ($link_list as $vo) {
            system("echo -e '获取列表内容链接: \\033[32m" . $vo . "\\033[0m'");
            $content = '';
            $content = http_client_request($vo);
            if ($chatset != 'utf-8') {
                iconv($chatset, "UTF-8", $content);
            }
            // print_r($content);exit;
            $target_urls = array();
            $target_urls = get_content_url_list($content, $rules['list_area']);
            // 探测链接失败
            if (empty($target_urls)) {
                system("echo -e '探测链接列表失败: \\033[31m" . $vo . "\\033[0m'");
                $result_errr = insert_log($vo, '探测链接列表失败');
            } else {
                insert_urls($target_urls, $task_list_id, true);
            }
        }
    }
}
Exemplo n.º 22
0
            $branch = $globalbranch;
            $class = $cls1;
        } else {
            $branch = $row['Branch'];
            $class = $row['Class'];
            if ($cls1 != $class) {
                echo "'Error: Nor authorised to access {$cls1} details";
                die;
            }
        }
        $table = $branch . $class . "_Dates";
        $q = mysql_query("select * from {$table} where Date = '{$date}' ");
        if (mysql_num_rows($q) == 0) {
            echo "'Error: Invalid  Date in Database";
        } else {
            $row = mysql_fetch_array($q);
            if ($row[$period . '_Con'] == 'ok') {
                echo "'Error: unable to update {$period} already confirmed";
            } else {
                if ($row[$period] != 'ok') {
                    echo "'Error: unable to update {$period} attendance not yet uploaded";
                } else {
                    $table = $branch . $class . "_Cache";
                    $q = mysql_query("update {$table} set `{$date}" . "_" . $period . "` = '{$new_value}' where `RNo` = '{$rno}';") or die("Error : mysql error - " . mysql_error());
                    insert_log($_SESSION['UserId'] . " updated rno {$rno} attendace for the date {$date}");
                    echo "{$rnos} {$period} attendance updated ...";
                }
            }
        }
    }
}
Exemplo n.º 23
0
                chmod($dest_path, 0606);
                if (file_exists($dest_path)) {
                    $size = getimagesize($dest_path);
                    // 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제
                    if ($size[0] > $config[cf_member_icon_width] || $size[1] > $config[cf_member_icon_height]) {
                        @unlink($dest_path);
                    }
                }
            }
        }
        if ($mb_password) {
            $sql_password = "******" . sql_password($mb_password) . "' ";
        } else {
            $sql_password = "";
        }
        if ($passive_certify) {
            $sql_certify = " , mb_email_certify = '{$g4['time_ymdhis']}' ";
        } else {
            $sql_certify = "";
        }
        if ($_POST['mb_datetime']) {
            $sql_datetime = " , mb_datetime = '{$_POST['mb_datetime']}' ";
        }
        $sql = " update {$g4['member_table']}\n                set {$sql_common}\n                    {$sql_password}\n\t\t\t\t\t{$sql_datetime}\n                    {$sql_certify}\n              where mb_id = '{$mb_id}' ";
        sql_query($sql);
        insert_log($mb[mb_id] . " 회원을 수정하였습니다.", "u");
    } else {
        alert("제대로 된 값이 넘어오지 않았습니다.");
    }
}
goto_url("./member_form.php?{$qstr}&w=u&mb_id={$mb_id}");
Exemplo n.º 24
0
function changeprofile($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        $arr = array("password", "contact", "photo");
        if (in_array($p, $arr)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Password, PhoneNo, Branch from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $row['Branch'];
            $pass = $row['Password'];
            $phoneno = $row['PhoneNo'];
            $class = substr($p, -1);
            $ex = array("png", "jpg", "jpeg", "gif", "bmp");
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            echo <<<a
\t\t\t\t<div class='container'>
\t\t\t\t\t<div id="error" style="display:none;"></div>
\t\t\t\t\t<div class='row'>
\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;">
a;
            if ($p == 'password') {
                display_password();
            }
            if (isset($_POST['Password'])) {
                $pass1 = md5($_POST['OPass']);
                $newpass1 = md5($_POST['NPass1']);
                $newpass2 = md5($_POST['NPass2']);
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($newpass1)) < 7) {
                    echo "<script>show_error('Error : New Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($newpass2)) < 7) {
                    echo "<script>show_error('Error : Re- New Password should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if ($newpass1 != $newpass2) {
                        echo "<script>show_error('Error : New Password both does not matched ... Please try again....');</script>";
                    } else {
                        $q = mysql_query("update {$table} set Password = '******' where Id = '{$userid}';") or die(mysql_error());
                        insert_log("{$userid} changed his Password ");
                        echo "<script>show_success('Password has been updated');</script>";
                    }
                }
            }
            if ($p == 'contact') {
                display_contact();
            }
            if (isset($_POST['Contact'])) {
                $pass1 = md5($_POST['OPass']);
                $contact1 = $_POST['MNo'];
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if (strlen(trim($contact1)) == 0) {
                    echo "<script>show_error('Error : Contact No should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if (strlen($contact1) != 10) {
                        echo "<script>show_error('Error : New Contact No. to short... Please try again....');</script>";
                    } else {
                        $q = mysql_query("update {$table} set PhoneNo = '{$contact1}' where Id = '{$userid}';") or die(mysql_error());
                        insert_log("{$userid} changed his Contact No");
                        echo "<script>show_success('Contact No has been updated');</script>";
                    }
                }
            }
            if ($p == 'photo') {
                display_photo();
            }
            if (isset($_POST['Photo'])) {
                $pass1 = md5($_POST['OPass']);
                if (strlen(trim($pass1)) < 7) {
                    echo "<script>show_error('Error : Password should not be null');</script>";
                    exit;
                }
                if ($pass1 != $pass) {
                    echo "<script>show_error('Error : Your Current Password does not matched ... Please try again....');</script>";
                } else {
                    if (isset($_FILES['PhotoFile'])) {
                        $fname = $_FILES['PhotoFile']["name"];
                        $fsize = $_FILES['PhotoFile']["size"];
                        $fext = strtolower(end(explode(".", $fname)));
                        if ($fsize > 102400) {
                            echo "<script>show_error('Error : Input file is larger than 100KB ... Please try again....');</script>";
                        } else {
                            if (!in_array($fext, $ex)) {
                                echo "<script>show_error('Error : Input file is not a image file ... Please try again....');</script>";
                            } else {
                                $fname_new = "assets/img/users/" . $userid . ".png";
                                if (!move_uploaded_file($_FILES["PhotoFile"]["tmp_name"], $fname_new)) {
                                    echo "<script>show_error('Error : In moving the input file ... Please try again....');</script>";
                                } else {
                                    exec("chmod 777 {$fname_new}");
                                    $q = mysql_query("update {$table} set Picture = '{$fname_new}' where Id = '{$userid}';") or die(mysql_error());
                                    insert_log("{$userid} changed his profile photo");
                                    echo "<script>show_success('Profile Photo Updated ');</script>";
                                }
                            }
                        }
                    } else {
                        echo "<script>show_error('Error : No input file ... Please try again....');</script>";
                    }
                }
            }
            echo <<<b
\t\t</div>\t
\t\t</div>
\t\t<div class='span3'>
b;
            go_home();
            echo <<<b
\t\t<ul class="nav nav nav-tabs nav-stacked">
\t\t
\t\t<li><a href='?password'>Change Password <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t<li><a href='?contact'>Change Contact No<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t<li><a href='?photo'>Change Photo <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>
\t\t
\t\t</ul>
b;
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
Exemplo n.º 25
0
function generate_attendance($title)
{
    if (!check('CR')) {
        header('location:./?sub');
    } else {
        if (!check_day()) {
            $p = $_SERVER['QUERY_STRING'];
            $reg = '/^P[1-4]$/';
            if (preg_match($reg, $p)) {
                include 'config/db.php';
                include 'config/settings.php';
                include 'config/globals.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $userid = $_SESSION['UserId'];
                $q = "select Branch,Class from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                $branch = $row['Branch'];
                $class = $row['Class'];
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                echo <<<a
\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t
a;
                $dbname = $branchyear . '_Attendance';
                $table = $branch . $class . '_Attendance';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $class_total = mysql_num_rows(mysql_query("select `Id` from {$table}"));
                $sample = mt_rand(1, $class_total);
                $da = date('d-m-Y');
                $date = date('d-m-Y');
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select Date from {$table} where Date = '{$da}'") or die(mysql_error());
                if (mysql_num_rows($q) == 0) {
                    $q = mysql_query("insert into {$table}(Date) values('{$da}')") or die(mysql_error());
                    $dbname = $branchyear . '_Cache';
                    $table = $branch . $class . '_Cache';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    for ($j = 1; $j <= 4; $j++) {
                        $q = mysql_query("alter table {$table} add `" . $da . "_P" . $j . "` varchar(2);") or die(mysql_error());
                    }
                    insert_log($_SESSION['UserId'] . " added {$date} Cache columns to {$table}");
                    $dbname = $branchyear . '_Attendance';
                    $table = $branch . $class . '_Attendance';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = mysql_query("alter table {$table} add `" . $da . "` varchar(30) default '';") or die(mysql_error());
                    insert_log($_SESSION['UserId'] . "added {$date} to Attendance columns to {$table}");
                }
                echo <<<a
\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t
\t\t<div class="row">
\t\t\t\t<div class='span9'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select {$p},`" . $p . "_Con` from {$table} where Date = '{$da}';") or die(mysql_error());
                $row = mysql_fetch_array($q);
                $a = $da . '_' . $p;
                if (isset($_POST['Generate'])) {
                    if ($row[$p] == 'ok') {
                        echo "<script>show_error('{$p} Attendance has been already uploaded ');</script>";
                    } else {
                        $key2 = addslashes($_POST['Skey']);
                        $table = $branchyear . '_CRs';
                        $q = "select `Id`,`Key` from {$table} where `Id` = '{$userid}'";
                        $res = mysql_query($q) or die(mysql_error());
                        $row = mysql_fetch_array($res);
                        $key1 = $row['Key'];
                        if ($key1 != $key2) {
                            echo "<script>show_error('<b>Error </b> : CR Security Key does not matched.  Please try again.. ');</script>";
                        } else {
                            $dbname = $branchyear . '_Cache';
                            $table = $branch . $class . '_Cache';
                            //if(!mysql_select_db($dbname))die(mysql_error());
                            $less = addslashes($_POST['Less']);
                            $rnos = addslashes($_POST['RNos']);
                            $lastone = $rnos[strlen($rnos) - 1];
                            $rollno[$less] = $lastone != ',' ? explode(',', $rnos) : explode(',', $rnos, -1);
                            if ($less == "Absents") {
                                for ($i = 1, $c = 0; $i <= $class_total; $i++) {
                                    if (!in_array($i, $rollno["Absents"])) {
                                        $rollno["Presents"][$c++] = $i;
                                    }
                                }
                            } else {
                                for ($i = 1, $c = 0; $i <= $class_total; $i++) {
                                    if (!in_array($i, $rollno["Presents"])) {
                                        $rollno["Absents"][$c++] = $i;
                                    }
                                }
                            }
                            if (array_key_exists('Absents', $rollno)) {
                                foreach ($rollno['Absents'] as $val) {
                                    $insert = mysql_query("UPDATE " . $table . " SET `{$a}` = 'A' WHERE RNo ='{$val}';") or die(mysql_error());
                                }
                            }
                            if (array_key_exists('Presents', $rollno)) {
                                foreach ($rollno['Presents'] as $val) {
                                    $insert = mysql_query("UPDATE " . $table . " SET `{$a}` = 'P' WHERE RNo ='{$val}';") or die(mysql_error());
                                }
                            }
                            $dbname = $branchyear . '_Dates';
                            $table = $branch . $class . '_Dates';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $in = mysql_query("UPDATE " . $table . " SET `{$p}` = 'ok' WHERE Date ='{$da}';") or die(mysql_error());
                            echo "<script>show_success('{$p} Attendance has been uploaded ');</script>";
                        }
                    }
                }
                $dbname = $branchyear . '_Dates';
                $table = $branch . $class . '_Dates';
                //if(!mysql_select_db($dbname))  die(mysql_error());
                $remaining = array();
                $j = 0;
                $remaining1 = array();
                $j1 = 0;
                $confired = array();
                $j2 = 0;
                $confired1 = array();
                $j3 = 0;
                for ($i = 1; $i <= 4; $i++) {
                    $tmp = "P" . $i;
                    $tmp1 = "P" . $i . "_Con";
                    $q = mysql_query("select ISNUll(`{$tmp}`) as `P{$i}`,ISNUll(`{$tmp1}`) as `P" . $i . "_C` from {$table} where Date = '{$da}' ") or die(mysql_error());
                    $res = mysql_fetch_array($q);
                    if ($res["P" . $i]) {
                        $remaining[$j] = "P" . $i;
                        $j++;
                    } else {
                        $remaining1[$j1] = "P" . $i;
                        $j1++;
                    }
                    if ($res["P" . $i . "_C"]) {
                        $confired[$j2] = "P" . $i;
                        $j2++;
                    } else {
                        $confired1[$j3] = "P" . $i;
                        $j3++;
                    }
                }
                $dates1 = getdate(strtotime($da));
                $day = substr($dates1["weekday"], 0, 3);
                $dbname = $branchyear . '_TimeTable';
                $table = $branch . $class . '_TimeTable';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $ti = mysql_query("SELECT DayPeriod,{$day} from {$table};") or die(mysql_error());
                $subjects = array();
                while ($da = mysql_fetch_array($ti)) {
                    $subjects[$da[0]] = $da[1];
                }
                $sub = $subjects[$p];
                if (in_array($p, $remaining1)) {
                    echo "<h5 style='text-align:center;'> Attendance Submission Details - {$branch}&nbsp;{$class}</h5><br>";
                    //$p="P".$m;
                    if (in_array($p, $confired1)) {
                        $period = $p;
                        $dbname = $branchyear . '_Attendance';
                        $table = $branch . $class . '_Attendance';
                        //if(!mysql_select_db($dbname)) die(mysql_error());
                        $q = mysql_query("select RNo,Id,`{$date}` from {$table};") or die(mysql_error());
                        $Rnos = array("Absents" => array(), "Presents" => array());
                        $aindex = 0;
                        $pindex = 0;
                        $uid = array();
                        while ($res = mysql_fetch_array($q)) {
                            $uid[$res['RNo']] = $res['Id'];
                            $z = explode(",", $res[$date]);
                            for ($m = 0; $m < count($z); $m++) {
                                $y = explode("_", $z[$m]);
                                if ($y[0] == $period) {
                                    if ($y[1] == "A") {
                                        $Rnos['Absents'][$aindex] = $res[0];
                                        $aindex++;
                                    } else {
                                        $Rnos['Presents'][$pindex] = $res[0];
                                        $pindex++;
                                    }
                                }
                            }
                        }
                    } else {
                        $da = date('d-m-Y');
                        $a = $da . '_' . $p;
                        $dbname = $branchyear . '_Cache';
                        $table = $branch . $class . '_Cache';
                        //if(!mysql_select_db($dbname)) die(mysql_error());
                        $q3 = mysql_query("SELECT RNo, `" . $a . "` FROM {$table}") or die(mysql_error());
                        $Rnos = array("Absents" => array(), "Presents" => array());
                        $aindex = 0;
                        $pindex = 0;
                        while ($individual = mysql_fetch_array($q3)) {
                            if ($individual[$a] == "A") {
                                $Rnos["Absents"][$aindex] = $individual["RNo"];
                                $aindex++;
                            }
                            if ($individual[$a] == "P") {
                                $Rnos["Presents"][$pindex] = $individual["RNo"];
                                $pindex++;
                            }
                        }
                    }
                    $pc = count($Rnos["Presents"]);
                    $ac = count($Rnos["Absents"]);
                    $tot = $pc + $ac;
                    //print_r($Rnos);
                    //print_r($uid);
                    echo <<<tab
\t\t\t\t
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t<tr> <td class="span2" style="text-align:center"> Date </td> <th class="text-warning span2" style="text-align:center"> {$date}</th> 
\t\t\t\t\t\t\t<td class="span2" style="text-align:center"> Subject </td> <th class="text-success span2" style="text-align:center"> {$sub}</th> </tr>
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
                     <div class="row">
                    \t<div class="span8">
                        <table class="table  table-hover table-bordered" >
                            <thead>
                                <tr> <th class="span2"  style="text-align:center"> Period # </th> <th class="span3"> Presents  </th> <th class="span3"> Absents  </th> </tr>
                            </thead>
                            <tbody>
                            <tr><td style="text-align:center;" >{$p}</td><td>
tab;
                    for ($i = 0; $i < $pc; $i++) {
                        if ($i % 8 == 0 && $i != 0) {
                            echo "<br>";
                        }
                        if ($i == $pc - 1) {
                            echo $Rnos["Presents"][$i];
                        } else {
                            echo $Rnos["Presents"][$i] . ",";
                        }
                    }
                    echo "</td><td>";
                    for ($i = 0; $i < $ac; $i++) {
                        if ($i % 8 == 0 && $i != 0) {
                            echo "<br>";
                        }
                        if ($i == $ac - 1) {
                            echo $Rnos["Absents"][$i];
                        } else {
                            echo $Rnos["Absents"][$i] . ",";
                        }
                    }
                    echo <<<tab
\t\t\t\t\t\t</td></tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td style="text-align:center;" >Total  (<b>{$class_total}</b>) </td>
\t\t\t\t\t\t\t<td style="text-align:center;" class='text-success'> {$pc}</td>
\t\t\t\t\t\t\t<td style="text-align:center;" class='text-error'>{$ac}</td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t</tbody>
\t\t\t\t\t</table>
\t\t\t\t\t</div>
\t\t\t\t</div>
                            
tab;
                } else {
                    display_generate_form($p, $class_total, $sub, $branch . $class);
                }
                echo <<<a
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div class='span3'>
a;
                go_home();
                echo '<ul class="nav nav-tabs nav-stacked">';
                for ($i = 1; $i <= 4; $i++) {
                    echo "<li><a href=\"?P{$i}\">P{$i}";
                    $period = "P" . $i;
                    if (!in_array($period, $remaining)) {
                        echo "<i class='icon-ok pull-right text-success' style=\"padding-top:5px;\"></i>";
                    } else {
                        echo "<i class='icon-remove pull-right text-error' style='padding-top:5px;'></i>";
                    }
                    echo '<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>';
                }
                echo "</ul></div>";
                echo "</div> </div> ";
                display_footer();
                echo "\n</body>\n</html>";
                @mysql_close($con);
            } else {
                echo "<script type='text/javascript'>document.location.href='404.php';</script>";
            }
        } else {
            noservice();
        }
    }
}
Exemplo n.º 26
0
<?php

$sub_menu = "200290";
include_once "./_common.php";
$this_table = "g4_board_order2";
check_demo();
auth_check($auth[$sub_menu], "d");
check_token();
for ($i = 0; $i < count($chk); $i++) {
    // 실제 번호를 넘김
    $k = $_POST['chk'][$i];
    $sql = " delete from {$this_table} where bn_id = '{$_POST['bn_id'][$k]}' ";
    sql_query($sql);
    insert_log($_POST['bn_id'][$k] . "번 직접주문을 삭제하였습니다.", "d");
    //    $sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '{$_POST['mb_id'][$k]}' ";
    //    $row = sql_fetch($sql);
    //    $sum_point = $row[sum_po_point];
    //
    //    $sql= " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '{$_POST['mb_id'][$k]}' ";
    //    sql_query($sql);
}
goto_url("./pointmall_list.php?{$qstr}");
Exemplo n.º 27
0
<?php

$sub_menu = "200290";
include_once "./_common.php";
$this_table = "g4_board_order2";
check_demo();
auth_check($auth[$sub_menu], "w");
check_token();
//exit();
for ($i = 0; $i < count($chk); $i++) {
    // 실제 번호를 넘김
    $k = $chk[$i];
    $sql = "select * from {$g4['board_order_table2']} where bn_id = '{$_POST[bn_id][$k]}' ";
    $bn = sql_fetch($sql);
    if ($bn['is_cancel'] == "1") {
        $msg .= "{$bn['bn_id']} : 취소 처리가 되어 배송상태를 변경하실 수 없습니다.\\n";
    } else {
        $sql = " update {$this_table}\n\t\t\t\t\tset is_confirm = '1'\n\t\t\t\t  where bn_id         = '{$_POST[bn_id][$k]}' ";
        //if ($is_admin != "super")
        //    $sql .= " and gr_admin    = '{$_POST[gr_admin][$k]}' ";
        sql_query($sql);
        insert_log($_POST[bn_id][$k] . "번 직접주문을 수정하였습니다.", "u");
    }
}
if ($msg) {
    alert($msg, "./pointmall_list.php?{$qstr}");
} else {
    goto_url("./pointmall_list.php?{$qstr}");
}
Exemplo n.º 28
0
function changecr($title)
{
    if (!check('BA') and !check('SA')) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        if (preg_match($reg, $p)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Branch from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $row['Branch'];
            $class = substr($p, -1);
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            $array = array_merge(range(0, 9), range('a', 'z'));
            shuffle($array);
            $crkey = "";
            for ($i = 0; $i < 9; $i++) {
                $crkey .= $array[$i];
            }
            echo <<<a
\t\t\t\t<div class='container'>
\t\t\t\t\t<div id="error" style="display:none;"></div>
\t\t\t\t\t<div class='row'>
\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;">
a;
            if (isset($_POST["Idno"])) {
                $id = addslashes($_POST['Idno']);
                $gender = addslashes($_POST['Gender']);
                $key = addslashes($_POST['Key']);
                if (strlen(trim($id)) == 0) {
                    echo "<script>show_error('Error : Id should not be null');</script>";
                    exit;
                }
                if (strlen(trim($gender)) == 0) {
                    echo "<script>show_error('Error : CR Gender should not be null');</script>";
                    exit;
                }
                if (strlen(trim($key)) == 0) {
                    echo "<script>show_error('Error : Key should not be null');</script>";
                    exit;
                }
                include 'config/db.php';
                include 'config/settings.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) {die(mysql_error());}
                $userid = $id;
                $q = "select Name,Branch,Class,Gender from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                $name = ucwords(strtolower($row['Name']));
                $branch = $row['Branch'];
                $class1 = $row['Class'];
                $gender1 = $row['Gender'];
                $branch = $globalbranch;
                $d = $dict[$gender . '1'];
                if ($class1 == $class && $gender1 == $gender) {
                    $table = $branchyear . '_CRs';
                    $old_id = mysql_fetch_array(mysql_query("Select Id from {$table} where Class = '{$class}'  and Gender = '{$gender}';"))['Id'];
                    $q = mysql_query("delete from {$table} where Class = '{$class}'  and Gender = '{$gender}';") or die(mysql_error());
                    $q1 = mysql_query("insert into {$table} ( `Id`, `Name`, `Gender`, `Branch`,`Class`, `Key`) values ( '{$id}', '{$name}' , '{$gender}', '{$branch}', '{$class}', '{$key}');") or die(mysql_error());
                    insert_log("Changing {$branch} {$class} {$d} CR to {$id}");
                    $dbname = $branchyear . '_Logs';
                    $table = $branchyear . '_Notifications';
                    //if(!mysql_select_db($dbname)) {die(mysql_error());}
                    $datetime = date('d/m/Y H:m:s');
                    $ip = $_SERVER['REMOTE_ADDR'];
                    $to1 = $branch . $class . "@students";
                    $query = mysql_query("INSERT INTO " . $table . "(`To`,`From`,`Subject`,`Message`,`DateTime`,`IP`) VALUES('{$to1}','" . $_SESSION['UserId'] . "','Changing the {$d} CR of {$branch} {$class}','Dear Students,<br>Please Notice that, {$branch} {$class} {$d} CR has been changed to <br> {$name}, {$id}.','{$datetime}','{$ip}');") or die(mysql_error());
                    $table = $dbname = $branchyear . '_Students';
                    $query = mysql_query("update {$table} set Position = 'CR' where Id = '{$id}'") or die(mysql_error());
                    $query1 = mysql_query("update {$table} set Position = 'S' where Id = '{$old_id}'") or die(mysql_error());
                    echo "<script>show_success('{$branch} {$class} {$d} CR has been updated with {$name} and security key <u class=\\'text-error\\'>{$key}</u> ');</script>";
                } else {
                    echo "<script>show_error('<b>Error </b> : <b>{$id}</b> is not from the <b>{$branch} {$class} {$d}</b>  Please try again.. ');</script>";
                }
            }
            echo <<<a
\t\t\t<div id="step1">    
\t\t\t<h4>Change CR of {$branch} {$class} </h4>
\t\t\t<h6> &emsp;&emsp;&emsp;&emsp; Provide Details of New CR  </h6><br>
\t\t\t<form action="?{$p}" method="POST" onsubmit="return viewcr('{$branch}',{$class});"  id="changecr">
\t\t\t<h5>Gender : </h5>  
\t\t\t<label class="radio inline"><input type="radio"  value="M" name="Gender" id="Male" /> Male </label>
\t\t\t<label class="radio inline"><input type="radio"  value="F" name="Gender" id="Female" /> Female </label> 
\t\t\t<br><br>
\t\t\t<h5>New CR ID No : </h5>
\t\t\t<input type="text" class="input-large" placeholder="N090001"  id="Idno" name="IdNo" maxlength="7" /><br>
\t\t\t<!--<h5>Security Key : </h5>-->
\t\t\t<input type="hidden" class="input-large" placeholder="Password" readonly=readonly name="Key" value="{$crkey}" ><br>
\t\t\t<input type="submit" class="btn btn-primary" name="change" value = "Continue &rarr;" />
\t\t\t</form>\t
\t\t\t<form action="?{$p}" method='post' id='sub2'>
\t\t\t<div id="confirm">
\t\t\t\t<div id="cr" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true">
\t\t\t\t<div class="modal-header">
\t\t\t\t<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
\t\t\t\t<h4 id="useridlabel">Caution</h4>
\t\t\t\t</div>
\t\t\t\t<div class="modal-body" id='mbody'></div>
\t\t\t\t<div class="modal-footer">
\t\t\t\t<button class="btn btn-danger"  aria-hidden="true" type="submit" onclick="a();">Confirm & Replace </button> 
\t\t\t\t<button class="btn btn-primary"  aria-hidden="true"  data-dismiss='modal' > Cancel </button>
\t\t\t\t</div>
\t\t\t</div>
\t\t\t\t<input type="hidden"  placeholder="Password" readonly=readonly name="Gender" value="" id='gender1'>
\t\t\t\t<input type="hidden"  placeholder="Password" readonly=readonly name="Idno" value="" id='idno1'>
\t\t\t\t<input type="hidden" class="input-large" placeholder="Password" readonly=readonly name="Key" value="{$crkey}" >
\t\t\t</form>
\t\t\t</div>
\t\t\t</div>\t\t
a;
            echo <<<b
\t\t\t\t
\t\t\t\t</div>\t
\t\t\t\t</div>
\t\t\t\t<div class='span3'>
b;
            go_home();
            cr_classes($classno, $globalbranch);
            echo "</div></div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
<?php

session_start();
include 'config.php';
include 'db_functions.php';
$userid = $_SESSION['user_id'];
extract($_GET);
if ($id != "") {
    $device_imei = get_cell('device', $id, 'device_imei');
    mysql_query("DELETE FROM `device` WHERE  `id` = '{$id}'");
    //Event 6 = Deleted
    $affected_id = $id;
    $description = "Device IMEI " . $device_imei . " Deleted";
    insert_log($userid, 6, 'device', $affected_id, $description);
}
?>
<script>
window.top.window.manage_device();
</script>
    $billplan = $excel_array['BILL_PLAN'];
    $billcycle = $excel_array['BILL CYCLE'];
    $account_category = $excel_array['ACCOUNT_CATEGORY'];
    $fe = $excel_array['FE'];
    $dv = $excel_array['DV'];
    $date_time = date('Y-m-d');
    if ($account_number != "") {
        $append_values .= "('{$code}','{$account_number}','{$external_id}','{$account_category}','{$full_name}','{$address}','{$mailzip}','{$billplan}','{$billcycle}','{$fe}','{$cur_file_name}','{$dv}'),";
    }
}
//Remvoing Last comma in appended String
$sql = substr($insert_sql . $append_values, 0, -1);
mysql_query($sql);
$trow = mysql_num_rows(mysql_query("select * from base_temp where 1"));
$description = "Total row in Excel:" . $trow_in_excel . "Total Row in temprory Base : " . $trow;
insert_log($userid, 10, 'base_temp', 0, $description);
/*for ($i = 2; $i <= $count; $i++)
	{
		
		 $code = $data->val($i,'A');
		 $account_number = $data->val($i,'B');	
		 $external_id = $data->val($i,'C');		
		 $full_name = $data->val($i,'D');
		 $address = $data->val($i,'G');
		 $mailzip = $data->val($i,'H');
		 $billplan = $data->val($i,'K');
		 $billcycle = $data->val($i,'L');	
		 $account_category = $data->val($i,'M');		
		 $fe = $data->val($i,'R');
		 	
		$date_time=date('Y-m-d');