当前位置: 首页>>代码示例>>PHP>>正文


PHP display_headers函数代码示例

本文整理汇总了PHP中display_headers函数的典型用法代码示例。如果您正苦于以下问题:PHP display_headers函数的具体用法?PHP display_headers怎么用?PHP display_headers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了display_headers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

function login($title)
{
    if (check_login()) {
        header('location:./?sub');
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo "\n<body>";
        menu1("login.php", "Login", "user");
        display_loginform();
        $dbname = $branchyear . '_Users';
        $table = $branchyear . '_Students';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        if (isset($_POST["Login"])) {
            $user = mysql_real_escape_string($_POST["UserId"]);
            $pass = md5($_POST["Password"]);
            if (strlen(trim($user)) == 0) {
                echo "<script>show_error('Error : User Id should not be null');</script>";
                exit;
            }
            if (strlen(trim($pass)) == 0) {
                echo "<script>show_error('Error : Password should not be null');</script>";
                exit;
            }
            $q = mysql_query("SELECT Id,Password FROM `{$table}` where Id='" . $user . "';") or die(mysql_error());
            $res = mysql_fetch_array($q);
            if (empty($res)) {
                echo "<script>show_error('Error : Invalid User Id ... Please try again ');</script>";
            } else {
                if ($pass != $res["Password"]) {
                    echo "<script>show_error('Error : Invalid Password ... Please try again ');</script>";
                } else {
                    $_SESSION['UserId'] = $user;
                    header("location: ./?sub");
                }
            }
        }
        echo "\n</body>\n</html>";
        mysql_close($con);
    }
}
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:44,代码来源:login.php

示例2: adminReg

function adminReg($title)
{
    if (check_login()) {
        header("location:index.php");
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        $dbname = $branchyear . '_Users';
        $table = $branchyear . '_Students';
        $table1 = $branchyear . '_Admins';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo "\n<body>";
        menu1("adminreg.php", "Registration", "user");
        show_regform();
    }
}
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:19,代码来源:adminreg.php

示例3: adminForgot

function adminForgot($title)
{
    if (check_login()) {
        header("location:./?sub");
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        $dbname = $branchyear . '_Users';
        $table = $branchyear . '_Students';
        $table1 = $branchyear . '_Admins';
        //if(!mysql_select_db($dbname)) die(mysql_error());
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo "\n<body>";
        menu1("adminforgot.php", "Forgot Password", "unlock");
        show_form();
    }
}
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:19,代码来源:adminforgot.php

示例4: changecr

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>
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:password.php

示例5: printf

        $type = $row['type'];
        $vacant = $row['vacant'];
        $contract_start = $row['contract_start'];
        $contract_end = $row['contract_end'];
        echo "\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><img src='http://www.{$image}' alt='Property Photo' style='width:80px;height:45px;'/></td>\r\n\t\t\t\t\t\t<td class='Property ID'><a href='propertypage.php?pid={$pid}'>{$pid}<p></p></a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>{$address} <br>{$suburb}</td>\r\n\t\t\t\t\t\t<td>{$type}</td>\r\n\t\t\t\t\t\t<td>{$vacant}<br>{$contract_start} - {$contract_end}</td>\r\n\t\t\t\t\t\t</tr>";
    }
}
/*
Checks if the user is logged in through a cookie, and if so directs the user to go to search. 
Otherwise it tells the un-logged in user to go and log in.
*/
if (isset($_COOKIE['id'])) {
    $email = $_COOKIE['id'];
    printf("<p>Go to the search tab to look for available properties</p>");
    printf("<p>Your registered properties:</p>");
    display_headers();
    $result = $pdo->query("\r\n\t\t\t\tSELECT first_name, user_type\r\n\t\t\t\tFROM users\r\n\t\t\t\tWHERE id = '{$id}'");
    foreach ($result as $row) {
        $user_type = $row["user_type"];
        if ($user_type == 'Admin') {
            $result = $pdo->query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM properties\r\n\t\t\t\t\tORDER BY vacant ASC");
            echo "<table>";
            display_results($result);
            echo "</table>";
        } else {
            $result = $pdo->query("\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM properties\r\n\t\t\t\tWHERE rid = '{$id}' OR eid ='{$id}' OR oid = '{$id}'\r\n\t\t\t\tORDER BY pid ASC");
            echo "<table>";
            display_results($result);
            echo "</table>";
        }
    }
开发者ID:karanmand,项目名称:Team-56,代码行数:31,代码来源:index.php

示例6: generate_attendance

function generate_attendance($title)
{
    if (!check("BA")) {
        header('location:./login.php');
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        $p = $_SERVER['QUERY_STRING'];
        if (in_array($p, $allowed_subjects)) {
            echo "<!DOCTYPE html>\n<html>\n";
            display_headers($title);
            echo "\n<body>";
            menu();
            echo <<<a
\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t<div id='error'></div>
a;
            $branch = $globalbranch;
            echo <<<a
\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t
\t\t<div class="row">
\t\t\t<div class='span12'>
\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
            $ar1 = array();
            for ($cln = 1; $cln <= $classno; $cln++) {
                $class = $cln;
                $ar = array();
                $dbname = $branchyear . '_Subjects';
                $table = $branch . $class . '_Subjects';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select RNo,Id from {$table}") or die(mysql_error());
                $strength = mysql_num_rows($q);
                $sub = $p;
                $dbname = $branchyear . '_Subjects';
                $table = $branch . $class . '_Subjects';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $qa = mysql_query("select RNo, `" . $sub . "_A` from {$table}") or die(mysql_error());
                $qp = mysql_query("select RNo, `" . $sub . "_P` from {$table}") or die(mysql_error());
                while ($res = mysql_fetch_array($qa)) {
                    @($ar[$sub]["Absents"] += $res[$sub . "_A"]);
                }
                while ($res = mysql_fetch_array($qp)) {
                    @($ar[$sub]["Presents"] += $res[$sub . "_P"]);
                }
                $ar[$sub]['nod'] = ($ar[$sub]["Absents"] + $ar[$sub]["Presents"]) / $strength;
                $ar1[$branch . $class] = $ar;
            }
            //print_r($ar1);
            echo <<<a
\t\t
\t\t\t<div id="step1" class="span6">     
\t\t\t\t<h5 class='text-info'>All Classes Attendance  Details for {$p}</h5>
\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Lising Data submitted from CRs @ {$branch} </h6><br>
\t\t\t</div>
\t\t\t<div id="side1" class="span5" >
\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
            echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
            for ($cl = 0; $cl < count($allowed_subjects); $cl++) {
                $sub = $allowed_subjects[$cl];
                echo "<a href='?{$sub}'>{$sub}</a>&emsp;";
            }
            echo <<<a
\t\t\t\t\t</h6>
a;
            echo <<<a
\t\t\t</div>
\t\t
a;
            $tr = '';
            $html = '';
            $html .= "<thead><tr><th> SNo </th><th> Class </th><th> Days </th><th> Presents </th><th> Pre/Day </th><th> Absents </th><th> Abs/Day</th><th> Performance </th></tr>";
            @($strength = count($users));
            for ($j = 1; $j <= $classno; $j++) {
                $cls = $branch . $j;
                $tr .= '<tr><td style="text-align:center;"  >' . $j . ' </td> <td  style="text-align:center;" >' . $cls . ' </td>';
                $html .= "<tr><td>" . $j . "</td><td>" . $cls . "</td>";
                $sub = $p;
                $abs = $ar1[$cls][$sub]['Absents'];
                $pres = $ar1[$cls][$sub]['Presents'];
                $p_nod = $abs + $pres;
                @($tmp = $pres / $p_nod * 100);
                $pr = round($tmp, 1);
                $cl = $pr > 50 ? "success" : 'error';
                $cl1 = $pr > 50 ? "green" : "darkred";
                @($perday = $pres / $ar1[$cls][$sub]['nod']);
                @($absday = $abs / $ar1[$cls][$sub]['nod']);
                $tr .= '
					 <td style="text-align:center;">' . round($ar1[$cls][$sub]['nod']) . '</td> 
					<td style="text-align:center;" class="text-success" > ' . $pres . ' </td> 		
					<td style="text-align:center;" class="text-success" > ' . round($perday, 1) . ' </td> 
					<td style="text-align:center;" class="text-error" > ' . $abs . ' </td> 		
					<td style="text-align:center;" class="text-error" > ' . round($absday, 1) . ' </td> 
					<td  style="text-align:center;" class="text-' . $cl . '"  > ' . $pr . '</td>   																
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:onesubject.php

示例7: generate_attendance

function generate_attendance($title)
{
    if (!check_login()) {
        header('location:./login.php');
    } else {
        if (!check_day()) {
            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';
                include 'config/globals.php';
                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<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t
a;
                $table = '';
                //$spread='';
                $dbname = $branchyear . '_Users';
                $table = $branchyear . '_Students';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $userid = $_SESSION['UserId'];
                $q = "select Branch,Class,Position from {$table} where Id = '{$userid}'";
                $res = mysql_query($q) or die(mysql_error());
                $row = mysql_fetch_array($res);
                if ($row['Position'] == "BA") {
                    $branch = $globalbranch;
                    $class = substr($p, -1);
                } else {
                    $branch = $row['Branch'];
                    $class = $row['Class'];
                    $class1 = substr($p, -1);
                    if ($class1 != $class) {
                        //echo 'i am in';
                        echo "<script type='text/javascript'>show_error('Error: Not authorised to access {$branch}{$class1} details.');</script>";
                    }
                }
                echo <<<a
\t\t\t
\t\t\t
\t\t<div class="row">
\t\t\t\t<div class='span12'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
                echo <<<a
\t\t\t
\t\t\t\t<div id="step1" class="span4">     
\t\t\t\t\t<h5 class='text-info'>Time Table Details for Class {$branch}&nbsp;{$class} </h5>
\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing Data present in our database </h6><br>
\t\t\t\t</div>
\t\t\t\t<div id="side1" class="span7" >
\t\t\t\t\t<h6 class='text-right'><a href='./?sub'><i class='icon-home'></i> Home&nbsp;</a> </h6>
a;
                if ($row['Position'] == "BA") {
                    echo <<<a
\t\t\t\t\t<h6 class='text-right'>
a;
                    for ($cl = 1; $cl <= $classno; $cl++) {
                        echo "<a href='?{$globalbranch}{$cl}'>{$globalbranch}{$cl}</a>&emsp;";
                    }
                    echo <<<a
\t\t\t\t\t</h6>
a;
                }
                echo <<<a
\t\t\t\t</div>
\t\t\t
a;
                $html = "";
                echo '<table class="table  table-hover table-bordered "  style="padding:0px;">
						<thead>
							<tr> 
								<th style="text-align:center;"  > Period/Day  </th> 
								<th style="text-align:center;"  > Monday  </th> 
								<th style="text-align:center;"  > Tuesday  </th> 
								<th style="text-align:center;"  > Wednesday  </th> 
								<th style="text-align:center;"  > Thursday  </th> 
								<th style="text-align:center;"  > Friday  </th> 
								<th style="text-align:center;"  > Saturday  </th> 
							</tr>
						</thead>
						<tbody>';
                //$spread.=" \t \t P1  \t P2 \t  P3 \t P4 \t \t \t\nRno\tID\t".$subjects['P1']."\t".$subjects['P2']."\t".$subjects['P3']."\t".$subjects['P4']."\tPresents\tAbsents\n";
                $html .= "<thead><tr> \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<th > Period/Day </th> \n\t\t\t\t\t\t\t\t<th > Monday </th>\n\t\t\t\t\t\t\t\t<th > Tuesday </th>  \n\t\t\t\t\t\t\t\t<th > Wednesday </th>\n\t\t\t\t\t\t\t\t<th > Thursday </th>\n\t\t\t\t\t\t\t\t<th > Friday </th>  \n\t\t\t\t\t\t\t\t<th > Saturday </th> \n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead><tbody>";
                $dbname = $branchyear . '_TimeTable';
                $table = $branch . $class . '_TimeTable';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $ti = mysql_query("SELECT * from {$table};") or die(mysql_error());
                while ($res = mysql_fetch_array($ti)) {
                    echo "<tr>";
                    $html .= "<tr>";
                    for ($ct = 0; $ct < 7; $ct++) {
                        if ($ct == 0) {
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:tt.php

示例8: changecr

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>
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:changecr.php

示例9: login

function login($title)
{
    if (check_login()) {
        header('location:./?sub');
    } else {
        include 'config/db.php';
        include 'config/settings.php';
        include 'config/globals.php';
        echo "<!DOCTYPE html>\n<html>\n";
        display_headers($title);
        echo "\n<body>";
        menu1("forgot.php", "Forgot Password", "unlock");
        display_form();
        //echo "<script>show_success('Contact your CR for Security Code');</script>";
        if (isset($_POST["forgot"])) {
            $user = addslashes($_POST["UserId"]);
            $code = addslashes($_POST["Code"]);
            $pass1 = addslashes($_POST["Pass1"]);
            $pass2 = addslashes($_POST["Pass2"]);
            if (strlen(trim($user)) == 0) {
                echo "<script>show_error('Error : User id should not be null');</script>";
                exit;
            }
            if (strlen(trim($code)) == 0) {
                echo "<script>show_error('Error : Security code should not be null');</script>";
                exit;
            }
            if (strlen(trim($pass2)) < 7) {
                echo "<script>show_error('Error : Password Length Must Be Lessthan or equals to 7');</script>";
                exit;
            }
            if (strlen(trim($pass1)) < 7) {
                echo "<script>show_error('Error : Re-Password Length Must Be Lessthan or equals to 7');</script>";
                exit;
            }
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) {die(mysql_error());}
            $pass = md5($pass1);
            $q = mysql_query("SELECT Id,Password FROM {$table} where Id='" . $user . "';") or die(mysql_query());
            $res = mysql_fetch_array($q);
            if (empty($res)) {
                echo "<script>show_error('Error : Invalid User Id ... Please try again ');</script>";
                exit;
            } else {
                if ($pass1 != $pass2) {
                    echo "<script>show_error('Error : Passwords does not matched ... Please try again ');</script>";
                    exit;
                } else {
                    $dbname = $branchyear . '_Logs';
                    $table = $branchyear . '_Passwords';
                    //if(!mysql_select_db($dbname)) {die(mysql_error());	}
                    $q = "select `SNo`,`EndTime`, `Code`, `To`, `Status` from `{$table}` where `To` = '{$user}';";
                    $res = mysql_query($q) or die(mysql_error());
                    $n = mysql_num_rows($res);
                    $end = "";
                    $dif = 0;
                    $code1 = "";
                    $status = "";
                    $sn = 0;
                    $StartTime = date('d-m-Y H:i:s');
                    while ($row = mysql_fetch_array($res)) {
                        $end = $row['EndTime'];
                        $dif = strtotime($end) - strtotime($StartTime);
                        $code1 = $row['Code'];
                        $status = $row['Status'];
                        $sn = $row['SNo'];
                    }
                    if ($dif <= 7200 && $dif > 0 && $n) {
                        if ($status == 'valid') {
                            if ($code1 == $code) {
                                $dbname = $branchyear . '_Users';
                                $table = $branchyear . '_Students';
                                //if(!mysql_select_db($dbname)) die(mysql_error());
                                $q = mysql_query("update {$table} set Password = '{$pass}' where Id='" . $user . "';") or die(mysql_query());
                                $dbname = $branchyear . '_Logs';
                                $table = $branchyear . '_Passwords';
                                //if(!mysql_select_db($dbname)) {die(mysql_error());}
                                $q = mysql_query("update {$table} set Status = 'used' where `SNo` ='" . $sn . "';") or die(mysql_query());
                                echo "<script>show_success('{$user} password updated click on login button');</script>";
                            } else {
                                echo "<script>show_error('<b>Error </b> : Security code does not matched ... Please try again ');</script>";
                            }
                        } else {
                            echo "<script>show_error('<b>Error </b> : Security code already used ... Contact your CR ');</script>";
                        }
                    } else {
                        echo "<script>show_error('<b>Error </b> : Security code expired ... Contact your CR');</script>";
                    }
                }
            }
        }
        echo "\n</body>\n</html>";
        mysql_close($con);
    }
}
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:96,代码来源:forgot.php

示例10: generate_attendance

function generate_attendance($title)
{
    if (!check_login()) {
        header('location:./login.php');
    } else {
        include 'config/globals.php';
        $qs1 = $_SERVER['QUERY_STRING'];
        $reg1 = "/^[0-9]{2}-[0-9]{2}-[0-9]{4}\$/";
        $reg2 = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/";
        $qs = explode('/', $qs1);
        $len = count($qs);
        if ($len == 2 or $len == 3 && $qs[2] == "") {
            $ar = explode('-', $qs[0]);
            if (preg_match($reg1, $qs[0]) && preg_match($reg2, $qs[1])) {
                if (checkdate($ar[1], $ar[0], $ar[2])) {
                    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());
                    $p = $qs[1];
                    $userid = $_SESSION['UserId'];
                    $q = "select Branch,Class,Position from {$table} where Id = '{$userid}'";
                    $res = mysql_query($q) or die(mysql_error());
                    $row = mysql_fetch_array($res);
                    if ($row['Position'] == "BA") {
                        $branch = $globalbranch;
                        $class = substr($p, -1);
                    } else {
                        $branch = $row['Branch'];
                        $class = $row['Class'];
                        $class1 = substr($p, -1);
                        if ($class1 != $class) {
                            display_error("Error : Not allowed to access  {$class1} details");
                            die;
                        }
                    }
                    $da = $qs[0];
                    $date = $qs[0];
                    $dif = strtotime($da) - strtotime(date('d-m-Y'));
                    if ($dif > 0) {
                        display_error("Error : Not allowed to access future Attendance");
                    } else {
                        if (check_day2($da, $branch . $class)) {
                            display_error("Error : Not allowed to access Attendance of semester starting dates");
                        } else {
                            if (check_day1($da)) {
                                echo noservice();
                            } else {
                                echo "<!DOCTYPE html>\n<html>\n";
                                display_headers($title);
                                echo "\n<body>";
                                menu();
                                echo <<<a
\t\t\t\t\t\t
\t<div class="container" style="margin-top:-10px;"><br>
\t\t\t\t\t\t<div id="error" style="display:none;margin-top:10px;"></div>
\t\t\t\t\t\t
a;
                                $table = '';
                                //$spread='';
                                $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);
                                echo <<<a
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t
\t\t\t\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());
                                $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 {
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:today1.php

示例11: display_headers

<?php

include "functions.php";
$p = $_SERVER['QUERY_STRING'];
echo "<!DOCTYPE html>\n<html>\n";
display_headers(" Error : 404 - Page Not Found!  ");
echo "\n<body>";
notfound("Page you are looking for is no longer available");
echo "\n</body>\n</html>";
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:9,代码来源:404.php

示例12: display_headers

<?php

require "functions.php";
echo "<!DOCTYPE html>\n<html>\n";
display_headers($title);
echo "\n<body>";
menu();
echo <<<a
<div class="container" style="margin-top:-15px;">
        <br>
            <div id="CSE1" class='well well-large' style="background:#FFF;">
                
               <div id="step1">     
\t\t\t\t\t<h5 class='text-info'>Developers Page @ Attendance Portal </h5>
\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Contact us for any technical problems of Attendance Portal </h6><br>
\t\t\t\t</div>
                \t<br>
               <div class="row">
\t\t\t\t   <div class='span1'></div>
\t\t\t\t   <div class='span5'>
\t\t\t\t\t   <div class='span1'><img src='assets/img/user.jpg'/></div>
\t\t\t\t\t   <div class='span3'>
\t\t\t\t\t\t       <address >
\t\t\t\t\t\t\t\t<strong>Aneesh Kumar T</strong><br>
\t\t\t\t\t\t\t\tN090247<br>
\t\t\t\t\t\t\t\tCSE1 - 2009 <br>
\t\t\t\t\t\t\t\t<a href="mailto:#">N090247@nuz.rgukt.in</a>
\t\t\t\t\t\t\t\t</address>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t\t<div class='span5'>
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:31,代码来源:developers.php

示例13: display_notice

function display_notice($title)
{
    $userid = $_SESSION['UserId'];
    if (!check_login()) {
        header("location:login.php");
    } else {
        include 'config/globals.php';
        $pg = $_SERVER['QUERY_STRING'];
        $page = '/^[\\d]+$/';
        $todaydate = date('d/m/Y');
        if (preg_match($page, $pg)) {
            include 'config/db.php';
            include 'config/settings.php';
            $dbname = $branchyear . '_Logs';
            $table = $branchyear . '_Notifications';
            //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 <div class="container" style="margin-top:-15px;"><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="span12">
\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>Notifications</h5>
\t\t\t\t\t\t\t\t\t\t<h6> &emsp;&emsp;&emsp; - &emsp; Listing all notifications </h6>
\t\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t\t<div id="page1" class="span7">
\t\t\t\t\t\t\t\t\t\t&emsp;<a class="pull-right"><h6>Page {$pg}</h6></a>&emsp;
\t\t\t\t\t\t\t\t\t\t<a class="pull-right" href='./?sub'><h6><i class='icon-home'></i> Home&nbsp;| &nbsp;</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("".$branchyear."_Users")) die(mysql_error());
            $scheck = mysql_query("SELECT Branch,Class,Position FROM " . $branchyear . "_Students WHERE Id='{$userid}';") or die(mysql_error());
            $sdet = mysql_fetch_array($scheck);
            $class = $sdet[0] . $sdet[1];
            $type = $sdet['Position'];
            $toS = $class . "@Students";
            $crcheck = mysql_query("SELECT Id FROM " . $branchyear . "_CRs WHERE Id='{$userid}';") or die(mysql_error());
            //if(!mysql_select_db($dbname)) die(mysql_error());
            if (mysql_num_rows($crcheck) == 1) {
                $toCR = $class . "@CRs";
                $query = "SELECT * FROM " . $table . " WHERE `To`='{$toS}' or `To`='{$toCR}' or `To` = 'all' or `To`= 'allcrs' ORDER BY SNo DESC;";
            } else {
                if ($type == "BA" or $type == "SA") {
                    $query = "SELECT * FROM " . $table . "  ORDER BY SNo DESC;";
                } else {
                    $query = "SELECT * From " . $table . " WHERE `To`='{$toS}' or `To` = 'all' ORDER BY SNo DESC;";
                }
            }
            //echo $userid;
            $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);
            //if($total == 0) echo "<script>show_error('No notifications found');</script>";
            $lastpage = ceil($total / $per_page);
            if (mysql_num_rows($crcheck) == 1) {
                $query1 = "SELECT * FROM " . $table . " WHERE `To`='{$toS}' or `To`='{$toCR}' or `To`='all' or `To`='allcrs' ORDER BY SNo DESC LIMIT {$slimit},{$per_page};";
            } else {
                if ($type == "BA" or $type == "SA") {
                    $query1 = "SELECT * FROM " . $table . "  ORDER BY SNo DESC LIMIT {$slimit},{$per_page};";
                } else {
                    $query1 = "SELECT * FROM " . $table . " WHERE `To`='{$toS}' or `To`='all' 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="span3">Subject</th>
\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">To</th> 
\t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span2">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];
                    if ($type == "BA") {
                        if ($record[1] == "all") {
                            $to = "ALL Students";
                        } else {
                            if ($record[1] == "allcrs") {
                                $to = $to = "ALL CRs";
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:displaynotice.php

示例14: generate_attendance

function generate_attendance($title)
{
    if (!check_login()) {
        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';
            include 'config/globals.php';
            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<div id='error'></div>
a;
            $dbname = $branchyear . '_Users';
            $table = $branchyear . '_Students';
            //if(!mysql_select_db($dbname)) die(mysql_error());
            $userid = $_SESSION['UserId'];
            $q = "select Position, Branch,Class from {$table} where Id = '{$userid}'";
            $res = mysql_query($q) or die(mysql_error());
            $row = mysql_fetch_array($res);
            if ($row['Position'] == "BA") {
                $branch = $globalbranch;
                $class = substr($p, -1);
            } else {
                $branch = $row['Branch'];
                $class = $row['Class'];
                $class1 = substr($p, -1);
                if ($class1 != $class) {
                    echo "<script type='text/javascript'>show_error('Error: Not authorised to access {$branch}{$class1} details.');</script>";
                }
            }
            $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');
            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='span12'>
\t\t\t\t\t<div class="well well-large" style="background:#FFF;">
a;
            $ar = array();
            $users = array();
            $html = "";
            //$spread="";
            for ($j = 1; $j <= 4; $j++) {
                $prd = "P" . $j;
                $dbname = $branchyear . '_Attendance';
                $table = $branch . $class . '_Attendance';
                //if(!mysql_select_db($dbname)) die(mysql_error());
                $q = mysql_query("select RNo,Id from {$table}") or die(mysql_error());
                while ($res = mysql_fetch_array($q)) {
                    if ($j == 1) {
                        $users[$res['RNo']] = $res['Id'];
                    }
                    $ar[$prd][$res['RNo']]['Absents'] = 0;
                    $ar[$prd][$res['RNo']]['Presents'] = 0;
                }
            }
            for ($j = 1; $j <= 4; $j++) {
                $prd = "P" . $j;
                $prd1 = $prd . "_Con";
                $dates = array();
                $coun = 0;
                //mysql_select_db($branchyear."_Dates") or die(mysql_error());
                $q = mysql_query("Select Date from " . $branch . $class . "_Dates where `{$prd1}` ='ok' ;") or die(mysql_error());
                $nodq = mysql_num_rows($q);
                $ar[$prd]['nod'] = $nodq;
                while ($dad = mysql_fetch_array($q)) {
                    $dates[$coun++] = $dad[0];
                }
                foreach ($dates as $key => $da) {
                    $dbname = $branchyear . '_Attendance';
                    $table = $branch . $class . '_Attendance';
                    //if(!mysql_select_db($dbname)) die(mysql_error());
                    $q = mysql_query("select RNo, `{$da}` from {$table}") or die(mysql_error());
                    while ($res = mysql_fetch_array($q)) {
                        $exp = explode(",", $res[$da]);
                        for ($z = 0; $z < count($exp); $z++) {
                            if (substr($exp[$z], 0, 2) == $prd) {
                                if (substr($exp[$z], -1) == "A") {
                                    $ar[$prd][$res['RNo']]["Absents"] += 1;
                                } else {
                                    $ar[$prd][$res['RNo']]["Presents"] += 1;
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:periods.php

示例15: homepage

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\t\t\t<div class='container'>
\t\t\t\t\t<div id='error'></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">
\t\t\t\t\t\t
a;
        splash();
        echo <<<a
\t<div id="step1" class="span4">     
\t\t
\t</div>
\t<div id="side1" class="span4" >
\t\t<h6 class='text-right'><a href='?sub'><i class='icon-book'></i>&nbsp; Subjects</a> &emsp; <a href='?p'><i class='icon-qrcode'></i>&nbsp; Periods</a></h6>
\t</div>
a;
        /* 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 = $_SESSION['UserId'];
        $q = "select Position, Branch, Class ,RNo from {$table} where Id = '{$userid}'";
        $res = mysql_query($q) or die(mysql_error());
        $row = mysql_fetch_array($res);
        $RNo = $row["RNo"];
        $type = $row['Position'];
        if ($row['Position'] == "BA") {
            $branch = $globalbranch;
            $p1 = substr($_SERVER["QUERY_STRING"], 0, $branchlen);
            if ($p1 == $globalbranch) {
                $p = explode("/", $_SERVER["QUERY_STRING"]);
                $class = substr($p[0], -1);
            } else {
                $class = 1;
            }
        } else {
            $branch = $row['Branch'];
            $class = $row['Class'];
        }
        $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8');
        shuffle($colors);
        $colorz = array('F6BD0F,8BBA00', 'FF8E46,8E468E', '8E468E,588526', '008ED6,9D080D');
        $reqcolorz = explode(",", $colorz[rand(0, 3)]);
        /* Deatils Fetched */
        /* Start Checking wheter he is a student or any other */
        if ($type == "S") {
            /* Starting Period Wise Attendance */
            if (strtolower($_SERVER["QUERY_STRING"]) == "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> <small>' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </small></b></td>   
			</tr>');
                        @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>");
//.........这里部分代码省略.........
开发者ID:0xc0d3r,项目名称:Attendance-Portal,代码行数:101,代码来源:index.php


注:本文中的display_headers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。