Ejemplo n.º 1
0
     echo "Not in database";
 } else {
     $outarr = $search_title['period'];
     $out = explode(" ", $outarr);
     $matrix = zeros(5, 13);
     $c = 0;
     for ($i = 0; $i < 5; $i++) {
         for ($j = 0; $j < 13; $j++) {
             $matrix[$i][$j] = $out[$c++];
         }
     }
     date_default_timezone_set("Asia/Kolkata");
     $day = date("l");
     $hour = date("H");
     $minute = date("i");
     $timarr = zeros(13, 2);
     $timarr[0][0] = 8;
     $timarr[0][1] = 50;
     $timarr[1][0] = 9;
     $timarr[1][1] = 45;
     $timarr[2][0] = 10;
     $timarr[2][1] = 40;
     $timarr[3][0] = 11;
     $timarr[3][1] = 35;
     $timarr[4][0] = 12;
     $timarr[4][1] = 30;
     $timarr[5][0] = 13;
     $timarr[5][1] = 20;
     $timarr[6][0] = 14;
     $timarr[6][1] = 5;
     $timarr[7][0] = 14;
Ejemplo n.º 2
0
 function bdiv($x, $y)
 {
     global $bs;
     global $bx2;
     global $bm;
     global $bx;
     global $bd;
     global $bdm;
     $n = count($x) - 1;
     $t = count($y) - 1;
     $nmt = $n - $t;
     if ($n < $t || $n == $t && ($x[$n] < $y[$n] || $n > 0 && $x[$n] == $y[$n] && $x[$n - 1] < $y[$n - 1])) {
         $this->q = array(0);
         $this->mod = array($x);
         return;
     }
     if ($n == $t && toppart($x, $t, 2) / toppart($y, $t, 2) < 4) {
         $qq = 0;
         $xx = 0;
         for (;;) {
             $xx = bsub($x, $y);
             if (count($xx) == 0) {
                 break;
             }
             $x = $xx;
             $qq++;
         }
         $this->q = array($qq);
         $this->mod = $x;
         return;
     }
     $shift2 = floor(log($y[$t]) / M_LN2) + 1;
     $shift = $bs - $shift2;
     if ($shift) {
         $x = array_merge((array) $x);
         $y = array_merge((array) $y);
         for ($i = $t; $i > 0; $i--) {
             $y[$i] = $y[$i] << $shift & $bm | $y[$i - 1] >> $shift2;
         }
         $y[0] = $y[0] << $shift & $bm;
         if ($x[$n] & ($bm << $shift2 & $bm)) {
             $x[++$n] = 0;
             $nmt++;
         }
         for ($i = $n; $i > 0; $i--) {
             $x[$i] = $x[$i] << $shift & $bm | $x[$i - 1] >> $shift2;
         }
         $x[0] = $x[0] << $shift & $bm;
     }
     $i = 0;
     $j = 0;
     $x2 = 0;
     $q = zeros($nmt + 1);
     $y2 = array_merge(zeros($nmt), (array) $y);
     for (;;) {
         $x2 = bsub($x, $y2);
         if (count($x2) == 0) {
             break;
         }
         $q[$nmt]++;
         $x = $x2;
     }
     $yt = $y[$t];
     $top = toppart($y, $t, 2);
     for ($i = $n; $i > $t; $i--) {
         $m = $i - $t - 1;
         if ($i >= count($x)) {
             $q[$m] = 1;
         } else {
             if ($x[$i] == $yt) {
                 $q[$m] = $bm;
             } else {
                 $q[$m] = floor(toppart($x, $i, 2) / $yt);
             }
         }
         $topx = toppart($x, $i, 3);
         while ($q[$m] * $top > $topx) {
             $q[$m]--;
         }
         $y2 = array_slice($y2, 1);
         $x2 = bsub($x, bmul(array($q[$m]), $y2));
         if (count($x2) == 0) {
             $q[$m]--;
             $x2 = bsub($x, bmul(array($q[m]), $y2));
         }
         $x = $x2;
     }
     if ($shift) {
         for ($i = 0; $i < count($x) - 1; $i++) {
             $x[$i] = $x[$i] >> $shift | $x[$i + 1] << $shift2 & $bm;
         }
         $x[count($x) - 1] >>= $shift;
     }
     $n = count($q);
     while ($n > 1 && $q[$n - 1] == 0) {
         $n--;
     }
     $this->q = array_slice($q, 0, $n);
     $n = count($x);
     while ($n > 1 && $x[$n - 1] == 0) {
         $n--;
     }
     $this->mod = array_slice($x, 0, $n);
 }
Ejemplo n.º 3
0
/**
 * @param $a
 * @param $b
 * @return array
 */
function bmul($a, $b)
{
    global $bs;
    global $bm;
    global $bd;
    global $bdm;
    $b = array_merge((array) $b, [0]);
    $al = count($a);
    $bl = count($b);
    $r = zeros($al + $bl + 1);
    for ($n = 0; $n < $al; $n++) {
        $aa = $a[$n];
        if ($aa) {
            $c = 0;
            $hh = $aa >> $bd;
            $h = $aa & $bdm;
            $m = $n;
            for ($nn = 0; $nn < $bl; $nn++, $m++) {
                $g = $b[$nn];
                $gg = $g >> $bd;
                $g = $g & $bdm;
                $ghh = $g * $hh + $h * $gg;
                $ghhb = $ghh >> $bd;
                $ghh &= $bdm;
                $c += $r[$m] + $h * $g + ($ghh << $bd);
                $r[$m] = $c & $bm;
                $c = ($c >> $bs) + $gg * $hh + $ghhb;
            }
        }
    }
    $n = count($r);
    if ($r[$n - 1]) {
        return $r;
    }
    while ($n > 1 && $r[$n - 1] == 0) {
        $n--;
    }
    return array_slice($r, 0, $n);
}
Ejemplo n.º 4
0
require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
confirm_admin_logged_in();
$teacher_set = find_all_teachers();
$teacher = find_teacher_by_id($_GET["id"]);
if (!$teacher) {
    redirect_to("teacher_list.php");
}
$id = $teacher["id"];
$query = "SELECT * FROM teacher WHERE id = {$id} LIMIT 1";
$result = mysqli_query($conn, $query);
$table = mysqli_fetch_assoc($result);
$outarr = $table['period'];
$out = explode(" ", $outarr);
$matrix = zeros(5, 13);
$c = 0;
$c1 = 0;
$c2 = 0;
include "../includes/layouts/header.php";
?>
<div id="main">
<div id="navigation">
	<br/><br/><ul>
		<li><a href="logout_admin.php">Logout</a></li>
	</ul>
</div>
<div id="page">
<?php 
echo message();
?>
Ejemplo n.º 5
0
function count_autofilename($dir, $name, $footer, $zeros = 4, $startfrom = 1)
{
    clearstatcache();
    // must do it so the info would be current and not cached
    $i = $startfrom;
    while (file_exists($dir . $name . zeros($i, $zeros) . $footer)) {
        $i++;
    }
    return $i - $startfrom;
}