forked from MariaNattestad/SplitThreader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput_validation.php
More file actions
executable file
·96 lines (75 loc) · 3.8 KB
/
Copy pathinput_validation.php
File metadata and controls
executable file
·96 lines (75 loc) · 3.8 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<!-- NAVIGATION BAR-->
<?php include "header.html";?>
<?php include "title.html";?>
<div class="panel">
<?php
$aResult = array();
if( !isset($_POST['code']) ) { $aResult['error'] = 'ERROR: No code passed to input_validation.php';}
$code=$_POST["code"];
// if( !isset($_POST['annotation']) ) { $aResult['error'] = 'ERROR: No annotation passed to input_validation.php';}
// $annotation=$_POST["annotation"];
$nickname = "my_sample";
if( isset($_POST['nickname']) ) {
$nickname = $_POST['nickname'];
// Replace all non-alphanumeric characters with underscores
$nickname = preg_replace('/[^a-zA-Z0-9]/', '_', $nickname);
$_POST['nickname'] = $nickname;
}
$url="analysis.php?code=$code";
$run_url="run_algorithm.php";
$filename_variants="user_uploads/$code.variants";
$filename_copynumber="user_uploads/$code.copynumber";
$back_button= "<form action=\"./\" method=GET><button type=\"submit\" class=\"center btn btn-danger\">Back</button></form>";
//$continue_button= "<form action=\"$url\"><input type=\"hidden\" name = \"code\" value=\"$code\"><button type=\"submit\" class=\"center btn btn-success\">Continue</button></form>";
$continue_button= "<form
action=\"$run_url\"
method=\"post\"><input type=\"hidden\" name = \"code\" value=\"$code\"><input type=\"hidden\" name=\"nickname\" value=\"$nickname\">";
// <input type=\"hidden\" name=\"annotation\" value=\"$annotation\">
// <input type=\"hidden\" name=\"email\" value=\"$_POST\[\"email\"\]\">
// <button type=\"submit\" class=\"center btn btn-success\">Continue</button>
// </form>";
// <input type=\"hidden\" name=\"read_length\" value=\"$read_length\">
if (!file_exists ($filename_variants) and !file_exists ($filename_copynumber)) {
echo "<div class=\"alert center alert-danger\" role=\"alert\">No files uploaded</div>";
echo "$back_button";
exit;
}
else if (!file_exists ($filename_variants)) {
echo "<div class=\"alert center alert-danger\" role=\"alert\">No file uploaded for variants</div>";
echo "$back_button";
exit;
}
else if (!file_exists ($filename_copynumber)) {
echo "<div class=\"alert center alert-danger\" role=\"alert\">No file uploaded for copy number</div>";
echo "$back_button";
exit;
} else {
echo "<div class=\"alert center alert-success\" role=\"alert\">Great! Both files were uploaded</div>";
// if( isset($_POST['min_variant_size']) && isset($_POST['min_split_reads']) && isset($_POST['annotation']) ) {
// $expected_from_POST= array("min_variant_size","min_split_reads","annotation");
// echo $_POST;
// foreach ($_POST as $item) {
// echo $item;
// echo $_POST[$item];
// }
// $data = "parameter,val\nmin_variant_size,";
// foreach ($_POST as $key => $value) {
// $data = $data . $key . "," . $value . "\n";
// $continue_button = $continue_button . "<input type=\"hidden\" name = \"" . $key . "\" value=\"" . $value . "\">";
// }
$continue_button = $continue_button . "<button type=\"submit\" class=\"center btn btn-success\">Continue</button>
</form>";
// $data = "parameter,val\nmin_variant_size," . $_POST['min_variant_size'] . "\n" . "min_split_reads," . $_POST['min_split_reads'] . "\n" . "annotation," . $_POST['annotation'] . "\n";
// $ret = file_put_contents('user_uploads/' . $code . '.config', $data, FILE_APPEND | LOCK_EX);
// if($ret === false) {
// die('There was an error writing this file');
// }
// }
echo "$continue_button";
}
?>
</div>
</body>
</html>