Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     if($_SESSION["id"]=='adminSession'){}
  4.     else{
  5.         header('Location:http://localhost/George/index.html');
  6.         exit();
  7.     }
  8. $con = mysqli_connect('localhost','root');
  9.     if (!$con) { die('Could not connect ERROR: ' . mysqli_error()); }
  10.     mysqli_select_db($con,"education");
  11.     $days= implode(";", $_POST['days']);
  12.     $hours="";
  13.     if(isset($_POST['hoursMon'])){
  14.         $temph = implode(",",$_POST['hoursMon']);
  15.         $hours.= $temph.";";
  16.     }
  17.     if(isset($_POST['hoursTue'])){
  18.         $temph = implode(",",$_POST['hoursTue']);
  19.         $hours.= $temph.";";
  20.     }
  21.     if(isset($_POST['hoursWed'])){
  22.         $temph = implode(",",$_POST['hoursWed']);
  23.         $hours.= $temph.";";
  24.     }
  25.     if(isset($_POST['hoursThu'])){
  26.         $temph = implode(",",$_POST['hoursThu']);
  27.         $hours.= $temph.";";
  28.     }
  29.     if(isset($_POST['hoursFri'])){
  30.         $temph = implode(",",$_POST['hoursFri']);
  31.         $hours.= $temph.";";
  32.     }
  33.     $query = "INSERT INTO course(title,semester,professor_id,days,hours,class,type)
  34.     VALUES('".$_POST["title"]."','".$_POST["semester"]."','".$_POST["professorid"]."','".$days."','".$hours."','".$_POST["class"]."','".$_POST["type"]."')";
  35.     mysqli_query($con,$query);
  36.     echo "Registration successful redirecting in main dashboard";
  37.     echo "<script>
  38.        var timer = setTimeout(function() {
  39.            window.location='http://localhost/George/admin_main_dashboard.html'
  40.        }, 3000);
  41.    </script>";
  42.         exit();
  43.    
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement