root / docs / www / colonyscout / internal / assembly_edit_steps.php @ f59acf11
History | View | Annotate | Download (1.9 KB)
1 | f59acf11 | Dan Shope | <html>
|
---|---|---|---|
2 | <head>
|
||
3 | <link href="css/assembly.css" rel="stylesheet" type="text/css" media="screen"> |
||
4 | <style>
|
||
5 | input.text {font-size:16px;font-weight:bold;background-color:#ececec;border:none;}
|
||
6 | </style>
|
||
7 | </head>
|
||
8 | <?php
|
||
9 | include_once("do_login.php"); |
||
10 | doDB("colony_scout");
|
||
11 | |||
12 | if (!isset($_GET['save']) && !isset($_POST['stepNo'])) { |
||
13 | echo "No direct access!"; |
||
14 | exit;
|
||
15 | } elseif (isset($_GET['save']) && $_GET['save']=='true') { |
||
16 | //do save
|
||
17 | $verify_account_sql = "UPDATE assemblysteps SET StepTitle=\"".$_POST['stepTitle']."\", Content=\"".mysqli_escape_string($mysqli,$_POST["stepContent"])."\" WHERE ID=".$_POST['stepNo']; |
||
18 | $verify_account_res = mysqli_query($mysqli, $verify_account_sql) or die(mysqli_error($mysqli)); |
||
19 | |||
20 | //close connection to MySQL
|
||
21 | mysqli_close($mysqli);
|
||
22 | |||
23 | header("Location: ?save=success"); |
||
24 | exit();
|
||
25 | } elseif (isset($_GET['save']) && $_GET['save']=='success') { |
||
26 | echo "<h1>Saved!</h1>"; |
||
27 | } else {
|
||
28 | $get_assembly_sql = "SELECT * FROM assemblysteps WHERE ID=\"".$_POST['stepNo']."\" LIMIT 1"; |
||
29 | $get_assembly_res = mysqli_query($GLOBALS['mysqli'], $get_assembly_sql) or die(mysqli_error($GLOBALS['mysqli'])); |
||
30 | |||
31 | if (mysqli_num_rows($get_assembly_res)>0) { |
||
32 | while ($r = mysqli_fetch_array($get_assembly_res)) { |
||
33 | echo " |
||
34 | <form action=\"?save=true\" method=\"post\" class=\"editForm\">
|
||
35 | <dl>
|
||
36 | <dt><label for=\"title\">Title:</label></dt>
|
||
37 | <dd><input class=\"text\" type=\"text\" name=\"stepTitle\" value=\"".$r['StepTitle']."\" id=\"email\" size=\"50\" maxlength=\"128\" /></dd> |
||
38 | </dl>
|
||
39 | <dl>
|
||
40 | <dt><label for=\"comments\">Message:</label></dt>
|
||
41 | <dd><textarea name=\"stepContent\" id=\"comments\" rows=\"10\" cols=\"120\">".$r['Content']."</textarea></dd> |
||
42 | </dl>
|
||
43 | <dl>
|
||
44 | <dt></dt>
|
||
45 | <dd><input type=\"submit\" name=\"save\" id=\"submit\" value=\"Save Changes\" style=\"font-size:20px;\"/></dd>
|
||
46 | <input type=\"hidden\" name=\"stepNo\" value=\"".$r['ID']."\"/> |
||
47 | </dl>
|
||
48 | </form>
|
||
49 | ";
|
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | ?>
|
||
54 | |||
55 | </html> |