-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathproject.php
More file actions
79 lines (75 loc) · 2.65 KB
/
project.php
File metadata and controls
79 lines (75 loc) · 2.65 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
session_start() ;
$db_host = 'localhost' ;
$db_database = 'pd course' ;
$db_username = 'root' ;
$connection = mysql_connect($db_host, $db_username, 'pdogsserver');
if (!$connection)
die ("connection failed".mysql_error()) ;
mysql_query("SET NAMES 'utf8'");
$selection = mysql_select_db($db_database) ;
if (!$selection)
die ("selection failed".mysql_error()) ;
$acc = mysql_real_escape_string($_SESSION['account']);
//$problem_dir = '.\\student\\'.$acc.'\\'.$_POST['hwID'];
//$upfile = $problem_dir.'\\'.$acc.'-'.$_POST['hwID'].'.cpp';
//$pdffile = $problem_dir.'\\'.$acc.'-'.$_POST['hwID'].'.pdf';
if (!isset($_SESSION['account'])){
header ("Location:index.php") ;
} else {
?>
<form method="POST" action="project_result.php" id="fileUploadForm" enctype="multipart/form-data">
<div class="hero-unit upload_section">
<p class="hw-id">Project</p>
<p class="hw"> File format: .c or .cpp </p>
<p class="hw"> File size: max 3MBs</p>
<div class="fileupload fileupload-new" data-provides="fileupload"> <?php
//if (file_exists($upfile)){ ?>
<!--
<div>
<a href="download_file.php?num=<?php //echo 'PJ001';?>&type=cpp" target="_blank">Submitted project</a><br>
</div>-->
<?php
//} ?>
<div class="input-append">
<div class="uneditable-input span3">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change File</span>
<input type="file" class="upload" name="upload"/>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
<a class="btn fileupload-exists upload-button" >Upload</a>
</div>
</div>
<p class="hw"> File format: .pdf </p>
<p class="hw"> File size: max 3MBs</p>
<div class="fileupload fileupload-new" data-provides="fileupload"> <?php
//if (file_exists($pdffile)){ ?>
<!--
<div>
<a href="download_file.php?num=<?php echo $_POST['hwID'];?>&type=pdf" target="_blank">Submitted pdf file</a>
</div> --><?php
//} ?>
<div class="input-append">
<div class="uneditable-input span3">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"></span>
</div>
<span class="btn btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change File</span>
<input type="file" class="pdfupload" name="pdfupload"/>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
<a class="btn fileupload-exists upload-button" >Upload</a>
</div>
</div>
</div>
</form>
<?php
}
?>