H4T3D

upload_issue.php

Mar 3rd, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.65 KB | None | 0 0
  1. <?php include 'header.php';
  2. if (isset($_GET['jid']) && isset($_GET['vid'])) {
  3. $jid = $_GET['jid'];
  4. $vid = $_GET['vid'];
  5.  
  6. $sql_for_vloume = "SELECT DISTINCT vid, v_name,v_year FROM volume Where vid=".$vid;
  7. $sql_for_issues = "SELECT j_title,v_name,v_year,i_name,i_id
  8. FROM journal
  9. INNER JOIN volume
  10. ON volume.j_id=journal.jid
  11. INNER JOIN issue
  12. ON issue.v_id=volume.vid
  13. Where volume.j_id=".$jid;
  14. $disable=False;
  15. $readonly=True;
  16. $sql = "SELECT DISTINCT jid, j_title FROM journal Where jid=".$jid;
  17. }
  18. else if (isset($_GET['jid'])) {
  19. $jid = $_GET['jid'];
  20.  
  21. $sql_for_vloume = "SELECT DISTINCT vid, v_name,v_year FROM volume Where j_id=".$jid;
  22. $sql_for_issues = "SELECT j_title,v_name,v_year,i_name,i_id
  23. FROM journal
  24. INNER JOIN volume
  25. ON volume.j_id=journal.jid
  26. INNER JOIN issue
  27. ON issue.v_id=volume.vid
  28. Where volume.j_id=".$jid;
  29. $sql = "SELECT DISTINCT jid, j_title FROM journal Where jid=".$jid;
  30. $disable=False;
  31. $readonly=True;
  32.  
  33. }
  34. else{
  35. $sql = "SELECT DISTINCT jid, j_title FROM journal";
  36.  
  37. $sql_for_issues = "SELECT j_title,v_name,v_year,i_name,i_id
  38. FROM journal
  39. INNER JOIN volume
  40. ON volume.j_id=journal.jid
  41. INNER JOIN issue
  42. ON issue.v_id=volume.vid";
  43. $disable=True;
  44. }
  45.  
  46. ?>
  47. <div id="page-wrapper">
  48. <div class="row">
  49. <div class="col-lg-12">
  50. <h1 class="page-header">Add New Issue</h1>
  51. </div>
  52. <!-- /.col-lg-12 -->
  53. </div>
  54. <!-- /.row -->
  55. <div class="row">
  56. <div class="col-lg-12">
  57. <div class="panel panel-default">
  58. <div class="panel-heading">
  59. Add New Issue
  60. </div>
  61. <div class="panel-body">
  62. <div class="row">
  63. <div class="col-lg-12">
  64. <script>
  65. function myNewFunction(sel)
  66. {
  67. window.location.assign("?jid="+sel.value);
  68. // alert(sel.value);
  69. }
  70. </script>
  71.  
  72. <form role="form" action="" method="POST" enctype="multipart/form-data">
  73. <div class="form-group">
  74. <label>Select Journal</label>
  75. <select class="form-control" name="author" onChange="myNewFunction(this);" required="required"
  76. <?php
  77. if ($readonly) {
  78. echo 'readonly="readonly">';
  79. }
  80. ?>
  81. >
  82. <?php
  83. if (!(isset($_GET['jid']))) {
  84. echo "<option>Select Journal</option>";
  85. }
  86.  
  87. ?>
  88. <?php
  89.  
  90. $result = $conn->query($sql);
  91.  
  92. if ($result->num_rows > 0) {
  93. // output data of each row
  94. while($row = $result->fetch_assoc()) {
  95. ?>
  96. <option value="<?php echo $row["jid"];?>"><?php echo $row["j_title"];?></option>
  97. <?php
  98. }
  99. }
  100. ?>
  101. </select>
  102. </div>
  103. <div class="form-group">
  104. <label>Select Volume</label>
  105. <select class="form-control" required="required" name="voume_id" <?php
  106. if($disable){
  107. echo 'disabled="disabled">';
  108. echo "</select>";
  109. }
  110. else{
  111. ?>
  112. >
  113. <?php
  114. $result = $conn->query($sql_for_vloume);
  115.  
  116. if ($result->num_rows > 0) {
  117. // output data of each row
  118. while($row = $result->fetch_assoc()) {
  119. ?>
  120. <option value="<?php echo $row["vid"];?>"><?php echo $row["v_name"];?> - <?php echo $row["v_year"];?></option>
  121. <?php
  122. }
  123. }
  124. } // end of else disable
  125. ?>
  126. </select>
  127. </div>
  128. <div class="form-group">
  129. <label>Issue Title</label>
  130. <input type="text" name="issue_title" class="form-control">
  131. </div>
  132. <div class="form-group">
  133. <div class="col-lg-4">
  134. <label>Publish</label>
  135. <input type="text" name="publsih" class="form-control">
  136. </div>
  137. <div class="col-lg-4">
  138. <label>Abstract</label>
  139. <textarea class="form-control" rows="5" id="comment" name="abstract"></textarea>
  140. </div>
  141. <div class="col-lg-4">
  142. <label>Total Citation</label>
  143. <input type="text" name="citation" class="form-control">
  144. </div>
  145. </div>
  146. <div class="form-group">
  147. <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
  148. <script type="text/javascript">
  149. //<![CDATA[
  150. bkLib.onDomLoaded(function() {
  151. new nicEditor({fullPanel : true}).panelInstance('area');
  152. });
  153. //]]>
  154. </script>
  155. <label>Issue Details</label>
  156. <textarea class="form-control" name="detail" id="area" rows="13" cols="13"></textarea>
  157. </div>
  158.  
  159. <div class="form-group">
  160. <label>Meta Tags For Journal</label>
  161. <input type="text" name="metatags" class="form-control">
  162. </div>
  163.  
  164. <div class="form-group">
  165. <label>Meta Description For Journal</label>
  166. <textarea class="form-control" id="area" rows="5" cols="5" name="metadesc"></textarea>
  167. </div>
  168. <button type="submit" class="btn btn-default" name="uploades">Submit Button</button>
  169. <button type="reset" class="btn btn-default">Reset Button</button>
  170.  
  171. <?php
  172.  
  173. if (isset($_POST['uploades'])) {
  174. $issue_title = $_POST['issue_title'];
  175. $publsih =$_POST['publsih'];
  176. $abstract = $_POST['abstract'];
  177. $citation = $_POST['citation'];
  178. $detail = $_POST['detail'];
  179. $citation=$_POST['citation'];
  180. $metatags = $_POST['metatags'];
  181. $metadesc = $_POST['metadesc'];
  182. $voume_id=$_POST['voume_id'];
  183. $detail=str_replace("'","",$detail);
  184.  
  185. if($issue_title==""){
  186.  
  187. echo '<div class="form-group has-success"><div class="alert alert-danger alert-dismissable">
  188. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
  189. Thats Not Right Check Again ! <a href="#" class="alert-link">Alert Link</a>.
  190. </div></div>';
  191. }
  192.  
  193.  
  194. else{
  195.  
  196. $sql = "INSERT INTO issue (i_name, i_publish, i_abstract,i_cited,i_metatag,i_metadesc,v_id)
  197. VALUES ('$issue_title', '$publsih', '$abstract','$citation','$metatags','$metadesc','$voume_id')";
  198.  
  199.  
  200.  
  201. if ($conn->query($sql) === TRUE) {
  202.  
  203. $last_id = $conn->insert_id;
  204. echo '<div class="form-group has-success"><div class="alert alert-success alert-dismissable">
  205. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
  206. Issue Added Successfully.
  207. </div></div>';
  208. } else {
  209. echo "Error: " . $sql . "<br>" . $conn->error;
  210. }
  211.  
  212. // bakia kaam of upload
  213.  
  214.  
  215. }//bracket of file type jpg
  216.  
  217. }
  218.  
  219.  
  220. ?>
  221. </form>
  222.  
  223. </div>
  224. <!-- /.col-lg-6 (nested) -->
  225.  
  226. </div>
  227. <!-- /.row (nested) -->
  228. </div>
  229. <!-- /.panel-body -->
  230. </div>
  231. <!-- /.panel -->
  232. </div>
  233. <!-- /.col-lg-12 -->
  234. </div>
  235. <!-- /.row -->
  236.  
  237. <!-- /.row -->
  238. <div class="row">
  239. <div class="col-lg-12">
  240. <div class="panel panel-default">
  241. <div class="panel-heading">
  242. Issues Regaurding Volume
  243. </div>
  244. <!-- /.panel-heading -->
  245. <div class="panel-body">
  246. <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
  247. <thead>
  248. <tr>
  249. <th>Issue #</th>
  250. <th>Journal</th>
  251. <th>Volume</th>
  252. <th>Volume Year</th>
  253. <th>Issue Name</th>
  254. <th>Option</th>
  255. </tr>
  256. </thead>
  257. <tbody>
  258. <?php
  259. //j_title,v_name,v_year,i_name,i_id
  260. $result = $conn->query($sql_for_issues);
  261.  
  262. if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { ?>
  263.  
  264. <tr class="odd gradeX">
  265. <td><?php echo $row["i_id"];?></td>
  266. <td><?php echo $row["j_title"];?></td>
  267. <td><?php echo $row["v_name"];?></td>
  268. <td><?php echo $row["v_year"];?></td>
  269. <td><?php echo $row["i_name"];?></td>
  270. <td class="center">
  271. <a href="?delete=<?php echo $row["i_id"];?>" data-placement="top" data-toggle="tooltip" title="Delete"><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" title="Delete"><span class="fa fa-trash fa-2x"></span></button>
  272. </a>
  273. <a href="?iid=<?php echo $row["i_id"];?>" data-placement="top" data-toggle="tooltip" title="Delete"><button class="btn btn-info btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" title="Edit"><span class="fa fa-pencil fa-2x"></span></button>
  274. </a>
  275. </td>
  276. </tr>
  277.  
  278. <?php }}
  279. $conn->close();?>
  280. </tbody>
  281. </table>
  282. <!-- /.table-responsive -->
  283. </div>
  284. <!-- /.panel-body -->
  285. </div>
  286. <!-- /.panel -->
  287. </div>
  288. <!-- /.col-lg-12 -->
  289. </div>
  290. <!-- /.row -->
  291. </div>
  292. <!-- /#page-wrapper -->
  293.  
  294. </div>
  295. <!-- /#wrapper -->
  296.  
  297. <!-- jQuery -->
  298. <?php
  299. include "footer.php";
  300. ?>
  301.  
  302. </body>
  303.  
  304. </html>
Add Comment
Please, Sign In to add comment