PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/snippets/ajax/get_snippet.php

https://bitbucket.org/websightdesigns/project-manager
PHP | 38 lines | 38 code | 0 blank | 0 comment | 5 complexity | 4d401e6e5437072e33a3fdb0e5227c88 MD5 | raw file
  1. <?php
  2. include('../../../config.php');
  3. include('../../../mysql.php');
  4. ?>
  5. <link rel="stylesheet" type="text/css" href="<?php echo $basehref; ?>modules/snippets/js/tagging.css" />
  6. <script type="text/javascript" src="<?php echo $basehref; ?>modules/snippets/js/tagging.js"></script>
  7. <?php
  8. $id = $_GET['id'];
  9. if(isset($link) && isset($id)) {
  10. if ($link && is_numeric($id)) {
  11. $sql = "SELECT snippets.`id` AS `id`,
  12. snippets.`snippet_name` AS snippet_name,
  13. snippets.`snippet_code` AS snippet_code,
  14. DATE_FORMAT(snippets.`created`, '%b %e %Y, %l:%i %p') AS fcreated,
  15. DATE_FORMAT(snippets.`modified`, '%b %e %Y, %l:%i %p') AS fmodified,
  16. snippets.`created` AS `created`,
  17. snippets.`modified` AS `modified`
  18. FROM snippets
  19. WHERE snippets.`id` = '" . $id . "'";
  20. }
  21. $fetch = mysql_query($sql);
  22. while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
  23. $id = $row['id'];
  24. $snippet_name = $row['snippet_name'];
  25. $snippet_code = $row['snippet_code'];
  26. $fcreated = $row['fcreated'];
  27. $fmodified = $row['fmodified'];
  28. $modified = $row['modified'];
  29. $created = $row['created'];
  30. ?>
  31. <p><strong><?php echo $snippet_name; ?></strong></p>
  32. <p><pre>
  33. <?php echo $snippet_code; ?>
  34. </pre></p>
  35. <?php
  36. }
  37. }
  38. ?>