PageRenderTime 58ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/da_catalog_inputCitation.php

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