-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
42 lines (35 loc) · 1.04 KB
/
Copy pathsubmit.php
File metadata and controls
42 lines (35 loc) · 1.04 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
<?php
$coursecount = 8;
$courses = array();
$fname = $_POST["firstname"];
$lname = $_POST["lastname"];
$title = "NULL";
$webmail = $_POST["webmail"];
$url = $_POST["url"];
$image = $_POST["image"];
if($image == NULL)
{
$image = "NULL";
}
$theme = $_POST["theme"];
for($i = 1; $i <= $coursecount; $i++)
{
$courses[$i] = $_POST["course" . (string)$i];
if($courses[$i] == NULL)
{
$courses[$i] = "off";
}
}
$file = fopen('./data/formdata.txt', 'w+'); // open txt file
ftruncate($file, 0); // clear file
$content = $fname . PHP_EOL . $lname . PHP_EOL . $title . PHP_EOL . $webmail . PHP_EOL. $image. PHP_EOL;
for($i = 1; $i <= $coursecount; $i++)
{
$content .= $courses[$i] . PHP_EOL;
}
$content .= $theme . PHP_EOL;
fwrite($file , $content); // write to file
fclose($file ); // close file
header("Location: main.html"); /* Redirect browser */
exit();
?>