PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/da_catalog_inputWebLink.php

https://github.com/jmjamison/da_catalog_maintenance
PHP | 135 lines | 84 code | 43 blank | 8 comment | 9 complexity | 2e40f375f13aea28ff36dbfc51a26b10 MD5 | raw file
  1. <html>
  2. <head><title>Data Archive Catalog: Input Dataset Record</title>
  3. <link rel="stylesheet" href="2col_leftNav.css" type="text/css">
  4. </head>
  5. <body>
  6. <?php
  7. $sscnetHTTP = "http://www.sscnet.ucla.edu/issr/da/da_catalog/";
  8. $sscnetHTTP_maintenance_test = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance_test/";
  9. $sscnetHTTP_maintenance_live = "http://www.sscnet.ucla.edu/issr/da/da_catalog_maintenance/";
  10. $mydestopHTTP = "http://localhost/da_catalog/";
  11. $currentHTTP = $sscnetHTTP_maintenance_live;
  12. if (isset($_SESSION['studynumber']))
  13. $studynumber = $_SESSION['studynumber'];
  14. else
  15. $studynumber = "";
  16. echo "studynumber: " . $studynumber . "<br>";
  17. if (isset($_SESSION['wwwtext']))
  18. $wwwtest = $_SESSION['wwwtext'];
  19. else
  20. $wwwtext = "";
  21. if (isset($_SESSION['wwwlink']))
  22. $wwwlink = $_SESSION['wwwlink'];
  23. else
  24. $wwwlink = "";
  25. $sscnetInclude = "ISSRDA_login.php";
  26. $currentInclude = $sscnetInclude;
  27. include($currentInclude);
  28. // for desktop test system
  29. //$db_name = "da_catalog";
  30. $queryTitleStudyNumFileType = "SELECT title.StudyNum FROM title ORDER BY title.StudyNum";
  31. // PDO connect
  32. $PDO_string = "mysql:host=" . $db_host . ";port=" . $db_port . ";dbname=" . $db_name ;
  33. try {
  34. $PDO_connection = new PDO($PDO_string, $db_username, $db_password);
  35. } catch(PDOException $e) {
  36. echo "Could not connect to the database because: ". $e->getMessage()."<br>";
  37. die();
  38. }
  39. // PDO - create prepared statement: get the table.pifull
  40. // --------------------------------------------------------
  41. $PDO_query = $PDO_connection->prepare($queryTitleStudyNumFileType);
  42. // PDO - execute the query
  43. $result = $PDO_query->execute();
  44. if (!$result) {
  45. die ("Could not query the database: <br />". mysql_error());
  46. }
  47. $studynumberList = array();
  48. $result = $PDO_query->fetch(PDO::FETCH_ASSOC);
  49. $row_index = 0;
  50. while ($row = $PDO_query->fetch(PDO::FETCH_ASSOC)) {
  51. $studynumberList[$row_index] = $row["StudyNum"];
  52. $row_index++;
  53. }
  54. $studynumberList = array_unique($studynumberList);
  55. sort($studynumberList);
  56. $studynumberListTotal = count($studynumberList);
  57. ?>
  58. <div id="masthead">
  59. <h1 id="siteName">UCLA Institute for Social Research Data Archives</h1>
  60. <h2 id="siteName"><a href="index.php" target="_self">Maintenance Menu</a>&nbsp;/&nbsp;Input Web Link (&quot;Useful Link&quot;)</h2>
  61. </div> <!--end masthead--><!--end masthead-->
  62. <div style="margin: 1% 5% 2% 2%;line-height: 1.5; ">
  63. <form method="post" name="addRecord" action="da_catalog_insertWebLinkCheck.php">
  64. <label>
  65. <input type="submit" name="searchStudynumber" id="searchStudynumber" value="Add Web Link (&quot;Useful Link&quot;) to this Studynumber"></label>
  66. Studynumber:
  67. <?php
  68. echo '<select name="studynumber" id="studynumber"';
  69. echo '<option value="">choose studynumber</option>';
  70. foreach ($studynumberList as $key => $value) {
  71. echo '<option value="' . $value . '">' . $value;
  72. }
  73. echo '</select>';
  74. ?>
  75. <hr align="center" width="100%" size="1">
  76. <div id="dynamicInput">
  77. <p>
  78. wwwlink name:
  79. <input name="wwwtext" type="text" size="50" maxlength="255">
  80. wwwlink: http://<input name="wwwlink" type="text" size="50" maxlength="255"> <br><br><input name="reset form" type="reset" value="reset">
  81. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  82. <input type="button" onClick="history.go(0)" value="Reload page">
  83. </p>
  84. </div>
  85. </form>
  86. <?php
  87. // close the connection
  88. // mysql_close($connection);
  89. $PDO_connection = null;
  90. ?>
  91. </div> <!-- end content-->
  92. </body></html>