<!-- Header -->
<div id='header'>
  <div class='shell'>
    <!-- Logo + Top Nav -->
    <div id='top'>
      <h1><a href='http://effervescence.iiita.ac.in'>Effervescence MM'13</a></h1>
	   <?php 
if (isAdminLogin()) {
    echo "<div id='top-navigation'> \n\t\t\t\t<form id='logout' method='POST' action=''><div align='right'>Welcome<strong> " . $_SESSION['admin'] . " | <button class='md-close1' type='submit' name='logout'>LogOut</button></form></div>\n\t\t\t  </div>";
}
?>
	</div>
  </div>
</div>
<?php 
if (!isAdminLogin()) {
    echo "<div id='form_wrapper' class='form_wrapper' style='margin-left:35%; margin-top:5%;'>\n\t<form class = 'login active' id='login' action='' method='POST'>\n\t\t<div>\n\t\t<table>\n\t    <tr>\n\t\t\t<tr><td>Username:</td><td><input type='text' name='username' value=" . $uid . "></td></tr><tr><td>Password:</td><td><input type='password' name='password' value=''/></td></tr>\n\t\t\t<tr><td>&nbsp;</td><td><input type='submit' name='login' value='Login'/></td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t</form>";
    echo "<h4 style='margin-left:20px;margin-top:5px;\t padding:3px; color: rgb(216,71,71); line-height:20px;'>{$msg} </h4>";
    echo "<h4 style='margin-left:20px;margin-top:5px;\t padding:3px;color:#ffa800; line-height:20px;'>{$logout} </h4></div>";
} else {
    echo "\n\t\t<h4 style='margin-left:20px;margin-top:5px;'>{$addscs} </h4>\n\t\t<h4 style='margin-left:20px;margin-top:5px;'>{$editscs} </h4>\n\t\t<h4 style='margin-left:20px;margin-top:5px;'>{$dltdscs} </h4>\n\t\t<div class='box' style='width:780px; margin:20px auto;'>\n\t\t<div class='table'>\n\t\t<form role ='form' id='add_event' method='POST' action=''>\n\t\t\t<label>Event Name: </label><input type='text' name='eventname'/>\n\t\t\t<label>Event Category: </label>\n\t\t\t\t<select name='eventcat' >\n\t\t\t\t\t<option value='0'>Select event category: </option>";
    $events = getEventCategories();
    for ($i = 0; $i < count($events); $i++) {
        $evname = $events[$i]['name'];
        $id = $events[$i]['id'];
        echo "<option value='{$id}'>" . ucFirst($evname) . "</option>";
    }
    echo "\n\t\t\t\t</select>\n\t\t\t<input type='submit' name='addevent' value='Add Event'/><br>\n\t\t</form>\n\t\t</div>\n\t\t</div>\n\t\t\n\t\t<div class='box' style='width:780px; margin:20px auto;'>\n\t\t<div class='table'>\n\t\t<form role ='form' id='select_event' method='POST' action=''>\n\t\t\t<select name='eventname' >\n\t\t\t\t<option value='0'>Select event to edit: </option>";
    $events = getAllEvents();
    for ($i = 0; $i < count($events); $i++) {
        $evname = $events[$i]['event_name'];
Ejemplo n.º 2
0
 public function deleteCarrier()
 {
     isAdminLogin();
     if (Input::exists("id")) {
         $id = Input::get("id");
         if (empty($id)) {
             echo json_encode(['result' => "Id required to do this action."]);
         } else {
             $user = Carrier::all(['id' => $id]);
             if (count($user) > 0) {
                 if ($user[0]->delete()) {
                     echo json_encode(['result' => 1]);
                 }
             } else {
                 echo json_encode(['result' => "Invalid id to delete this item."]);
             }
         }
     } else {
         echo json_encode(['result' => "Invalid action."]);
     }
 }
Ejemplo n.º 3
0
 static function create($tbl, $asAdmin = false)
 {
     /*
     		if (!isUserLogin() && !isEmpLogin())
     		{
     			$wx = getWeixinUser();
     			$wx->autoLogin();
     		}
     */
     $cls = null;
     $noauth = 0;
     # note the order.
     if ($asAdmin || isAdminLogin()) {
         $cls = "AC0_{$tbl}";
         if (!class_exists($cls)) {
             $cls = "AccessControl";
         }
     } else {
         $cls = onCreateAC($tbl);
         if (!isset($cls)) {
             $cls = "AC_{$tbl}";
             if (!class_exists($cls)) {
                 $cls = null;
                 $noauth = 1;
             }
         }
     }
     if ($cls == null || !class_exists($cls)) {
         throw new MyException($noauth ? E_NOAUTH : E_FORBIDDEN, "Operation is not allowed for current user on object `{$tbl}`");
     }
     $x = new $cls();
     if (is_null($x->table)) {
         $x->table = $tbl;
     }
     return $x;
 }
Ejemplo n.º 4
0
 static function getPerms()
 {
     $perms = 0;
     if (isUserLogin()) {
         $perms |= AUTH_USER;
     } else {
         if (isAdminLogin()) {
             $perms |= AUTH_ADMIN;
         } else {
             if (isEmpLogin()) {
                 $perms |= AUTH_EMP;
             }
         }
     }
     if (isset($GLOBALS["TEST_MODE"])) {
         $perms |= AUTH_TEST_MODE;
     }
     if (isset($GLOBALS["MOCK_MODE"])) {
         $perms |= AUTH_MOCK_MODE;
     }
     return $perms;
 }