Guest User

Untitled

a guest
Jun 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <?
  2. // modify_news.php
  3. // Make sure that the user has authenticated
  4. include("connect.php");
  5. include("check_auth.php");
  6. ?>
  7. <html>
  8. <link href="style.css" rel="stylesheet" type="text/css">
  9. <title>Modify News</title>
  10. <head>
  11. <script type="text/javascript">
  12. <!--
  13. function checkApply(sel,rid) {
  14. if (sel.options[sel.selectedIndex].value) {
  15. // alert(rid);
  16. document.status_form["change_list["+rid+"]"].checked = true;
  17. }
  18. }
  19. -->
  20. </script>
  21. </head>
  22. <body>
  23. <div id="wrapper">
  24. <font color="red"><? echo $_GET[message] ?></font>
  25. <table>
  26. <tr>
  27. <th>Headline</th><th>Author</th><th>Create Date</th><th>Status</th><th>Apply</th>
  28. </tr>
  29. <?
  30. $query = "SELECT * FROM news_articles ";
  31. $query .= "ORDER BY create_date DESC";
  32.  
  33. $results = mysql_query($query);
  34. echo ( "<form method=\"post\" action=\"process_news.php\" name=\"status_form\">\n" );
  35. echo ( "<input type=\"hidden\" name=\"task\" value=\"cs_delete\" />\n" );
  36. while( $row = mysql_fetch_array($results) ) {
  37. echo ( "<tr><td><a href=\"news_form.php?id=$row[id]\" title=\"Last modified $row[modify_date]\">" .
  38. "$row[headline]</a></td>" .
  39. "<td>$row[author]</td><td>$row[create_date]</td>\n" );
  40.  
  41. $selected[$row[status]] = ' selected="selected"';
  42. echo ( "<td class=\"thethe\"><select name=\"status[$row[id]]\" onchange=\"checkApply(this,$row[id])\">" );
  43. echo ( "<option value=\"enabled\"$selected[enabled]>Enabled</option>\n" );
  44. echo ( "<option value=\"disabled\"$selected[disabled]>Disabled</option>\n" );
  45. echo ( "<option value=\"archived\"$selected[archived]>Archived</option>\n" );
  46. echo ( "<option value=\"delete\">Delete</option>\n" );
  47. echo ( "</select></td>\n" );
  48. echo ( "<td><input type=\"checkbox\" name=\"change_list[$row[id]]\" value=\"$row[id]\" /></td></tr>\n" );
  49. // clear the $selected hash
  50. unset( $selected );
  51. }
  52. ?>
  53. <tr><td colspan="5">
  54. <input type="submit" value="Process Articles"></td></tr>
  55. </form>
  56. </table>
  57. </div>
  58. </body>
  59. </html>
Add Comment
Please, Sign In to add comment