-
Notifications
You must be signed in to change notification settings - Fork 0
/
prob_preview.php
47 lines (36 loc) · 1.06 KB
/
prob_preview.php
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
<?
// currently used as the preview update process for add_prob_form.php
include("connect.php");
include("functions.php");
// if a UID is posted, render that problem
// otherwise, render the "temporary problem" with the given attributes
if (isset($_POST['uid']))
{
$uid = $_POST['uid']; // get the problem info
$problem = mysql_fetch_array(mysql_query("SELECT prob,answer FROM problems WHERE uid=$uid"));
$prob_text = $problem['prob'];
$sol_text = $problem['answer'];
} else {
$uid=rawurldecode($_POST['baseuid']);
$prob_text = rawurldecode($_POST['prob']);
$sol_text = rawurldecode($_POST['sol']);
}
// begin the table
echo "<table width=100%>";
// start the row
echo "<tr>";
// print the problem
echo "<td width=50%>";
echo build_prob($uid,$prob_text,2);
echo "</td>";
// print the solution
echo "<td width=50%>";
echo "<span style=\"font-size:x-small;\">Answer</span>";
echo "<p style=\"border: solid lightgray 1pt; padding:5px;\">";
echo build_prob($uid,$sol_text,2,"","a");
echo "</td>";
// finish the row
echo "</tr>";
// finish the table
echo "</table>";
?>