forked from OvidiuRusu/TW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadprofassign.php
28 lines (26 loc) · 1.1 KB
/
uploadprofassign.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
if(isset($_POST['submit'])){
move_uploaded_file ($_FILES['uploadFile']['tmp_name'], "res/".$_SESSION['numemat']."/Assignments/{$_FILES['uploadFile']['name']}");
include('connection.php');
$result = mysql_query("select max(idassignment) as id from assignment;");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
$idassign=$line["id"]+1;
$numemat=$_SESSION['numemat'];
$result = mysql_query("select idmaterie as id from materie where nume='$numemat';");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
$idmat=$line["id"];
$titlu=$_POST['titlu'];
$descriere=$_POST['descriere'];
$data=date("Y-m-d");
$tip=$_POST['tip'];
$duedate=$_POST['duedate'];
$punctaj=(float)$_POST['punctaj'];
$path="res/".$_SESSION['numemat']."/Assignments/{$_FILES['uploadFile']['name']}";
mysql_query("INSERT INTO assignment VALUES ('$idassign','$idmat','$titlu','$descriere','$data','$duedate','$punctaj','$tip','$path')");
print "Upload reusit.";
$mat = $_SESSION['numemat'];
$mat = str_replace(" ","%20",$mat);
echo '<meta http-equiv=REFRESH CONTENT=3;url="profesorcourse.php?name=',$mat,'">';
}
?>