| Server IP : 61.19.30.66 / Your IP : 216.73.216.59 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/gpa/upgrad/ |
Upload File : |
<?
require_once "../config/confiteacher.inc.php";
require_once "../config/connectdb.php";
require_once "head.php";
$ttt=$objResult["teachcode"];
$crsql="SELECT (years) FROM `config`" ;
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$years=$dcrd[0];
$crsql="SELECT (termx) FROM `config`" ;
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$termxs=$dcrd[0];
?>
<?php
//index.php
$connect = mysqli_connect("localhost", "root", "gpaklw+3322", "klw");
mysqli_query($connect, "SET NAMES UTF8");
$message = '';
if(isset($_POST["upload"]))
{
if($_FILES['product_file']['name'])
{
$filename = explode(".", $_FILES['product_file']['name']);
if(end($filename) == "csv")
{
$handle = fopen($_FILES['product_file']['tmp_name'], "r");
while($data = fgetcsv($handle))
{
$product_id = mysqli_real_escape_string($connect, $data[0]);
$ids = mysqli_real_escape_string($connect, $data[1]);
$product_category = mysqli_real_escape_string($connect, $data[7]);
$product_name = mysqli_real_escape_string($connect, $data[8]);
$product_price = mysqli_real_escape_string($connect, $data[9]);
$k2 = mysqli_real_escape_string($connect, $data[10]);
$p2 = mysqli_real_escape_string($connect, $data[11]);
$a2= mysqli_real_escape_string($connect, $data[12]);
$k3 = mysqli_real_escape_string($connect, $data[13]);
$p3 = mysqli_real_escape_string($connect, $data[14]);
$a3= mysqli_real_escape_string($connect, $data[15]);
$k4 = mysqli_real_escape_string($connect, $data[16]);
$p4 = mysqli_real_escape_string($connect, $data[17]);
$a4= mysqli_real_escape_string($connect, $data[18]);
$k5 = mysqli_real_escape_string($connect, $data[19]);
$p5 = mysqli_real_escape_string($connect, $data[20]);
$a5= mysqli_real_escape_string($connect, $data[21]);
$k6 = mysqli_real_escape_string($connect, $data[22]);
$p6 = mysqli_real_escape_string($connect, $data[23]);
$a6= mysqli_real_escape_string($connect, $data[24]);
$midterm1 = mysqli_real_escape_string($connect, $data[32]);
$final= mysqli_real_escape_string($connect, $data[34]);
$query = "
UPDATE transcriptintall SET
k11 = '$product_category',
P11 = '$product_name',
a11 = '$product_price',
k22 = '$k2',
P22 = '$p2',
a22 = '$a2',
k33 = '$k3',
P33 = '$p3',
a33 = '$a3',
k44 = '$k4',
P44 = '$p4',
a44 = '$a4',
k55 = '$k5',
P55 = '$p5',
a55 = '$a5',
k66 = '$k6',
P66 = '$p6',
a66 = '$a6',
midterm = '$midterm1',
final2 = '$final'
WHERE idin='$product_id' and idstin='$ids'
";
mysqli_query($connect, $query);
}
echo "OK";
echo "<script>window.alert(\"OK\");history.go (-1);</script>";
}
else
{
$message = '<label class="text-danger">Please Select CSV File only</label>';
}
}
else
{
$message = '<label class="text-danger">Please Select File</label>';
}
}
if(isset($_GET["updation"]))
{
$message = '<label class="text-success">Product Updation Done</label>';
}
$query = "SELECT * FROM transcriptintall join klw on klw.Username=transcriptintall.idstin where yearsx='$years' and teachin='$ttt' and codin LIKE '$_GET[id]' and idgrupin='$_GET[room]' order by room+1 asc,ordinal+1 asc";
$result = mysqli_query($connect, $query);
?>
<!DOCTYPE html>
<html>
<head>
<title>Update gpa</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta charset="utf8">
</head>
<body>
<br />
<div class="container">
<h2 align="center">Update GPA</a></h2>
<br />
<form method="post" enctype='multipart/form-data'>
<p><label>Please Select File (Only CSV Formate)</label>
<input type="file" name="product_file" /></p>
<br />
<input type="submit" name="upload" class="btn btn-info" value="Upload" />
</form>
<br />
<?php echo $message; ?>
>>>><a href="../data/sentgpa.php">back</a>
<br />
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tr>
<th>x</th>
<th>code</th>
<th>Name</th>
<th>1k</th>
<th>1p</th>
<th>1a</th>
<th>2k</th>
<th>2p</th>
<th>2a</th>
<th>3k</th>
<th>3p</th>
<th>3a</th>
<th>4k</th>
<th>4p</th>
<th>4a</th>
<th>5k</th>
<th>5p</th>
<th>5a</th>
<th>6k</th>
<th>6p</th>
<th>6a</th>
<th>mid</th>
<th>Fi</th>
<th>total</th>
</tr>
<?php
$i=1;
while($row = mysqli_fetch_array($result))
{
$product=$row["codin"];
$student=$row["idstin"];
$Name=$row["Name"];
$surname=$row["surname"];
$xLevel=$row["cllass"];
$room=$row["room"];
$k1=$row["k11"];
$p1=$row["p11"];
$a1=$row["a11"];
$k2=$row["k22"];
$p2=$row["p22"];
$a2=$row["a22"];
$k3=$row["k33"];
$p3=$row["p33"];
$a3=$row["a33"];
$k4=$row["k44"];
$p4=$row["p44"];
$a4=$row["a44"];
$k5=$row["k55"];
$p5=$row["p55"];
$a5=$row["a55"];
$k6=$row["k66"];
$p6=$row["p66"];
$a6=$row["a66"];
$mid=$row["midterm"];
$fi=$row["final2"];
$sumtotal=$k1+$p1+$a1+$k2+$p2+$a2+$k3+$p3+$a3+$k4+$p4+$a4+$k5+$p5+$a5+$k6+$p5+$a6+$mid+$fi;
echo '
<tr>
<td>'.$i.'</td>
<td><a href=uploadex.php?id='.$product.'&&room='.$room.'>'.$product.'</td>
<td width:200px>'.$student.' '.$Name.' '.$surname.' '.$xLevel.'/'.$room.'</td>
<td>'.$k1.'</td>
<td>'.$p1.'</td>
<td>'.$a1.'</td>
<td>'.$k2.'</td>
<td>'.$p2.'</td>
<td>'.$a2.'</td>
<td>'.$k3.'</td>
<td>'.$p3.'</td>
<td>'.$a3.'</td>
<td>'.$k4.'</td>
<td>'.$p4.'</td>
<td>'.$a4.'</td>
<td>'.$k5.'</td>
<td>'.$p5.'</td>
<td>'.$a5.'</td>
<td>'.$k6.'</td>
<td>'.$p6.'</td>
<td>'.$a6.'</td>
<td>'.$mid.'</td>
<td>'.$fi.'</td>
<td>'.$sumtotal.'</td>
</tr>
';
$i++;
}
?>
</table>
<? $i = $i+1;?>
</div>
</div>
</body>