コード例 #1
0
ファイル: api.php プロジェクト: pvidali/BCSR-1
/**
 * Verify API active. If invalid terminate execution and redirect to public calendar homepage with a 301 response.
 * @since 2.2.0
 * @version 2.2.0
 * @return void
 */
function api_active()
{
    global $hc_cfg;
    if ($hc_cfg[127] != '1') {
        go_home();
    }
}
コード例 #2
0
ファイル: locations.php プロジェクト: pvidali/BCSR-1
/**
 * Retrieves array of location data.
 * @since 2.0.0
 * @version 2.0.0
 * @return array Location Data
 */
function location_fetch()
{
    global $lID, $hc_cfg, $hc_lang_event, $title, $desc;
    location_add_session_view($lID);
    $result = doQuery("SELECT PkID, Name, Address, Address2, City, State, Country, Zip, URL, Phone, Email, Descript, Lat, Lon, ShortURL, LastMod, Image From " . HC_TblPrefix . "locations WHERE PkID = '" . cIn($lID) . "' AND IsActive = 1");
    if (!hasRows($result) || mysql_result($result, 0, 0) <= 0) {
        go_home();
    }
    $loc = array('LocID' => mysql_result($result, 0, "PkID"), 'Name' => mysql_result($result, 0, "Name"), 'Description' => mysql_result($result, 0, "Descript"), 'Address' => mysql_result($result, 0, "Address"), 'Address2' => mysql_result($result, 0, "Address2"), 'City' => mysql_result($result, 0, "City"), 'Region' => mysql_result($result, 0, "State"), 'Postal' => mysql_result($result, 0, "Zip"), 'Country' => mysql_result($result, 0, "Country"), 'Email' => mysql_result($result, 0, "Email"), 'Phone' => mysql_result($result, 0, "Phone"), 'Lat' => mysql_result($result, 0, "Lat"), 'Lon' => mysql_result($result, 0, "Lon"), 'Bitly' => mysql_result($result, 0, "ShortURL"), 'CommentsURL' => CalRoot . '/index.php?com=location&amp;lID=' . $lID, 'CommentsID' => $lID, 'Link_This' => CalRoot . '/index.php?com=location&amp;lID=' . $lID, 'Link_URL' => mysql_result($result, 0, "URL") != '' && mysql_result($result, 0, "URL") != 'http://' ? CalRoot . '/link/index.php?tID=4&amp;oID=' . mysql_result($result, 0, "PkID") : NULL, 'Link_Weather' => CalRoot . '/link/index.php?tID=3&amp;oID=0&amp;lID=' . mysql_result($result, 0, "PkID"), 'Link_Directions' => CalRoot . '/link/index.php?tID=2&amp;oID=0&amp;lID=' . mysql_result($result, 0, "PkID"), 'Link_Calendar' => CalRoot . '/index.php?lID=' . $lID, 'LastMod' => mysql_result($result, 0, "LastMod"), 'Image' => mysql_result($result, 0, "Image"));
    $title = cOut(mysql_result($result, 0, "Name"));
    $desc = cOut(mysql_result($result, 0, "Descript"));
    return array_map('cOut', $loc);
}
コード例 #3
0
function classes($classno, $branch)
{
    go_home();
    echo "<ul class='nav nav-tabs nav-stacked'>";
    echo '<li><a href="?all">All Students<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a></li>';
    echo '<li><a href="?allcrs">All CRs<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a></li>';
    for ($i = 1; $i <= $classno; $i++) {
        echo <<<a
\t<li><a href="?{$branch}{$i}">{$branch}{$i}<i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li>

a;
    }
    echo "</ul>";
}
コード例 #4
0
ファイル: functions.php プロジェクト: alexkurilo77/Alex1
function login_user($name, $password)
{
    global $model, $s;
    $password = md5($password);
    $result = $model['user']['login']($name, $password);
    if ($result) {
        $user = mysqli_fetch_assoc($result);
        $s['user'] = $user;
        add_flash('info', "You're now logged in");
        go_home();
    } else {
        add_flash('danger', "Wrong credentials");
    }
}
コード例 #5
0
ファイル: init.php プロジェクト: nceregao/new_portal
function exit_if($state = false)
{
    $is_loggen_in = isset($_SESSION['user']);
    if ($state) {
        if (!$is_loggen_in) {
            return;
        }
    } else {
        if ($is_loggen_in) {
            return;
        }
    }
    go_home();
    exit;
}
コード例 #6
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>";
        }
    }
}
コード例 #7
0
ファイル: profile.php プロジェクト: 0xc0d3r/Attendance-Portal
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>";
        }
    }
}
コード例 #8
0
ファイル: upload.php プロジェクト: 0xc0d3r/Attendance-Portal
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>";
        }
    }
}
コード例 #9
0
ファイル: simonsrock.php プロジェクト: pvidali/BCSR-1
function sr_event_browse_valid($sort_featured = 1, $nav_function = 'event_browse_nav')
{
    global $lID, $hc_cfg, $hc_lang_event, $favQ1, $favQ2, $resultEB, $myNav;
    $location = $lQuery = '';
    if ($lID > 0) {
        $location = '&amp;lID=' . $lID;
        $lQuery = " AND e.LocID = '" . $lID . "'";
    }
    //added to allow for filtering of KAC Class events
    $unwanted_cats = [35, 37, 38, 39, 40, 41];
    $unwanted_cats = implode(",", $unwanted_cats);
    $custom_filter = isset($_SESSION['hc_favCat']) ? '' : ' AND c.PkID NOT IN (' . cIn($unwanted_cats) . ') ';
    if (isset($_GET['m']) || $_SESSION['BrowseType'] == 2) {
        $sqlStart = $sqlEnd = strtotime(HCDATE);
        $startDate = $endDate = strtotime(HCDATE);
        $window = 0;
    } else {
        if ($_SESSION['BrowseType'] == 1) {
            $window = (date("t", strtotime(HCDATE)) - 1) * 86400;
            $remove = $hc_cfg[48] == 0 ? (date("j", strtotime(HCDATE)) - 1) * 86400 : 0;
        } else {
            $window = 6 * 86400;
            $remove = $hc_cfg[48] == 0 ? (date("w", strtotime(HCDATE)) - 1) * 86400 : 0;
        }
        $startDate = strtotime(HCDATE) - $remove;
        $endDate = $sqlEnd = $startDate + $window;
        $sqlStart = HCDATE != SYSDATE ? $startDate : strtotime(SYSDATE);
    }
    if ($endDate < $hc_cfg['First'] && $startDate != $hc_cfg['First']) {
        go_home();
    } else {
        $myNav = call_user_func($nav_function, $startDate, $endDate, $window, $location);
        $resultEB = doQuery("SELECT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, \r\n                            e.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry,\r\n                            l.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID, GROUP_CONCAT(c.CategoryName), e.Description, l.Address2\r\n                        FROM " . HC_TblPrefix . "events e\r\n                            LEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (e.PkID = ec.EventID)\r\n                            LEFT JOIN " . HC_TblPrefix . "categories c ON (ec.CategoryID = c.PkID)\r\n                            LEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID) \r\n                        WHERE e.StartDate BETWEEN '" . date("Y-m-d", $sqlStart) . "' AND '" . date("Y-m-d", $sqlEnd) . "'" . $lQuery . $favQ1 . $favQ2 . " AND e.IsActive = 1 AND e.IsApproved = 1" . $custom_filter . "\r\n                        GROUP BY e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, e.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry, l.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID\r\n                        ORDER BY e.StartDate, " . ($sort_featured == 1 ? "e.IsFeature DESC, " : "") . "e.TBD, e.StartTime, e.Title");
    }
}
コード例 #10
0
function changecr($title)
{
    /* checks the user login and  
     * redirecting user to login page */
    if (!check_login()) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        /* taking the query string by using the regular expression */
        $p = $_SERVER['QUERY_STRING'];
        $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        $reg1 = "/^all\$/";
        if (preg_match($reg, $p) or preg_match($reg1, $p)) {
            /* including the necessary configuration php files */
            include 'config/db.php';
            include 'config/settings.php';
            /* defining the table names  */
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_CRs';
            $table1 = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            //$branch = $row['Branch']; its not required
            $class = substr($p, -1);
            /* Getting the users details from joining the two tables */
            if ($p == 'all') {
                $q = "select {$table}.Name as Name, {$table}.Gender as Gender, {$table}.Id as Id,PhoneNo, `{$table1}`.`Class` as `Class` from {$table},{$table1} where `{$table}`.`Id` = `{$table1}`.`Id` order by `{$table1}`.`Class` Desc;";
            } else {
                $q = "select {$table}.Name as Name, {$table}.Gender as Gender, {$table}.Id as Id,PhoneNo from {$table},{$table1} where `{$table}`.`Id` = `{$table1}`.`Id` and `{$table}`.`Class` = '{$class}';";
            }
            $res = mysql_query($q) or die(mysql_error());
            echo "<!DOCTYPE html>\n<html>\n";
            /* including the header java scripts and css files  */
            display_headers($title);
            echo "\n<body>";
            /* displayin the header menu */
            menu();
            $br = $p == 'all' ? $globalbranch : $p;
            $cls1 = $p == 'all' ? '<th style="text-align:center;" class="span1"> Class </th>' : "";
            echo <<<a
\t\t<div class='container'>
\t\t\t<div id="error" style="display:none;"></div>
\t\t\t<div class='row'>
\t\t\t<div class='span9'>
\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t<h5 class='text-info'>CRs @ {$br}  </h5>
\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing all CRs in {$br}  </h6><br>
\t\t\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t<thead>
\t\t\t\t\t<tr> <th class="span1" style="text-align:center;" > Id </th><th style="text-align:center;" class="span3"> Name   </th> {$cls1}
\t\t\t\t\t<th style="text-align:center;" class="span1"> Gender  </th>  <th class="span1" style="text-align:center;"> Contact No </th> </tr>
\t\t\t\t</thead>
\t\t\t\t<tbody>
a;
            while ($row = mysql_fetch_array($res)) {
                $gender = $row['Gender'];
                $d = $dict[$gender . '1'];
                $id = $row['Id'];
                $contact = $row['PhoneNo'];
                $cls = $p == 'all' ? '<td style="text-align:center;">' . $globalbranch . " " . $row['Class'] . '</td>' : "";
                $name = ucwords(strtolower($row['Name']));
                echo <<<a
\t\t\t\t\t
\t\t\t<tr >  
\t\t\t<td style="text-align:center;" > {$id} </td> 
\t\t\t<td > {$name} </td>
\t\t\t{$cls}
\t\t\t<td style="text-align:center;"> {$d}  </td> 
\t\t\t<td style="text-align:center;" class="text-success"><b> {$contact} </b> </td>  
\t\t\t</tr>
a;
            }
            echo <<<a
\t\t\t\t</tbody>
\t\t\t   </table>
\t\t\t</div>\t
\t\t\t</div>
\t\t\t<div class='span3'>
a;
            go_home();
            echo '<ul class="nav nav nav-tabs nav-stacked"> <li><a href=\'?all\'>All CRs &nbsp; <i class="icon-chevron-right pull-left" style="padding-top:5px;"></i></a> </li></ul>';
            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>";
        }
    }
}
コード例 #11
0
ファイル: bootstrap.php プロジェクト: pvidali/BCSR-1
/**
 * Validate current browse options against available events and build nav markup string & event browse results object. If invalid redirect to browse default (current week/month - depeneding on default settings).
 * @since 2.1.0
 * @version 2.2.1
 * @param integer $sort_featured Sort featured events first before all other events occuring on each day. 0 = List events chronologically regardless of featured status, 1 = List featured events first. (Default: 1)
 * @param string $nav_function [optional] Browse Navigation function to use. (Default: event_browse_bs_nav)
 * @return void 
 */
function event_browse_bs_valid($sort_featured = 1, $nav_function = 'event_browse_bs_nav')
{
    global $lID, $hc_cfg, $hc_lang_event, $favQ1, $favQ2, $resultEB, $mybsNav;
    $location = $lQuery = '';
    if ($lID > 0) {
        $location = '&amp;lID=' . $lID;
        $lQuery = " AND e.LocID = '" . $lID . "'";
    }
    if (isset($_GET['m']) || $_SESSION['BrowseType'] == 2) {
        $sqlStart = $sqlEnd = strtotime(HCDATE);
        $startDate = $endDate = strtotime(HCDATE);
        $window = 0;
    } else {
        if ($_SESSION['BrowseType'] == 1) {
            $window = (date("t", strtotime(HCDATE)) - 1) * 86400;
            $remove = $hc_cfg[48] == 0 ? (date("j", strtotime(HCDATE)) - 1) * 86400 : 0;
        } else {
            $window = 6 * 86400;
            $remove = $hc_cfg[48] == 0 ? (date("w", strtotime(HCDATE)) - 1) * 86400 : 0;
        }
        $startDate = strtotime(HCDATE) - $remove;
        $endDate = $sqlEnd = $startDate + $window;
        $sqlStart = HCDATE != SYSDATE ? $startDate : strtotime(SYSDATE);
    }
    if ($endDate < $hc_cfg['First'] && $startDate != $hc_cfg['First']) {
        go_home();
    } else {
        $mybsNav = call_user_func($nav_function, $startDate, $endDate, $window, $location);
        $resultEB = doQuery("SELECT DISTINCT e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, \r\n\t\t\t\t\t\t\t\te.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry,\r\n\t\t\t\t\t\t\t\tl.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID, e.Description\r\n\t\t\t\t\t\t\tFROM " . HC_TblPrefix . "events e\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (ec.EventID = e.PkID)\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "locations l ON (e.LocID = l.PkID)\r\n\t\t\t\t\t\t\tWHERE e.StartDate BETWEEN '" . date("Y-m-d", $sqlStart) . "' AND '" . date("Y-m-d", $sqlEnd) . "'" . $lQuery . $favQ1 . $favQ2 . " AND e.IsActive = 1 AND e.IsApproved = 1\r\n\t\t\t\t\t\t\tGROUP BY e.PkID, e.Title, e.StartDate, e.StartTime, e.EndTime, e.TBD, e.Image, e.IsFeature, e.HideDays, e.LocID, e.LocationName, e.LocationCity, e.LocationState, e.LocCountry, l.Name, l.City, l.State, l.Country, e.Cost, e.SeriesID\r\n\t\t\t\t\t\t\tORDER BY e.StartDate, " . ($sort_featured == 1 ? "e.IsFeature DESC, " : "") . "e.TBD, e.StartTime, e.Title");
    }
}
コード例 #12
0
function get_question_content($examID, $examName, $examCat, $questionID, $questionName, $questionType)
{
    $answers = get_answers($questionID, $questionType);
    $html = "<input type='hidden' id='exam_name' value='{$examName}' />";
    $html .= "<input type='hidden' id='exam_cat' value='{$examCat}' />";
    $html .= "<input type='hidden' id='exam_id' value='{$examID}' />";
    $html .= "<input type='hidden' id='question_id' value='{$questionID}' />";
    $html .= "<input id='old_question' type='text' autocomplete='off' placeholder='What is the question?' size='100' maxlength='200' value='{$questionName}'/>";
    switch ($questionType) {
        case 'single_answers':
            $html .= "<h4>The Answer</h4>\n";
            $html .= "<input type='text' maxlength='100' placeholder='What is the answer?' autocomplete='off' id='single_answer_text' value='{$answers[0][0]}'>\n";
            $html .= "<script>var selected = 'single';</script>";
            break;
        case 'mult_answers':
            $html .= "<h4>The Answers</h4>";
            $limit = count($answers);
            for ($i = 0; $i < 10; $i++) {
                $value = "";
                $checked = "";
                if ($i < $limit) {
                    $value = $answers[$i][0];
                    if ($answers[$i][2] == 'true') {
                        $checked = "checked";
                    }
                }
                $html .= "<input type='checkbox' name='mult_answer[]' value='{$i}' {$checked}>\t<input type='text' maxlength='100' autocomplete='off' name='mult_answer_text[]' class='mult_answer_text' value=\"{$value}\"><br /><br />\n";
            }
            $html .= "<script>var selected = 'multiple';</script>";
            break;
        case 'keyword_answers':
            $html .= "<h4>The Keywords</h4>";
            $limit = count($answers);
            for ($i = 0; $i < 10; $i++) {
                $value = "";
                if ($i < $limit) {
                    $value = $answers[$i][0];
                }
                $html .= "<input type='text' value='{$value}' maxlength='100' autocomplete='off' name='keyword_text[]' class='keyword_text'><br /><br />\n";
            }
            $html .= "<script>var selected = 'written';</script>";
            break;
        default:
            go_home();
            // prevent users accesses an invalid category
    }
    $html .= "<br /><button id='edit_question_button'>edit Question</button>\n";
    return $html;
}
コード例 #13
0
function changecr($title)
{
    if (!check('CR')) {
        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,Class from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            $branch = $row['Branch'];
            $class1 = $row['Class'];
            $class = substr($p, -1);
            if ($class != $class1) {
                echo "Your not from {$branch} {$class}";
            } else {
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                $array = array_merge(range(0, 9));
                shuffle($array);
                $crkey = "";
                for ($i = 0; $i < 6; $i++) {
                    $crkey .= $array[$i];
                }
                echo <<<a
\t\t\t\t\t<div class='container'>
\t\t\t\t\t\t<div id="error" style="display:none;"></div>
\t\t\t\t\t\t<div class='row'>
\t\t\t\t\t\t\t<div class='span9'>
\t\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;">
a;
                if (isset($_POST["Generate"])) {
                    $id = addslashes($_POST['IdNo']);
                    $key = addslashes($_POST['Key']);
                    $Skey = addslashes($_POST['Skey']);
                    $dbname = $branchyear . '_Users';
                    $table = $branchyear . '_Students';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $userid1 = $_SESSION['UserId'];
                    $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'];
                    $class2 = $row['Class'];
                    $dbname = $branchyear . '_Users';
                    $table = $branchyear . '_CRs';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = "select Id,`Key` from {$table} where Id = '{$userid1}'";
                    $res = mysql_query($q) or die(mysql_error());
                    $row = mysql_fetch_array($res);
                    $key1 = $row['Key'];
                    if ($key1 != $Skey) {
                        echo "<script>show_error('<b>Error </b> : CR Security Key does not matched.  Please try again.. ');</script>";
                    } else {
                        if ($class2 == $class) {
                            $dbname = $branchyear . '_Logs';
                            $table = $branchyear . '_Passwords';
                            //if(!mysql_select_db($dbname)) die(mysql_error());
                            $q = "select `EndTime`, `Code` from `{$table}` where `To` = '{$userid}';";
                            $res = mysql_query($q) or die(mysql_error());
                            $n = mysql_num_rows($res);
                            $StartTime = date('d-m-Y H:i:s');
                            $end = "";
                            $dif = 0;
                            $code = "";
                            while ($row = mysql_fetch_array($res)) {
                                $end = $row['EndTime'];
                                $dif = strtotime($end) - strtotime($StartTime);
                                $code = $row['Code'];
                            }
                            if ($dif <= 7200 && $dif > 0 && $n) {
                                echo "<script>show_error('<b>Error </b> : <b>{$userid}</b> is already assigned <b class=\\'text-success\\'>{$code}</b> till <b class=\\'text-success\\'>{$end}</b> ');</script>";
                            } else {
                                $EndTime = date('d-m-Y H:i:s', mktime(date('H') + 2));
                                $ip = $_SERVER['REMOTE_ADDR'];
                                $q1 = mysql_query("insert into {$table} ( `To`, `Code`, `CreatedBy`, `StartTime`,`EndTime`, `Status`,`IP` ) values ( '{$id}', '{$key}' , '{$userid1}', '{$StartTime}', '{$EndTime}', 'valid','{$ip}');") or die(mysql_error());
                                insert_log($_SESSION['UserId'] . "created security key for {$id} ");
                                echo "<script>show_success('To change password of {$id}  use the security pin <u class=\\'text-error\\'>{$key}</u> valid up to <u class=\\'text-error\\'>{$EndTime}</u>  ');</script>";
                            }
                        } else {
                            echo "<script>show_error('<b>Error </b> : <b>{$userid}</b> is not from the <b>{$branch} {$class} </b>  Please try again.. ');</script>";
                        }
                    }
                }
                echo <<<a
\t\t\t\t\t\t<div id="step1">    
\t\t\t\t\t\t\t<h4>Security Codes @ {$branch} {$class} </h4>
\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp;&emsp; Provide  requesting Student  Id </h6>
\t\t\t\t\t\t   
\t\t\t\t\t\t\t<form action="?{$p}" method="POST" onsubmit="return check_id();"  id="password">
\t\t\t\t\t\t\t<br>
\t\t\t\t\t\t\t<h5>Student ID No : </h5>
\t\t\t\t\t\t\t<input type="text" class="input-large" placeholder="N090001"  id="Idno" name="IdNo" maxlength="7" /><br>
\t\t\t\t\t\t\t<h5>Your Security Key : </h5>
\t\t\t\t\t\t\t<input type="text" class="input-large" placeholder="Security Key"  id="Skey" name="Skey" maxlength="9" /><br>
\t\t\t\t\t\t\t<!--<h5>Security Key : </h5>-->
\t\t\t\t\t\t\t<input type="hidden" class="input-large" readonly=readonly name="Key" value="{$crkey}" >
\t\t\t\t\t\t\t<br><input type="submit" class="btn btn-primary" name="Generate" value = "Continue &rarr;" />
\t\t\t\t\t\t\t</form>\t
\t\t\t\t\t\t\t
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div class='span3'>
a;
                go_home();
                sidepanel();
                echo <<<a
\t\t\t</div>
\t\t\t</div>
\t\t\t
\t\t\t</div>
\t\t\t</div>
\t\t\t
a;
                echo "</div></div>";
                display_footer();
                echo "\n</body>\n</html>";
            }
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}
コード例 #14
0
function homepage($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        echo "<!DOCTYPE html>\n<html>\n\t<SCRIPT LANGUAGE=\"Javascript\" SRC=\"assets/charts/FusionCharts.js\"></SCRIPT>";
        display_headers($title);
        echo "\n<body>";
        menu();
        echo <<<a
\t<div class='container'>
\t\t<div id='error'></div>
\t\t<div class='row'>
a;
        echo '<div class="span9"><div class="well well-large" style="background:#FFF;">';
        /* Pattern Matching */
        $reg1 = "/^N[0-9]{6}\$/";
        $reg2 = "/^p|(sub)\$/";
        $qs = $_SERVER["QUERY_STRING"];
        $va = explode("/", $qs);
        $qs1 = $va[0];
        $qs2 = $va[1];
        if (preg_match($reg1, $qs1) and preg_match($reg2, $qs2)) {
            /* Fetching Details */
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SERVER["QUERY_STRING"];
            $resultant = explode("/", $userid);
            $id = $resultant[0];
            $mode = $resultant[1];
            $q = "select Name,Gender,Position, Branch, Class ,RNo from {$table} where Id = '{$id}'";
            $res = mysql_query($q) or die(mysql_error());
            if (mysql_num_rows($res) == 0) {
                echo "<script>document.location.href='404.php';</script>";
            }
            $row = mysql_fetch_array($res);
            $username = ucwords(strtolower($row['Name']));
            $gender = $row['Gender'];
            $RNo = $row["RNo"];
            $type = $row['Position'];
            $class = $row['Class'];
            $branch = $row['Branch'];
            $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8');
            shuffle($colors);
            /* Deatils Fetched */
            echo <<<a
\t\t<div id="step1" class="span6">     
\t\t<a ><h5>Student Attendance Report for {$id} </h5></a>
\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Lising Attendance details submitted from CR @ {$branch} {$class}</h6><br>
\t\t</div>
\t\t<table class="table table-hover table-bordered">
\t\t<tbody>
\t\t<tr><th>Name </th> <td>{$username}</td> <th>Gender </th> <td>{$gender}</td> </tr>
\t\t<tr><th>RNo </th> <td>{$RNo}</td>  <th>Class </th> <td>{$branch} {$class} </td></tr>
\t\t</tbody>
\t\t</table>
\t<div id="step1" class="span4">     
\t\t<h5>Chart Based Representaiton </h5>
\t</div>
\t<div id="side1" class="span4" >
\t\t<h6 class='text-right'><a href='?{$id}/sub' ><i class='icon-book'></i>&nbsp; Subjects</a> &emsp; <a href='?{$id}/p'><i class='icon-qrcode'></i>&nbsp; Periods</a></h6>
\t</div>
a;
            if (strtolower($mode) == "p") {
                //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok' ;") or die(mysql_error());
                $nofd = mysql_num_rows($query);
                if ($nofd != 0) {
                    $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);
                    $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0);
                    $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>";
                    $datasetp = '';
                    while ($dates = mysql_fetch_array($query)) {
                        //mysql_select_db($branchyear."_Attendance") or die(mysql_error());
                        $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';");
                        while ($res = mysql_fetch_array($q)) {
                            $values = explode(",", $res[0]);
                            for ($i = 0; $i < count($values) - 1; $i++) {
                                if (substr($values[$i], -1) == "P") {
                                    $stats["Presents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                if (substr($values[$i], -1) == "A") {
                                    $stats["Absents"] += 1;
                                    $stats["Total"] += 1;
                                }
                                $p[$values[$i]] += 1;
                            }
                        }
                    }
                    $tr = '';
                    for ($i = 1; $i <= 4; $i++) {
                        $st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success";
                        $tr .= '<tr>  
				<td style="text-align:center;">' . $i . '</td>
				<td style="text-align:center;"> P' . $i . ' </td> 
				<td style="text-align:center;"><b> ' . $nofd . '</b> </td> 
				<td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td>  
				<td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> 
				<td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td>  
				<td style="text-align:center;" class="text-' . $st . '"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </b></td>   
			</tr>';
                        $datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>";
                    }
                    $strXML .= $datasetp . "</graph>";
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5> Period Wise Attendance Representation </h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Period </th> 
                                <th  style="text-align:center;"  > Days </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > P/Day </th>  <th  style="text-align:center;"  > Absents </th> 
                                <th  style="text-align:center;" > A/Day </th><th  style="text-align:center;" > Performance </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* End of Period Wise Attendance*/
            /* SUbjects Wise Attendance */
            if (strtolower($mode) == "sub") {
                //mysql_select_db($branchyear."_Subjects") or die(mysql_error());
                $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error());
                $subjectwise = mysql_fetch_array($query) or die(mysql_error());
                $tr = '';
                $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>";
                $datasetp = '';
                $nc_cls = 0;
                for ($i = 0; $i < count($allowed_subjects); $i++) {
                    $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"];
                    if ($tnoc == 0) {
                        $nc_cls++;
                        $performance = "N/A  ";
                        $st = "error";
                        $remarks = "CNYS";
                    } else {
                        $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100;
                        $performance = round($performance, 1) . " %";
                        $st = $performance <= 50 ? "error" : "success";
                        if (round($performance, 1) >= 95) {
                            $remarks = "Excellent";
                        }
                        if (round($performance, 1) >= 90 && round($performance, 1) < 95) {
                            $remarks = "Very Good";
                        }
                        if (round($performance, 1) >= 80 && round($performance, 1) < 90) {
                            $remarks = "Good";
                        }
                        if (round($performance, 1) >= 70 && round($performance, 1) < 80) {
                            $remarks = "Normal";
                        }
                        if (round($performance, 1) >= 60 && round($performance, 1) < 70) {
                            $remarks = "Average";
                        }
                        if (round($performance, 1) >= 50 && round($performance, 1) < 60) {
                            $remarks = "Bad";
                        }
                        if (round($performance, 1) < 50) {
                            $remarks = "Go Out";
                        }
                    }
                    $tr .= '<tr> 
					<td style="text-align:center;">' . ($i + 1) . '</td> 
					<td style="text-align:center;"> <b>' . $allowed_subjects[$i] . '</b> </td> 
					<td style="text-align:center;"> <b>' . $tnoc . '</b> </td> 
					<td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> 
					<td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td>
					<td style="text-align:center;" class="text-' . $st . '"><b>' . $remarks . '</b></td>
				</tr>';
                    $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>";
                }
                $strXML .= $datasetp . "</graph>";
                if ($nc_cls != count($allowed_subjects)) {
                    echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380);
                    echo <<<table_head
\t\t<h5> Subject Wise Attendance Representation </h5><br>
\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t<thead>
\t\t\t\t<tr> 
\t\t\t\t<th style="text-align:center;"  rowspan="2" valign="top"> SNo  </th> 
                                <th style="text-align:center;"   valign="top"> Subject  </th> 
                                <th  style="text-align:center;"  > Classes </th> <th  style="text-align:center;" > Presents </th>
                                <th  style="text-align:center;"  > Absents </th>  <th  style="text-align:center;"  > Performance </th> 
                                <th  style="text-align:center;" > Remarks </th> 
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
table_head;
                    echo $tr;
                    echo <<<tableend
\t\t\t</tbody>
\t\t</table>
\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>&times;</a><strong>CNYS </strong>: Classes Not Yet Started </div>
\t<br>
tableend;
                } else {
                    echo "<br><br><h6 class='text-error text-center'>&emsp;No Submissions Found<br></h6>";
                }
            }
            /* Subject WIse */
        } else {
            echo "<script type='text/javascript'>show_error('Error: Invalid Syntax given..');</script>";
        }
        echo <<<b
\t</div>
\t</div>
\t<div class='span3'>
b;
        go_home();
        sidepanel();
        echo "</div></div></div>";
        display_footer();
        echo "\n</body>\n</html>";
    }
}
コード例 #15
0
function browse_students($title)
{
    if (!check_login()) {
        header('location:login.php');
    } else {
        include 'config/globals.php';
        $cls_page = $_SERVER['QUERY_STRING'];
        $cp = explode('/', $cls_page);
        $len = count($cp);
        if ($len == 2 or $len == 3 and $cp[2] == null) {
            $class = '/^' . $globalbranch . '[1-' . $classno . ']{1}$/';
            $page = '/^[1-9]{1}$/';
            if (preg_match($class, $cp[0]) and preg_match($page, $cp[1])) {
                include 'config/db.php';
                include 'config/settings.php';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)){die(mysql_error());}
                echo "<!DOCTYPE html>\n<html>\n";
                display_headers($title);
                echo "\n<body>";
                menu();
                echo <<<browse
\t\t\t\t\t<div class="container" style="margin-top:-15px;height:450px;"><br>
\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t<div class="span9">
\t\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t\t\t<div id="step1" class="span4">     
\t\t\t\t\t\t\t\t\t\t\t<h5>Students @ {$cp['0']} </h5>
\t\t\t\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing all students in {$cp['0']} </h6>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t\t<div id="page1" class="span4">
\t\t\t\t\t\t\t\t\t\t\t<a class="pull-right"><h6>Page {$cp['1']}  </h6></a>
\t\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t<div id={$cp['0']} >
\t\t\t\t\t\t\t\t\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t\t\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">RNo</th> 
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">ID #</th>
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span3">Name</th> 
\t\t\t\t\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">Gender</th>
\t\t\t\t\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t\t\t\t\t</thead>
\t\t\t\t\t\t\t\t\t\t\t<tbody>
browse;
                $page = $cp[1];
                $prev = $page - 1;
                $next = $page + 1;
                $per_page = 10;
                $slimit = ($page - 1) * 10;
                $branch = substr($cp[0], 0, strlen($cp[0]) - 1);
                $class = substr($cp[0], -1);
                $query1 = mysql_query("SELECT Id From " . $table . " WHERE Branch = '{$branch}' and Class = '{$class}';");
                $strength = mysql_num_rows($query1);
                $query = "SELECT Id,Name,Gender,RNo From " . $table . " WHERE Branch='{$branch}' and Class='{$class}' LIMIT {$slimit},{$per_page};";
                $exe = mysql_query($query) or die(mysql_error());
                $lastpage = ceil($strength / $per_page);
                for ($i = 0; $i < mysql_num_rows($exe); $i++) {
                    $det = mysql_fetch_array($exe);
                    $lnk = "./students.php?" . $det[0] . "/sub";
                    $nm = ucwords(strtolower($det[1]));
                    echo <<<student
\t\t\t\t\t<tr onclick="document.location.href='{$lnk}';" style='cursor:pointer;'>  
\t\t\t\t\t\t<td style="text-align:center;">{$det['3']}</td> 
\t\t\t\t\t\t<td style="text-align:center;">{$det['0']}</td> 
\t\t\t\t\t\t<td>{$nm}</td>
\t\t\t\t\t\t<td style="text-align:center;" >{$det['2']}</td>   
\t\t\t\t\t</tr>
student;
                }
                echo <<<next
\t\t\t\t</tbody>
\t\t\t\t</table>\t\t\t
\t\t\t\t</div>
\t\t\t\t<div class="pagination pagination-centered">
\t\t\t\t<ul>
next;
                if ($page == 1 and $strength > 0) {
                    echo "<li class='disabled'><a>&larr;Prev</a></li>";
                    for ($i = 1; $i <= $lastpage; $i++) {
                        echo "<li><a href='?{$cp['0']}/{$i}/'>{$i}</a></li>";
                    }
                    echo "<li><a href='?{$cp['0']}/{$next}/'>Next&rarr;</a></li>";
                } elseif ($page > 1 and $page < $lastpage) {
                    echo "<li><a href='?{$cp['0']}/{$prev}/'>&larr;Prev</a></li>";
                    for ($i = 1; $i <= $lastpage; $i++) {
                        echo "<li><a href='?{$cp['0']}/{$i}/'>{$i}</a></li>";
                    }
                    echo "<li><a href='?{$cp['0']}/{$next}/'>Next&rarr;</a></li>";
                } elseif ($page == $lastpage) {
                    echo "<li><a href='?{$cp['0']}/{$prev}/'>&larr;Prev</a></li>";
                    for ($i = 1; $i <= $lastpage; $i++) {
                        echo "<li><a href='?{$cp['0']}/{$i}/'>{$i}</a></li>";
                    }
                    echo "<li class='disabled'><a>Next&rarr;</a></li>";
                } else {
                    echo "No records found.";
                }
                echo <<<next
\t\t\t\t\t\t</ul>
\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="span3">
next;
                go_home();
                classes($classno, $globalbranch);
                echo "</div></div>";
                display_footer();
                echo "\n</div></body>\n</html>";
            } else {
                echo "Error :  Invalid syntax in URL.<br>";
            }
        } else {
            echo "Error :  Invalid syntax in URL.<br>";
        }
    }
}
コード例 #16
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();
        }
    }
}
コード例 #17
0
function feedback($title)
{
    if (!check_login()) {
        header("location:login.php");
    } else {
        include 'config/globals.php';
        include 'config/db.php';
        include 'config/settings.php';
        $dbname = $branchyear . '_Logs';
        $table = $branchyear . '_Feedback';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo <<<js
\t\t\t\t<script type='text/javascript'>
\t\t\t\t\tfunction Preview(id,val){
\t\t\t\t\t\tdocument.getElementById(id).innerHTML=val;
\t\t\t\t\t}
\t\t\t\t</script>
js;
        echo "<body>\n";
        menu();
        echo <<<feedback
\t\t\t<div class="container" style="margin-top:-15px;">
\t\t\t\t\t<br>
\t\t\t\t\t<div id="error"></div>
\t\t\t\t\t<div class="row">
\t\t\t\t\t\t<div class="span9">
\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t\t\t\t\t<div id="stpe2_P1">
\t\t\t\t\t\t\t\t\t<h5>Give Feedback </h5>
\t\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Fill out below details  </h6>
\t\t\t\t\t\t\t\t\t<!--<h5>Period 1 : </h5>-->
\t\t\t\t\t\t\t\t\t<form method="POST" action="" onSubmit="return give_feedback();" >
\t\t\t\t\t\t\t\t\t\t<h6 > Feedback Type :</h6>
\t\t\t\t\t\t\t\t\t\t<label class="radio inline">
\t\t\t\t\t\t\t\t\t\t<input type="radio" id='complaint' value="Complaint" name="ftype" onclick="Preview(this.name,this.value);"> Complaint 
\t\t\t\t\t\t\t\t\t</label>
\t\t\t\t\t\t\t\t\t<label class="radio inline">
\t\t\t\t\t\t\t\t\t\t<input type="radio" id='suggestion' value="Suggestion" name="ftype" onclick="Preview(this.name,this.value);"> Suggestion
\t\t\t\t\t\t\t\t\t</label><br><br>
\t\t\t\t\t\t\t\t<h6> Subject :</h6>
\t\t\t\t\t\t\t\t<input type="text" class="span8" placeholder="Subject" id='subject' name='sub' onkeyup="Preview(this.name,this.value);"><br>
\t\t\t\t\t\t\t\t<h6> Message :</h6>
\t\t\t\t\t\t\t\t<textarea class="span8" id='feedback' name='fb' style="resize:vertical;height:90px;" onkeyup="Preview(this.name,this.value);" placeholder="Type your complaint/suggestion here"></textarea>
\t\t\t\t<br>
\t\t\t</div>
\t\t\t<div id="stpe3">
\t\t\t\t<a ><h5>Preview </h5></a>
\t\t\t\t<!--<h6> &emsp;&emsp;&emsp; - &emsp; Confirm Your Notice </h6>-->
\t\t\t\t<div class="row">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t\t<table class="table  table-hover table-bordered" >
\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t\t<th class="span2"  > Feedback Type  </th>
\t\t\t\t\t\t\t\t\t<td class='span6' id='ftype'> Complaint/Suggestion  </td>
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t<th class="span2"  > Suject </th>
\t\t\t\t\t\t\t\t<td class="span6" id='sub'> Feedback subject  </td>  
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr> 
\t\t\t\t\t\t\t\t<th class="span2" > Feedback  </th> 
\t\t\t\t\t\t\t\t<td class="span6" id='fb'> Complaint/Suggestion  </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</div>
\t\t\t</div><br>
\t\t\t<input type="submit" class="btn btn-primary" value="Confirm & Send &rarr;" name="post" />
\t\t\t</form>
\t\t</div>
\t\t<br>
\t</div>
</div>
feedback;
        echo "<div class='span3'>";
        go_home();
        sidepanel();
        echo "</div></div>";
        display_footer();
        echo "\n</body>\n</html>";
    }
}
コード例 #18
0
ファイル: ToolExportAction.php プロジェクト: pvidali/BCSR-1
<?php

/**
 * @package Helios Calendar
 * @license GNU General Public License version 2 or later; see LICENSE
 */
set_time_limit(600);
define('hcAdmin', true);
include '../loader.php';
admin_logged_in();
action_headers();
$token = isset($_POST['token']) ? cIn(strip_tags($_POST['token'])) : '';
if (!check_form_token($token)) {
    go_home();
}
include HCLANG . '/admin/tools.php';
$catID = $_POST['catID'];
$catIDWhere = '0,' . implode(',', $_POST['catID']);
$tID = isset($_POST['tID']) && is_numeric($_POST['tID']) ? cIn(strip_tags($_POST['tID'])) : 0;
$mID = isset($_POST['mID']) && is_numeric($_POST['mID']) ? cIn(strip_tags($_POST['mID'])) : 0;
$expVars = array(1 => array('tag' => '[event_id]', 'field' => '29'), 2 => array('tag' => '[event_title]', 'field' => '0'), 3 => array('tag' => '[event_desc]', 'field' => '1'), 4 => array('tag' => '[event_date]', 'field' => '30'), 5 => array('tag' => '[event_time_start]', 'field' => '2'), 6 => array('tag' => '[event_time_end]', 'field' => '3'), 7 => array('tag' => '[event_cost]', 'field' => '4'), 8 => array('tag' => '[event_billboard]', 'field' => '5'), 9 => array('tag' => '[contact_name]', 'field' => '6'), 10 => array('tag' => '[contact_email]', 'field' => '7'), 11 => array('tag' => '[contact_phone]', 'field' => '8'), 12 => array('tag' => '[contact_url]', 'field' => '9'), 13 => array('tag' => '[space]', 'field' => '10'), 14 => array('tag' => '[loc_name]', 'field' => 'X'), 15 => array('tag' => '[loc_address]', 'field' => 'X'), 16 => array('tag' => '[loc_address2]', 'field' => 'X'), 17 => array('tag' => '[loc_city]', 'field' => 'X'), 18 => array('tag' => '[loc_region]', 'field' => 'X'), 19 => array('tag' => '[loc_postal]', 'field' => 'X'), 20 => array('tag' => '[loc_country]', 'field' => 'X'), 21 => array('tag' => '[loc_url]', 'field' => '26'), 22 => array('tag' => '[cal_url]', 'field' => 'X'), 23 => array('tag' => '[date_series]', 'field' => 'X'), 24 => array('tag' => '[date_unique]', 'field' => '30'), 25 => array('tag' => '[category_unique]', 'field' => '31'), 26 => array('tag' => '[desc_notags]', 'field' => '1'));
$result = doQuery("SELECT * FROM " . HC_TblPrefix . "templates WHERE IsActive = 1 AND PkID = '" . $tID . "'");
if (hasRows($result)) {
    $content = mysql_result($result, 0, 2);
    $header = mysql_result($result, 0, 3);
    $footer = mysql_result($result, 0, 4);
    $ext = mysql_result($result, 0, 5);
    $groupBy = mysql_result($result, 0, 7);
    $sortBy = mysql_result($result, 0, 8);
    $cleanUp = explode("\n", mysql_result($result, 0, 9));
    $dateFormat = mysql_result($result, 0, 10);
コード例 #19
0
function display_feedback($title)
{
    if (!check('SA') and !check('BA')) {
        header("location:./?sub");
    } else {
        include 'config/globals.php';
        $pg = $_SERVER['QUERY_STRING'];
        $page = '/^[\\d]+$/';
        if (preg_match($page, $pg)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Logs';
            $table = $branchyear . '_Feedback';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "<body>\n";
            menu();
            echo <<<display
\t\t\t\t <br><div class="container" style="margin-top:-15px;">
\t\t\t\t\t <div class="row">
\t\t\t\t\t\t<div class="span9">
\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
\t\t\t\t\t\t\t\t<div class="row">
\t\t\t\t\t\t\t\t\t<div id="step1" class="span4">     
\t\t\t\t\t\t\t\t\t\t<h5>Feedback</h5>
\t\t\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing all complaints and suggestions </h6>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t<div id="page1" class="span4">
\t\t\t\t\t\t\t\t\t\t<a class="pull-right"><h6>Page {$pg}</h6></a>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t</div>
display;
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $query = "SELECT * From " . $table . " ORDER BY SNo DESC;";
            $exe = mysql_query($query) or die(mysql_error());
            $page = $pg;
            $prev = $page - 1;
            $next = $page + 1;
            $per_page = 10;
            $slimit = ($page - 1) * 10;
            $total = mysql_num_rows($exe);
            $lastpage = ceil($total / $per_page);
            $query1 = "SELECT * FROM " . $table . " ORDER BY SNo DESC LIMIT {$slimit},{$per_page};";
            $exe1 = mysql_query($query1) or die(mysql_error());
            if ($total > 0) {
                echo <<<table
\t\t\t\t\t<div id='{$globalbranch}' >
\t\t\t\t\t\t<table class="table  table-hover table-bordered "  style="padding:0px;">
\t\t\t\t\t\t\t<thead>
\t\t\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">Date</th>
\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span4">Subject</th>
\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">Sender</th> 
\t\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t</thead>
\t\t\t\t\t\t\t<tbody>
\t\t\t\t\t\t\t
table;
                for ($i = 0; $i < mysql_num_rows($exe1); $i++) {
                    $record = mysql_fetch_array($exe1);
                    $datetime = explode(' ', $record['DateTime']);
                    $date = $datetime[0];
                    echo <<<feedback
\t\t\t<tr data-toggle='modal' href="#Note{$record['0']}" style="cursor:pointer;" >
\t\t\t\t<td style="text-align:center;">{$date}</td>  
\t\t\t\t<td >{$record['2']}</td> 
\t\t\t\t<td style="text-align:center;"> {$record['4']}  </td>
\t\t\t </tr>\t
\t\t\t\t\t
feedback;
                }
                echo <<<feedback
\t\t\t\t</tbody>
\t\t\t\t</table>
\t\t\t\t</div>
\t\t\t\t
feedback;
                $query2 = "SELECT * FROM " . $table . " ORDER BY SNo DESC LIMIT {$slimit},{$per_page};";
                $exe2 = mysql_query($query2) or die(mysql_error());
                for ($i = 0; $i < mysql_num_rows($exe1); $i++) {
                    $record = mysql_fetch_array($exe2);
                    $datetime = explode(' ', $record['DateTime']);
                    $date = $datetime[0];
                    if (preg_match("/&lt;br&gt;/", $record[3])) {
                        $record[3] = str_replace("&lt;br&gt;", "<br>", $record[3]);
                    }
                    echo <<<feedback
\t\t\t\t<div id="Note{$record['0']}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true">
\t\t\t\t\t<div class="modal-header">
\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<h5>{$record['2']}</h5> 
\t\t\t\t\t</div>
\t\t\t\t\t<div class="modal-body">
\t\t\t\t\t\t<p>{$record['3']}</p>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="modal-footer">
\t\t\t\t\t\t<h6 class="pull-left">{$record['1']} sent by<i> {$record['4']} </i> @ {$record['5']} </h6>
\t\t\t\t\t</div>
\t\t\t\t</div>\t\t
feedback;
                }
                echo <<<page
\t\t\t<div class="pagination pagination-centered">
\t\t\t\t<ul>
page;
                if ($page < $total / 10 + 1) {
                    if ($page != 1) {
                        echo "<li><a href='?{$prev}'>&larr; Prev</a></li>";
                    } else {
                        echo "<li class='disabled'><a>&larr; Prevt</a></li>";
                    }
                    if ($lastpage <= 10) {
                        for ($i = 1; $i <= $lastpage; $i++) {
                            if ($page == $i) {
                                echo "<li class='active'><a href='?{$i}'><b class='text-error'> {$i}</b></a></li>";
                            } else {
                                echo "<li><a href='?{$i}'>{$i}</a></li>";
                            }
                        }
                    } else {
                        $init1 = $page % 10 == 0 ? (floor($page / 10) - 1) * 10 + 1 : floor($page / 10) * 10 + 1;
                        // total no of records total pages pages range
                        //echo $page/10; echo $lastpage/10;
                        $end1 = floor(($page - 1) / 10) == floor($lastpage / 10) ? $lastpage : ceil($page / 10) * 10;
                        for ($i = $init1; $i <= $end1; $i++) {
                            if ($page == $i) {
                                echo "<li class='active'><a href='?{$i}'><b class='text-error'> {$i}</b></a></li>";
                            } else {
                                echo "<li><a href='?{$i}'>{$i}</a></li>";
                            }
                        }
                    }
                    if ($page != $lastpage) {
                        echo "<li><a href='?{$next}'>Next &rarr;</a></li>";
                    } else {
                        echo "<li class='disabled'><a>Next &rarr;</a></li>";
                    }
                } else {
                    echo "<script>show_error('No notifications found');</script>";
                }
                echo <<<next
\t\t\t\t\t\t</ul>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t
\t\t\t\t\t\t\t
next;
            } else {
                echo "<center><p>No complaints/suggestions found.</p></center>";
            }
            echo "</div></div><div class='span3'>";
            go_home();
            sidepanel();
            echo "</div></div>";
            display_footer();
            echo "\n</body>\n</html>";
        } else {
            echo "<script type='text/javascript'>document.location.href='404.php';</script>";
        }
    }
}