H4T3D

Calculate GPA without F's

Aug 21st, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800' rel='stylesheet' type='text/css'>
  2. <link href='https://fonts.googleapis.com/css?family=Orbitron' rel='stylesheet' type='text/css'>
  3. <style type="text/css">
  4. html, body{
  5.        height: 100%;
  6.        text-decoration:  none;
  7.        font-family: 'Open Sans', sans-serif;
  8.        background-color: #000000;
  9. }
  10.  
  11.     textarea,h1{
  12.        resize:none;
  13.        color: #4099FF ;
  14.        border: 1px solid #3B5998;
  15.  
  16.      font-family: 'Orbitron', sans-serif;
  17. }
  18.  
  19. h3{
  20.   color: #33CCFF;
  21. }
  22. input {
  23.         color: ##33CCFF;
  24.         border:1px dotted #33CCFF;
  25.         width: 20%;
  26.         font-family: 'Orbitron'; color:red;
  27. }
  28.  
  29. h4{
  30. color:red;
  31. }
  32.  
  33. </style>
  34.  
  35.  
  36. <center>
  37. <h1> Calculate GPA without F's </h1>
  38. <form action="" method="POST">
  39.   </br>
  40.   <textarea name="wholecode" rows="26" cols="130" placeholder="Copy Source Code Of Your IULMS Transcript page : http://iulms.iunc.edu.pk/iulms/sic/iu_transcript.php Here ">
  41. </textarea>
  42. </br></br>
  43.   <input type="submit" name="GO">
  44. </form>
  45.  
  46. <?php
  47.  
  48. function getGPA($score_arr) {
  49.      $count = count($score_arr);
  50.      $sum = array_sum($score_arr);
  51.  
  52.      $gpa = $sum / $count;
  53.  
  54.      return $gpa;
  55.  
  56. }
  57.  
  58. if (isset($_POST['GO'])) {
  59.  
  60. $no = $_POST['wholecode'];
  61.  
  62.  
  63. // <td style="width: 70%;"></td>
  64.  //echo $no;
  65.  $a = array();
  66.  
  67. preg_match_all('/<td class=\'center\'>(.*?)<\/td>/s',$no,$matches);
  68.  
  69. for ($i=2; $i <count($matches[1]) ; $i+=3) {
  70.  
  71. if(!($matches[1][$i] == 0)){
  72.   array_push($a,$matches[1][$i]);
  73. }
  74.  
  75. }
  76.  
  77. echo "<h3> Your CGPA IS : ".getGPA($a)."</h3>";
  78.  
  79. }
  80.  
  81. ?>
  82.  
  83. <h4>Created By Mohammad.Ali.Mian https://www.facebook.com/ali.mian.969 </h4>
Add Comment
Please, Sign In to add comment