<?php

$auth = 0;
$user = NULL;
$by = 1;
$data = NULL;
if (Auth::check()) {
    $user = Auth::User()->id;
} else {
    $user = "******";
}
if (isset($_GET['id'])) {
    $data = ITSP::find($_GET['id']);
    if ($data == NULL) {
        echo "No team found";
        return;
    }
    $data = $data->toArray();
    $by = $data['user_id'];
    $by2 = $data['user_id2'];
    $by3 = $data['user_id3'];
    $by4 = $data['user_id4'];
    $by5 = $data['user_id5'];
    if ($by == $user || $by2 == $user || $by3 == $user || $by4 == $user || $by5 == $user) {
        $auth = 1;
    } else {
        $auth = 0;
    }
    //	echo $auth." ".$by." ".$user;
} else {
    echo "invalid url. Try www.stab-iitb.org/itsp/documentation?id={your itsp id}";
 public function update_names()
 {
     $file = fopen(public_path() . "/media/ITSP2015/final_team_details.csv", "r");
     while (!feof($file)) {
         $csv = fgetcsv($file);
         $team = ITSP::find($csv[1]);
         try {
             $team->team_name = $csv[2];
             $team->project_name = $csv[3];
             $team->save();
         } catch (Exception $e) {
             print $csv[1] . " " . $csv[2] . " " . $csv[3] . "<br>";
         }
     }
     fclose($file);
 }