PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/take_test_code.php

https://bitbucket.org/krishna2793/aces
PHP | 165 lines | 138 code | 20 blank | 7 comment | 4 complexity | 47ade51299c6b721f343593a0e4ea439 MD5 | raw file
  1. <?php
  2. require_once ('Auth_stu.php');
  3. session_start();
  4. $auth = new Auth_stu();
  5. if (!isset($_SESSION['user_id']))
  6. {
  7. //Not logged in, send to login page.
  8. header( 'Location: login.php' );
  9. }
  10. else
  11. {
  12. //Check we have the right user
  13. $logged_in = $auth->checkSession();
  14. if(empty($logged_in)){
  15. //Bad session, ask to login
  16. $auth->logout();
  17. header( 'Location: login.php' );
  18. }
  19. else
  20. {
  21. //User is logged in, show the page
  22. ?><!DOCTYPE html>
  23. <html>
  24. <head>
  25. <title>ACES : HOME</title>
  26. <!-- Include the bootstrap stylesheets -->
  27. <link rel="stylesheet" href="bootstrapnew.css"
  28. </head>
  29. <body>
  30. <!-- Navbar
  31. ================================================== -->
  32. <div class="navbar navbar-fixed-top">
  33. <div class="navbar-inner">
  34. <div class="container">
  35. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  36. <span class="icon-bar"></span>
  37. <span class="icon-bar"></span>
  38. <span class="icon-bar"></span>
  39. </a>
  40. <a class="brand" href="http://www.amrita.edu/">AMRITA</a>
  41. <div class="nav-collapse" id="main-menu">
  42. <ul class="drop" id="main-menu-left">
  43. <li><a onclick="pageTracker._link(this.href); return false;" href="http://news.bootswatch.com">News</a></li>
  44. <li class="dropdown" id="score-menu">
  45. <a class="dropdown-toggle" data-toggle="" href="#">View Scores<b class="caret"></b></a>
  46. <ul id="take_test" class="dropdown-toggle" >
  47. <li><a href="/code_score.php">Code</a></li>
  48. <li><a href="/stu_score.php">MCQs</a></li>
  49. <li><a href="/query_score.php">Query</a></li>
  50. </ul>
  51. </li>
  52. <li class="dropdown" id="test-menu">
  53. <a class="dropdown-toggle" data-toggle="" href="#">Test Offered <b class="caret"></b></a>
  54. <ul id="take_test" class="dropdown-toggle" >
  55. <li><a href="/take_test_code.php">Test Code</a></li>
  56. <li><a href="/select_test.php">MCQs</a></li>
  57. <li><a href="/take_test_sql.php">Test Query</a></li>
  58. </ul>
  59. </li>
  60. </ul>
  61. </li>
  62. </ul>
  63. <ul class="nav pull-right" id="main-menu-right">
  64. <li><a rel="tooltip" href="#"><?php echo date("d.m.Y") ;?> <i class="icon-share-alt"></i></a></li>
  65. <li><a rel="tooltip" href="#">Welcome<?php echo $_SESSION['name'] ;?> <i class="icon-share-alt"></i></a></li>
  66. <li><a rel="tooltip" href="/logout_stu.php">Logout <i class="icon-share-alt"></i></a></li>
  67. </ul>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="container">
  73. <div class="container">
  74. <p> </p>
  75. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  76. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  77. <h1 style="font-size:46px" align="center" >ACES</h1>
  78. <h4 align="center"> Automated Code Evaluation System</h4>
  79. <p></p>
  80. <h6 align="left">AMRITA SCHOOL OF ENGINEERING</h6>
  81. <h6 align="left" >COIMBATORE <small></h6>
  82. <!-- Forms
  83. ================================================== -->
  84. <section id="forms">
  85. <div class="page-header">
  86. <h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Code Submission Response</h1>
  87. </div>
  88. <div class="row">
  89. <div class="span10 offset1">
  90. <form class="form-horizontal well" method="post" action="test_RULES.php">
  91. <fieldset>
  92. <div class="control-group">
  93. <label class="control-label" for="textarea">Available Tests</label>
  94. <div class="controls">
  95. <p>
  96. <?php session_start();
  97. $con = mysql_connect('localhost','root','mysql');
  98. if (!$con)
  99. {
  100. die('Could not connect: ' . mysql_error());
  101. }
  102. mysql_select_db("aces", $con) or die('db con faild');
  103. $_SESSION['i']=0;
  104. //the list that i print here must be convrted to check box or radio button or links
  105. $query = mysql_query("select * from test_pool where test_id not in (select test_id from user_gradebook_code where stu_id=$_SESSION[user_id])");
  106. //$j = 1;
  107. while($info = mysql_fetch_array($query))
  108. {
  109. echo '<br>'.'('.$info['test_id'].')'.$info['test_name'].'----'.$info['date_created'].'<br>';
  110. //$j++;
  111. }
  112. ?>
  113. </p>
  114. </div>
  115. </div>
  116. <div class="control-group">
  117. <label class="control-label" for="input01">Choose your test :</label>
  118. <div class="controls">
  119. <input type="text" class="input-xlarge" id="i01" name="test">
  120. </div>
  121. </div>
  122. <div class="form-actions">
  123. <button type="submit" class="btn btn-primary">Start test</button>
  124. <button type="reset" class="btn">Cancel</button>
  125. </div>
  126. </fieldset>
  127. </form>
  128. </div>
  129. </div>
  130. </section>
  131. <!-- Footer
  132. ================================================== -->
  133. <hr>
  134. <footer id="footer">
  135. <p class="pull-right"><a href="boot.html">Back to top</a></p>
  136. <div class="links"></div>
  137. Made by <a href="http://www.amrita.edu">Amrita</a>. Contact him <a href="mailto:amrita.edu">hello@admin_asec</a>.<br/>
  138. 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>
  139. </footer>
  140. </body>
  141. <?php
  142. }
  143. }
  144. ?>
  145. </html>