PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/student.php

https://bitbucket.org/krishna2793/aces
PHP | 166 lines | 124 code | 42 blank | 0 comment | 2 complexity | c403c45f83c9e63d0ce3de41212d6518 MD5 | raw file
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>ACES : HOME</title>
  5. <!-- Include the bootstrap stylesheets -->
  6. <link rel="stylesheet" href="bootstrapnew.css"/>
  7. </head>
  8. <body>
  9. <!-- Navbar
  10. ================================================== -->
  11. <div class="navbar navbar-fixed-top">
  12. <div class="navbar-inner">
  13. <div class="container">
  14. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  15. <span class="icon-bar"></span>
  16. <span class="icon-bar"></span>
  17. <span class="icon-bar"></span>
  18. </a>
  19. <a class="brand" href="http://www.amrita.edu/">AMRITA</a>
  20. <div class="nav-collapse" id="main-menu">
  21. <ul class="drop" id="main-menu-left">
  22. <li><a id="swatch-link" href="/staff_select_test.php" >Scores Mcq</a></li>
  23. <li class="dropdown" id="test-menu">
  24. <a class="dropdown-toggle" data-toggle="" href="#"> Add Question <b class="caret"></b></a>
  25. <ul id="take_test" class="dropdown-toggle" >
  26. <li><a href="/Code_Ques_set.php">Test Code</a></li>
  27. <li><a href="/enter_pool.php">MCQs</a></li>
  28. <li><a href="/Query_ques_set.php">Test Query</a></li>
  29. </ul>
  30. </li>
  31. <li class="dropdown" id="test-menu">
  32. <a class="dropdown-toggle" data-toggle="" href="#"> New Test <b class="caret"></b></a>
  33. <ul id="take_test" class="dropdown-toggle" >
  34. <li><a href="/make_test.php">Test Code</a></li>
  35. <li><a href="/test_maker.php">MCQs</a></li>
  36. <li><a href="/make_test_sql.php">Test Query</a></li>
  37. </ul>
  38. </li>
  39. </ul>
  40. <ul class="nav pull-right" id="main-menu-right">
  41. <li><a rel="tooltip" href="#"><?php echo date("d.m.Y") ;?> <i class="icon-share-alt"></i></a></li>
  42. <li><a rel="tooltip" href="#">Welcome <?php echo $_SESSION['name']; ?> <i class="icon-share-alt"></i></a></li>
  43. <li><a rel="tooltip" href="/logout_staff.php">Logout <i class="icon-share-alt"></i></a></li>
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="container">
  50. <div class="container">
  51. <p> </p>
  52. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  53. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  54. <h1 style="font-size:46px" align="center" >ACES</h1>
  55. <h4 align="center"> Automated Code Evaluation System</h4>
  56. <p></p>
  57. <h6 align="left">AMRITA SHOOL OF ENGINEERING</h6>
  58. <h6 align="left" >COIMBATORE <small></h6>
  59. <!-- Forms
  60. ================================================== -->
  61. <section id="forms">
  62. <div class="page-header">
  63. <h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tests Available</h1>
  64. </div>
  65. <div class="row">
  66. <div class="span10 offset1">
  67. <form class="form-horizontal well" action="Code_Ques_set.php" method="post" enctype="multipart/form-data">
  68. <?php
  69. if(isset($_POST['submit']))
  70. {
  71. $con = mysql_connect('localhost','root','mysql');
  72. if (!$con)
  73. {
  74. die('Could not connect: ' . mysql_error());
  75. }
  76. mysql_select_db("aces", $con) or die('db con faild');
  77. $target_path = "questionsetter/"; //folder named questionsetter must b there in d /var/www folder//
  78. $target_path = $target_path . basename( $_FILES['ip_file']['name']);
  79. chmod($_FILES["ip_file"]["tmp_name"],0777);
  80. move_uploaded_file($_FILES["ip_file"]["tmp_name"],$target_path);
  81. echo "Stored in: " . "questionsetter/" . $_FILES["ip_file"]["name"];
  82. $path ="questionsetter/" . $_FILES["ip_file"]["name"];
  83. $fil = $_FILES["ip_file"]["name"];
  84. echo '<br>';
  85. $target_path_2 = "questionsetter/";
  86. $target_path_2 = $target_path_2.basename( $_FILES['op_file']['name']);
  87. chmod($_FILES["op_file"]["tmp_name"],0777);
  88. move_uploaded_file($_FILES["op_file"]["tmp_name"],$target_path_2);
  89. echo "Stored in: "."questionsetter/".$_FILES["op_file"]["name"];
  90. $path_2="questionsetter/".$_FILES["op_file"]["name"];
  91. $fil_2= $_FILES["op_file"]["name"];
  92. $query = "insert into code_problem_pool (question,input_name,input_url,output_url,subject,num_of_lines_per_tc) values('$_POST[id]','$_POST[ip_name]','','','$_POST[subject]','$_POST[nol_tc]')";
  93. mysql_query($query)or die('Query failure!!!!'.mysql_error());
  94. }
  95. $temp_name=mysql_result(mysql_query("select max(prob_id) from code_problem_pool") ,0);
  96. $myFile = $temp_name.'ip.txt';
  97. $output = $temp_name.'op.txt';
  98. shell_exec("mv $path \"questionsetter/$myFile\"");
  99. shell_exec("mv $path_2 \"questionsetter/$output\"");
  100. mysql_query("update code_problem_pool set input_url='/var/www/questionsetter/$myFile' where prob_id='$temp_name'")or die("##########ip".mysql_error());
  101. mysql_query("update code_problem_pool set output_url='/var/www/questionsetter/$output' where prob_id='$temp_name'")or die("##########op".mysql_error());
  102. ?>
  103. </p>
  104. <input type="submit" name="submit" value="Add new question" />
  105. </p>
  106. </form>
  107. </form>
  108. <form action="staff_home.php">
  109. <input type="submit" name="exit" value="Exit" />
  110. </form>
  111. </div>
  112. </div>
  113. </section>
  114. <!-- Footer
  115. ================================================== -->
  116. <hr>
  117. <footer id="footer">
  118. <p class="pull-right"><a href="boot.html">Back to top</a></p>
  119. <div class="links"></div>
  120. Made by <a href="http://www.amrita.edu">Amrita</a>. Contact him <a href="mailto:amrita.edu">hello@admin_asec</a>.<br/>
  121. Based on <a target="_blank" href="http://twitter.github.com/bootstrap/">Bootstrap</a>. Icons from <a target="_blank" href="http://glyphicons.com/">Glyphicons</a>. Web fonts from <a target="_blank" href="http://www.google.com/webfonts">Google</a>.</p>
  122. </footer>
  123. </body>
  124. </html>