forked from OvidiuRusu/TW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadprofcurs.php
23 lines (21 loc) · 920 Bytes
/
uploadprofcurs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
session_start();
if(isset($_POST['submit'])){
move_uploaded_file ($_FILES['uploadFile']['tmp_name'], "res/".$_SESSION['numemat']."/Resources/{$_FILES['uploadFile']['name']}");
include('connection.php');
$result = mysql_query("select max(idresursa) as id from resource;");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
$idres=$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"];
$nume=$_POST['nume'];
$path="res/".$_SESSION['numemat']."/Resources/{$_FILES['uploadFile']['name']}";
mysql_query("INSERT INTO resource VALUES ('$idres','$nume','$idmat','$path')");
print "Upload reusit.";
$mat = $_SESSION['numemat'];
$mat = str_replace(" ","%20",$mat);
echo '<meta http-equiv=REFRESH CONTENT=3;url="profesorcourse.php?name=',$mat,'">';
}
?>