PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/test_RULES_SQL.php

https://bitbucket.org/krishna2793/aces
PHP | 183 lines | 144 code | 35 blank | 4 comment | 5 complexity | 92fd8d6432e5c263b7329e45374768c4 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. ?>
  23. <!DOCTYPE html>
  24. <html>
  25. <head>
  26. <title>ACES : HOME</title>
  27. <!-- Include the bootstrap stylesheets -->
  28. <link rel="stylesheet" href="bootstrapnew.css"
  29. </head>
  30. <body>
  31. <!-- Navbar
  32. ================================================== -->
  33. <div class="navbar navbar-fixed-top">
  34. <div class="navbar-inner">
  35. <div class="container">
  36. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  37. <span class="icon-bar"></span>
  38. <span class="icon-bar"></span>
  39. <span class="icon-bar"></span>
  40. </a>
  41. <a class="brand" href="http://www.amrita.edu/">AMRITA</a>
  42. <div class="nav-collapse" id="main-menu">
  43. <ul class="drop" id="main-menu-left">
  44. <li><a id="swatch-link" href="/staff_select_test.php" >Scores Mcq</a></li>
  45. <li class="dropdown" id="test-menu">
  46. <a class="dropdown-toggle" data-toggle="" href="#"> Add Question <b class="caret"></b></a>
  47. <ul id="take_test" class="dropdown-toggle" >
  48. <li><a href="/Code_Ques_set.php">Test Code</a></li>
  49. <li><a href="/enter_pool.php">MCQs</a></li>
  50. <li><a href="/Query_ques_set.php">Test Query</a></li>
  51. </ul>
  52. </li>
  53. <li class="dropdown" id="test-menu">
  54. <a class="dropdown-toggle" data-toggle="" href="#"> New Test <b class="caret"></b></a>
  55. <ul id="take_test" class="dropdown-toggle" >
  56. <li><a href="/make_test.php">Test Code</a></li>
  57. <li><a href="/test_maker.php">MCQs</a></li>
  58. <li><a href="/make_test_sql.php">Test Query</a></li>
  59. </ul>
  60. </li>
  61. </ul>
  62. <ul class="nav pull-right" id="main-menu-right">
  63. <li><a rel="tooltip" href="#"><?php echo date("d.m.Y") ;?> <i class="icon-share-alt"></i></a></li>
  64. <li><a rel="tooltip" href="#">Welcome <?php echo $_SESSION['name']; ?> <i class="icon-share-alt"></i></a></li>
  65. <li><a rel="tooltip" href="/logout_staff.php">Logout <i class="icon-share-alt"></i></a></li>
  66. </ul>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="container">
  72. <div class="container">
  73. <p> </p>
  74. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  75. <h1 style="font-size:46px" align="center" >&nbsp;</h1>
  76. <h1 style="font-size:46px" align="center" >ACES</h1>
  77. <h4 align="center"> Automated Code Evaluation System</h4>
  78. <p></p>
  79. <h6 align="left">AMRITA SHOOL OF ENGINEERING</h6>
  80. <h6 align="left" >COIMBATORE <small></h6>
  81. <!-- Forms
  82. ================================================== -->
  83. <section id="forms">
  84. <div class="page-header">
  85. <h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Code Submission Response</h1>
  86. </div>
  87. <div class="row">
  88. <div class="span10 offset1">
  89. <form class="form-horizontal well" action="ans_sql.php">
  90. <fieldset>
  91. <div class="control-group">
  92. <label class="control-label" for="textarea">Available Tests</label>
  93. <div class="controls">
  94. <p>
  95. <?php session_start();
  96. $con = mysql_connect('localhost','root','mysql');
  97. if (!$con)
  98. {
  99. die('Could not connect: ' . mysql_error());
  100. }
  101. mysql_select_db("aces", $con) or die('db con faild');
  102. mysql_query("insert into user_gradebook_Query (stu_id,test_id) values ( '$_SESSION[user_id]','$_POST[test_id]')") or die("sdadadsadadassdada*".mysql_error());
  103. $query = mysql_query("select prob_id from test_prob_sql where test_id=$_POST[test_id]") or die("test wrong $_POST[test_id]".mysql_error() );
  104. $j=0;
  105. $num = mysql_num_rows($query);
  106. echo $num;
  107. $_SESSION['test_id']=$_POST['test_id'];
  108. $_SESSION['no_of_ques']=$num;
  109. $_SESSION['iter']=0;
  110. echo 'Rules go here...!';
  111. while($info = mysql_fetch_array($query))
  112. {
  113. $_SESSION['ARR'][$j] = $info['prob_id'];
  114. echo $_SESSION['ARR'][$j];
  115. $j++;
  116. }
  117. for($i=0;$i<$num;$i++)
  118. {
  119. echo $_SESSION['ARR'][$i];
  120. }
  121. ?>
  122. </p>
  123. </div>
  124. </div>
  125. <div class="form-actions">
  126. <button type="submit" class="btn btn-primary">Start test</button>
  127. <button type="reset" class="btn">Cancel</button>
  128. </div>
  129. </fieldset>
  130. </form>
  131. </div>
  132. </div>
  133. </section>
  134. <!-- Footer
  135. ================================================== -->
  136. <hr>
  137. <footer id="footer">
  138. <p class="pull-right"><a href="boot.html">Back to top</a></p>
  139. <div class="links"></div>
  140. Made by <a href="http://www.amrita.edu">Amrita</a>. Contact him <a href="mailto:amrita.edu">hello@admin_asec</a>.<br/>
  141. 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>
  142. </footer>
  143. </body>
  144. </html>
  145. <?php
  146. }
  147. }
  148. ?>