-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_assignment_save.php
More file actions
32 lines (31 loc) · 1.47 KB
/
add_assignment_save.php
File metadata and controls
32 lines (31 loc) · 1.47 KB
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
29
30
31
32
<?php
include('session.php');
require("opener_db.php");
$name=$_POST['name'];
$filedesc=$_POST['desc'];
$input_name = basename($_FILES['uploaded_file']['name']);
echo $input_name ;
if ($input_name == ""){
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO assignment (fdesc,fdatein,teacher_id,class_id) VALUES ('$filedesc',NOW(),'$session_id','$id[$i]')")or die(mysql_error());
mysql_query("insert into notification (teacher_class_id,date_of_notification,link) value('$id[$i]',NOW(),'assignment_student.php')")or die(mysql_error());
}
}else{
$rd2 = mt_rand(1000, 9999) . "_File";
$filename = basename($_FILES['uploaded_file']['name']);
$ext = substr($filename, strrpos($filename, '.') + 1);/
$newname = "admin/uploads/" . $rd2 . "_" . $filename;
$name_notification = 'Add Assignment file name'." ".'<b>'.$name.'</b>';
(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $newname));
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO assignment (fdesc,floc,fdatein,teacher_id,fname,class_id) VALUES ('$filedesc','$newname',NOW(),'$session_id','$name','$id[$i]')")or die(mysql_error());
mysql_query("insert into notification (teacher_class_id,notification,date_of_notification,link) value('$id[$i]','$name_notification',NOW(),'assignment_student.php')")or die(mysql_error());
}
}
?>