PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/query_score.php

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